A few weeks ago my laptop was starting to produce strange errors on my old OpenSUSE 11.0, mainly due to me and my big curiosity for new things, compiles of applications etc. etc. So it was time to reinstall my work laptop with a complete new fresh OpenSUSE 11.3 installation.
One of the first things that came to my mind was, how am I going to setup my partition scheme. Then my second thought was let’s do it completely with LVM, except for the /boot this will be a little fixed partition of 150MB and my swap partition. So I created a few logical volumes, and one of them was my root volume /, I made this 60GB. Don’t ask me why I did this but it seemed okay at the time.
A few weeks later I was resizing some volumes to create some space for my virtual machines, and offcourse then you need to unmount the partition you want to resize. This can be done using for example using the nice yast partition tool or just the console commandline option. So my thought was why did I made this volume this big I’m only using about 5GB max of it, so let’s resize it back to 10GB to be safe. Unfortunately the resizing does not work for your root volume because you can’t unmount this while your system is still running. Luckily I had my CD case with me and I found had my SLES11 DVD, so I booted my laptop with this DVD in rescue mode. This is where the fun starts.
Little side note, my volumegroup is called system and my root volume is called root, i like it simple. And it contained an ext4 filesystem.
Make sure you have the prompt in front of you.
# lvm vgchange –a y
This next step may take a while before it is complete
# resize2fs –f /dev/system/root 10G # lvreduce –L10G /dev/system/root
Now this root volume was brought back to 10GB. Only thing left was to reboot my laptop without the DVD and start smiling. I got some more GB’s to use on my laptop for my precious virtual machines.
So if you ever do such an action like me and you realize: i made my root volume too big. Now you know how to resize it.