Linux 挂载磁盘记录
Linux服务器申请了磁盘之后,用fdisk -l查看资源已经有了:
Disk /dev/vdb: 1099.5 GB, 1099511627776 bytes
16 heads, 63 sectors/track, 2130440 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
但是,df -h查看目录不存在,此时需要挂载。
本例中创建两个目录
/testA 600G
/testB 400G
操作如下:
1、pvcreate /dev/vdb
2、vgcreate datavg /dev/vdb
3、lvcreate -n testAlv -L 600G datavg
4、lvcreate -n testBlv -L 400G datavg
5、mkfs.ext4 /dev/mapper/datavg-testAlv
6、mkfs.ext4 /dev/mapper/datavg-testBlv
7、mkdir /testA /testB
8、 mount /dev/mapper/datavg-testBlv /testB
9、mount /dev/mapper/datavg-testAlv /testA
10、修改/etc/fstab 增加
/dev/mapper/datavg-testBlv ext4 defaults 1 2
/dev/mapper/datavg-testAlv ext4 defaults 1 2
此时再执行df -h命令
# df -h Filesystem Size Used Avail Use% Mounted on 。。。。。 /dev/mapper/datavg-testAlv 591G 198M 561G 1% /testA /dev/mapper/datavg-testBlv 394G 199M 374G 1% /testB
整块盘全部格式化加载到1个目录下:
pvcreate /dev/vdb
vgcreate datavg /dev/vdb
lvcreate -l 100%VG -n lv01 datavg
mkfs.ext4 /dev/mapper/datavg-lv01
mkdir /data
mount /dev/mapper/datavg-lv01 /data
修改 etc/fstab文件,追加:
/dev/mapper/datavg-lv01 /data ext4 defaults 1 2