美文网首页
Linux磁盘挂载

Linux磁盘挂载

作者: yandaren | 来源:发表于2017-03-16 15:10 被阅读0次
  • 检查下你的磁盘是否已经挂载上
[root@VM_77_2_centos ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        20G  1.9G   17G  10% /
devtmpfs        1.9G     0  1.9G   0% /dev
tmpfs           1.9G   24K  1.9G   1% /dev/shm
tmpfs           1.9G   13M  1.9G   1% /run
tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup
  • 查看你机器上的所有磁盘
[root@VM_77_2_centos ~]# fdisk -l
Disk /dev/vda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000c47d9
   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    41943039    20970496   83  Linux
Disk /dev/vdb: 64.4 GB, 64424509440 bytes, 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

可以看到/dev/vdb没有格式化

  • 格式化/dev/vdb
[root@VM_77_2_centos ~]# mkfs.ext3 /dev/vdb
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
3932160 inodes, 15728640 blocks
786432 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
480 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
  • 挂载磁盘
    将磁盘挂载在路径 /data/d1
[root@VM_77_2_centos ~]# mkdir /data/d1 -p
[root@VM_77_2_centos ~]# ls /data
d1
[root@VM_77_2_centos ~]# mount /dev/vdb /data/d1
[root@VM_77_2_centos ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        20G  1.9G   17G  10% /
devtmpfs        1.9G     0  1.9G   0% /dev
tmpfs           1.9G   24K  1.9G   1% /dev/shm
tmpfs           1.9G   13M  1.9G   1% /run
tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/vdb         59G   52M   56G   1% /data/d1
  • 设置自动挂载
    先备份下文件 /etc/fstab, 然后修改/etc/fstab,将先的磁盘信息加上
[root@VM_77_2_centos ~]# cp /etc/fstab /etc/fstab.bk
[root@VM_77_2_centos ~]# vim /etc/fstab

将新的磁盘信息追加上

/dev/vda1            /                    ext3       noatime,acl,user_xattr 1 1
proc                 /proc                proc       defaults              0 0
sysfs                /sys                 sysfs      noauto                0 0
debugfs              /sys/kernel/debug    debugfs    noauto                0 0
devpts               /dev/pts             devpts     mode=0620,gid=5       0 0
/dev/vdb             /data/d1             ext3       defaults              0 2

相关文章

  • Linux磁盘挂载和扩容(1)

    本章我们先介绍Linux服务器磁盘挂载,下期介绍Linux磁盘扩容问题。 前言 Linux磁盘挂载有两种情况 1....

  • Linux中初始化一个新磁盘

    Linux中挂载一个新磁盘后,创建分区并自动挂载的方法: 在线扩容一个已有磁盘

  • Linux挂载磁盘空间

    Linux挂载磁盘空间 (1)查看磁盘空间 (2)查看硬盘及分区信息 (3)格式化新分区 (4)将磁盘挂载在/po...

  • 华为云重启后mount挂载磁盘消失

    今天在华为云服务器上挂载一块磁盘,重启之后挂载消失;经过一番搜索得知,Linux磁盘挂载之后需要设置开机时自动挂载...

  • linux 挂载磁盘

    1.通过命令fdisk -l 和df -h 命令查看未挂载的硬盘2.硬盘分区 ,执行命令 fdisk /dev/...

  • linux挂载磁盘

    sudo mount -t ntfs /dev/sda3 nove/H -o iocharset=utf8,uma...

  • Linux:磁盘挂载

    磁盘挂载分为三步,分区,格式化,挂载。一、分区首先现在CentOS添加一块硬盘,作为实验,分配5G大小就足够了,在...

  • linux挂载磁盘

    **** Virtualbox中Linux添加一个新磁盘->创建分区->格式化->挂载分区 2013-04-14 ...

  • linux 磁盘挂载

    挂载过程 【检查硬盘设备是否有数据盘】 命令 fdisk -lQQ图片20171110151951.png 数据硬...

  • Linux挂载磁盘

    Linux挂载磁盘 解决:Disk /dev/sdb doesn't contain a valid partit...

网友评论

      本文标题:Linux磁盘挂载

      本文链接:https://www.haomeiwen.com/subject/fykjnttx.html