1.新建2个分区(略)
2.修改分区id为8e
3.partprobe
4.初始化物理卷
[root@ www.linuxidc.com ~]# pvcreate /dev/sda7 /dev/sda8
Physical volume "/dev/sda7" successfully created
Physical volume "/dev/sda8" successfully created
5.创建卷组
[root@ www.linuxidc.com ~]# vgcreate testvg /dev/sda7 /dev/sda8
Volume group "testvg" successfully created
6创建逻辑卷,不要占用所有空间
[root@ www.linuxidc.com ~]# lvcreate -L 40M -n testlv testvg
Logical volume "testlv" created
[root@ www.linuxidc.com data-lv]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 6940516 2217116 4365152 34% /
/dev/sda1 101086 11009 84858 12% /boot
tmpfs 972276 0 972276 0% /dev/shm
/dev/md2 972280 17632 905256 2% /mnt
/dev/mapper/testvg-testlv
39663 39640 0 100% /data-lv
7在逻辑卷上创建ext3文件系统:
mke2fs –j /dev/testvg/testlv
8创建data-lv目录并挂载
9在testlv目录下创建文件
[root@ www.linuxidc.com data-lv]# dd if=/dev/zero of=/data-lv/bigfile bs=1M count=50
dd: writing `/data-lv/bigfile': No space left on device
35+0 records in
34+0 records out
35733504 bytes (36 MB) copied, 1.30968 seconds, 27.3 MB/s
提示空间不足
10 扩展逻辑卷,再增加50M,须先调整分区大小 再调整文件系统大小
[root@ www.linuxidc.com ~]# lvextend -L +50M /dev/testvg/testlv
Rounding up size to full physical extent 52.00 MB
Extending logical volume testlv to 92.00 MB
Logical volume testlv successfully resized
[root@ www.linuxidc.com ~]# resize2fs /dev/testvg/testlv
[root@ www.linuxidc.com ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 6940516 2217120 4365148 34% /
/dev/sda1 101086 11009 84858 12% /boot
tmpfs 972276 0 972276 0% /dev/shm
/dev/md2 972280 17632 905256 2% /mnt
/dev/mapper/testvg-testlv
91099 40117 46276 47% /data-lv