Sunday, 26 January 2014

Resize LVM partition in Debian Linux

I have my Lenovo T430 laptop with Debian Wheezy installed. My setup was a root partition / with 5Gb size, and 70Gb /home partition.  I use Fluxbox desktop in my laptop and happy with the customization i can do.

The problem now is the root partition is getting full as the application installed under root partition. So i need to extend the size. Lucky i use LVM in linux. so i can just resize it. Always keep your installation CD because it is needed now.

Some step i make i documented here so i can refer back to the procedure. here we go the step i was done :

1. Boot using the install CD.
2. Choose advanced - rescue mode
3. Do not select any mount partition, use installation shell mode.
4. Scan the pv using pvscan , then lvscan until you see your LVM partition on disk.
5. Now we got the lvm partition, in my case /dev/HG/root . Then do vgchange -ay.
6. Before resize, do disk checking by e2fsck -f /dev/HG/root
7. Because i want to extend the lvm size do : lvextend -L +5G /dev/HG/root
8. Then we extend the partition : resize2fs -p /dev/HG/root  

Let say we want to reduce the root partition from 5G to 4G, we do the same step until step 7.
If we want to reduce the step different from step 7 which is :
7. Because want to reduce, we reduce the partition first :
     resize2fs /dev/HG/root 3G
8. Then we reduce the lvm partition :
    lvreduce -L 4G /dev/HG/root
9. Then we make the Fs use all the lvm partition prepared :
    resize2fs /dev/HG/root

Well this was my experience with LVM partition resize and extend.

Thanks for reading and hope its helpful to others.

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More