lvm结构:
磁盘 => 分区 => PV => VG => LV => 文件系统
扩张:
先扩LV再扩文件系统
lvextend -L +100M /dev/vg1/lv1 逻辑卷的大小增加100M
resize2fs /dev/vg1/lv1 文件系统增到逻辑卷的大小
收缩:
先减文件系统再减LV(注意顺序)
umount /dev/vg1/lv1
e2fsck -f /dev/vg1/lv1
resize2fs /dev/vg1/lv1 100M 减小文件系统到100M
lvreduce -L 100M /dev/vg1/lv1 减小逻辑卷到100M
mount -a
创建PV所需分区:
[root@rhel6-client ~]# fdisk -cul /dev/sda
Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders, total 209715200 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 identifier: 0x000cb393
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 411647 204800 83 Linux
/dev/sda2 411648 41371647 20480000 83 Linux
/dev/sda3 41371648 45467647 2048000 82 Linux swap / Solaris
[root@rhel6-client ~]# fdisk -cu /dev/sda
Command (m for help): p
Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders, total 209715200 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 identifier: 0x000cb393
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 411647 204800 83 Linux
/dev/sda2 411648 41371647 20480000 83 Linux
/dev/sda3 41371648 45467647 2048000 82 Linux swap / Solaris
Command (m for help): n
Command action
e extended
p primary partition (1-4)
e
Selected partition 4
First sector (45467648-209715199, default 45467648):
Using default value 45467648
Last sector, +sectors or +size{K,M,G} (45467648-209715199, default 209715199):
Using default value 209715199
Command (m for help): p
Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders, total 209715200 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 identifier: 0x000cb393
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 411647 204800 83 Linux
/dev/sda2 411648 41371647 20480000 83 Linux
/dev/sda3 41371648 45467647 2048000 82 Linux swap / Solaris
/dev/sda4 45467648 209715199 82123776 5 Extended
Command (m for help): n
First sector (45469696-209715199, default 45469696):
Using default value 45469696
Last sector, +sectors or +size{K,M,G} (45469696-209715199, default 209715199): +100M
Command (m