centos挂载磁盘

查看磁盘信息

[root@localhost ~]# fdisk -l

Disk /dev/vda: 85.9 GB, 85899345920 bytes
16 heads, 63 sectors/track, 166440 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0009345c

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *           3        1018      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/vda2            1018      166441    83373056   8e  Linux LVM
Partition 2 does not end on cylinder boundary.

Disk /dev/vdb: 536.9 GB, 536870912000 bytes
16 heads, 63 sectors/track, 1040253 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

有一块500G的盘还未挂载

格式化硬盘

[root@localhost ~]# mkfs.ext4 /dev/vdb
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
32768000 inodes, 131072000 blocks
6553600 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=4294967296
4000 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, 20480000, 23887872, 71663616, 78675968, 
        102400000

正在写入inode表: 完成                            
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成

This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

创建目录并挂载

[root@localhost ~]# mkdir /opt
[root@loaclhost ~]# mount /dev/vdb /opt
[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_centos6-lv_root
                       50G  4.8G   42G  11% /
tmpfs                  12G  224K   12G   1% /dev/shm
/dev/vda1             477M  115M  337M  26% /boot
/dev/mapper/vg_centos6-lv_home
                       26G   68M   24G   1% /home
tmpfs                  60M     0   60M   0% /var/log/rtlog
/dev/vdb              493G   70M  467G   1% /opt

看到已经挂载成功了

开机自动挂载

[root@sql ~]# blkid
/dev/vdb: UUID="a9e87164-def8-42ae-9770-708b6d090fbd" TYPE="ext4" 
#查看UUID 并添加到/etc/fstab
[root@sql ~]# vi /etc/fstab
UUID=a9e87164-def8-42ae-9770-708b6d090fbd  /opt  ext4    defaults 0 0
添加新评论