I've usually been afraid to do anything drastic with the underlying filesystem because of how many times I've messed up the filesystem to begin with, and also because of how much time it takes to reinstall everything. This time, I decided that it was ok to go ahead and take a little risk here. My Linux machine is an old X61s, and its purpose is for me to experiment and learn more about Linux.
I started getting a message that I was running low on space on root. Sure enough, the 300MB was all used up. I was hoping that GPartEd could help me with resizing the partitions. I couldn't see the partitions because it was all under an lvm.
My plan was to shrink /opt slightly, then grow root. Thankfully, the formula isn't too bad, but there are a few steps.
The first link I resorted to was this one: http://blog.shadypixel.com/how-to-shrink-an-lvm-volume-safely/. I didn't reboot to resize /opt; I just resized it after unmounting it.
Unmount /opt:
# umount /dev/chrono/opt
Check the file system consistency:
# e2fsck -f /dev/chrono/opt
Resize the filesystem to less than my target volume size:
# resize2fs /dev/chrono/opt 100G
Reduce the logical volume size:
# lvreduce -L 120G /dev/chrono/opt
Grow the /opt filesystem to fill the volume:
# resize2fs -p /dev/chrono/opt
So, that wasn't too bad... The next part was to extend the root volume. I rebooted using a live cd and then followed instructions from this link: http://www.radioprosciutto.com/node/7
Make sure we can access the volumes:
# vgchange -a y
Grow the root logical volume:
# lvextend -L +5G /dev/chrono/root
Check the file system consistency:
# e2fsck -f /dev/chrono/root
Grow the filesystem to fill the volume:
# resize2fs -p /dev/chrono/root
I rebooted and voila! My partitions were correctly resized. :)
I started getting a message that I was running low on space on root. Sure enough, the 300MB was all used up. I was hoping that GPartEd could help me with resizing the partitions. I couldn't see the partitions because it was all under an lvm.
My plan was to shrink /opt slightly, then grow root. Thankfully, the formula isn't too bad, but there are a few steps.
The first link I resorted to was this one: http://blog.shadypixel.com/how-to-shrink-an-lvm-volume-safely/. I didn't reboot to resize /opt; I just resized it after unmounting it.
Unmount /opt:
# umount /dev/chrono/opt
Check the file system consistency:
# e2fsck -f /dev/chrono/opt
Resize the filesystem to less than my target volume size:
# resize2fs /dev/chrono/opt 100G
Reduce the logical volume size:
# lvreduce -L 120G /dev/chrono/opt
Grow the /opt filesystem to fill the volume:
# resize2fs -p /dev/chrono/opt
So, that wasn't too bad... The next part was to extend the root volume. I rebooted using a live cd and then followed instructions from this link: http://www.radioprosciutto.com/node/7
Make sure we can access the volumes:
# vgchange -a y
Grow the root logical volume:
# lvextend -L +5G /dev/chrono/root
Check the file system consistency:
# e2fsck -f /dev/chrono/root
Grow the filesystem to fill the volume:
# resize2fs -p /dev/chrono/root
I rebooted and voila! My partitions were correctly resized. :)
Comments
Post a Comment