Last modified: Jan, 2010
The basic steps are like this: check free space –> expand logic volume –> expand file system. It can be done even with file system mounted.
df -h
sudo lvdisplay
sudo vgdisplay
sudo lvresize -L +1GB /dev/mapper/vg-xxx/yyy
sudo lvdisplay
sudo resize2fs -p /dev/mapper/vg-xxx/yyy
This command works for both ext2 and ext3 file systems.
The order of shrinking is just the reverse of expanding: umount the file system –> check file system integrity –> shrink file system –> shrink logic volume.
sudo umount /yyy
and get rid of any “device is busy” stuff.
sudo e2fsck -f /dev/mapper/vg-xxx/yyy
sudo resize2fs /dev/mapper/vg-xxx/yyy 2000M
Here it goes down to 2G, but above the physical size of existing files. This command works for both ext2 and ext3.
sudo lvresize -L -1G /dev/mapper/vg-xxx/yyy
Here the logic volume is shrunk by 1G. The left space should not be smaller than that of the file system. Do the math.
sudo resize2fs -p /dev/mapper/vg-xxx/yyy
sudo lvresize -l +100%FREE