Monday, May 07, 2012

Managing Partitions in Linux

Managing partitions in Linux is easy with the right tools. Some of the tools readily available on Fedora 16 are
  • Disk Utility
  • GPartEd
  • parted
PartEd is a console application and can be used from a rescue disk. I've managed to detach and move the /boot partition while the system was running.
To work with Logical Volumes, additional package is required:
  • system-config-lvm
This is a GUI tool for managing logical volumes on an extended partition. You can also use the following commands manually:
  • lvresize,  for resizing logical volumes (LV)
  • pvresize, for resizing physical volumes (PV)
For more details, see the LVM How-To. It describes LVM concepts in details. After reading the text it becomes quite clear how LVM system works and puts things into perspective. There is no need to resize a Volume Group as such. It simply contains all the physical disks we assign to it, abstracts all that space into one unit and then splits it up into Logical Volumes. This means that, to increase space in a Logical Volume Group we would simply add another disk or partition to it and then resize the Logical Volumes. To shring the Group, we would shrink the Logical Volumes and then remove the Physical Volume from the Group. 

However, to resize a Group that has only one Physical Volume, is a bit more difficult. How to do this without a reboot is described here. The point, as described here, is to shrink the Logical Volume first, then the Physical Volume. In the end, delete and (re-)create the LVM group with the same starting position. By setting the end position before or after the previous value you would effectively shrink or enlarge the LVM partition.

And, in the end, there is KDE Volume and Partition Manager (link) - kde-partitionmanager - that supports both parted and lvm (lvm2) commands. As the description states: "Kvpm is a GUI front end for Linux LVM and Gnu parted. LVM2 groups and volumes can be created, removed and manipulated using most of the options supported by the standard LVM2 tools. Some support for creating and operating on partitions is also provided. It also handles creating and mounting file systems.

The LVM version: 2.02.88 or newer must be installed with the lvm2app library. Only the KDE 4 libraries need to be installed, not the entire desktop, so it my be run from within Gnome for instance."
It is worth trying out.

References: LVM How-to (link), LVM Cheatsheet (link), Extend a Volume Group (link), Editing Logical Volumes (link), LVM Resizing Guide (link), Growing a live LVM volume (link), Moving LVM partition (link)

No comments: