命令如下:
root@linuxidc.com:~# lvs
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
root linuxidc.com-vg -wi-ao--- 37.73g
swap_1 linuxidc.com-vg -wi-ao--- 12.00g
root@linuxidc.com:~# lvextend --help
lvextend: Add space to a logical volume
lvextend
[-A|--autobackup y|n]
[--alloc AllocationPolicy]
[-d|--debug]
[-f|--force]
[-h|--help]
[-i|--stripes Stripes [-I|--stripesize StripeSize]]
{-l|--extents [+]LogicalExtentsNumber[%{VG|LV|PVS|FREE|ORIGIN}] |
-L|--size [+]LogicalVolumeSize[bBsSkKmMgGtTpPeE]}
[-m|--mirrors Mirrors]
[--nosync]
[--use-policies]
[-n|--nofsck]
[--noudevsync]
[-r|--resizefs]
[-t|--test]
[--type VolumeType]
[-v|--verbose]
[--version]
LogicalVolume[Path] [ PhysicalVolumePath... ]
root@linuxidc.com:~# lvextend -l +100%free /dev/linuxidc.com-vg/root (100%剩余的空闲空间全部给与root的lv)
Extending logical volume root to 53.76 GiB
Logical volume root successfully resized
root@linuxidc.com:~# lvs
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
root linuxidc.com-vg -wi-ao--- 53.76g
swap_1 linuxidc.com-vg -wi-ao--- 12.00g
2.4 根分区识别空闲的磁盘空间
操作如下:
root@linuxidc.com:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 989M 4.0K 989M 1% /dev
tmpfs 200M 712K 200M 1% /run
/dev/dm-0 38G 2.6G 33G 8% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
none 5.0M 0 5.0M 0% /run/lock
none 1000M 0 1000M 0% /run/shm
none 100M 0 100M 0% /run/user
/dev/sda1 236M 40M 184M 18% /boot
root@linuxidc.com:~# resize2fs /dev/linuxidc.com-vg/root
resize2fs 1.42.9 (4-Feb-2014)
Filesystem at /dev/linuxidc.com-vg/root is mounted on /; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 4
The filesystem on /dev/linuxidc.com-vg/root is now 14092288 blocks long.
root@linuxidc.com:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 989M 4.0K 989M 1% /dev
tmpfs 200M 712K 200M 1% /run
/dev/dm-0 53G 2.6G 48G 6% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
none 5.0M 0 5.0M 0% /run/lock
none 1000M 0 1000M 0% /run/shm
none 100M 0 100M 0% /run/user
/dev/sda1 236M 40M 184M 18% /boot
root@linuxidc.com:~#
至此,/分区扩展至53G。
Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx