Friday, November 23, 2007

 

Resizing a logical volume without unmounting in Linux

I had a problem where the logical volume our kickstart image created was too small, despite the disk having enough space. As you see it only allocated 4GB:
[root@example sbin]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
4128448 3716732 202004 95% /
/dev/sda1 101086 18598 77269 20% /boot
none 8203424 0 8203424 0% /dev/shm

The logical volume can be resized by running lvm (as root) at the command prompt and the following command (For 50GB):
lvm> lvresize -L 50G VolGroup00/LogVol00

The issue we then had is that this isn't committed! Exit lvm, and then type the following:
ext2online /dev/mapper/VolGroup00-LogVol00

After a few minutes of processing you will now find you have a larger volume:
[root@example sbin]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
51606140 3721676 45263616 8% /
/dev/sda1 101086 18598 77269 20% /boot
none 8203424 0 8203424 0% /dev/shm

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]