|
One of the difficult decisions facing a new user installing Linux for the first time is how to partition the disk drive. The need to estimate just how much space is likely to be needed for system files and user files makes the installation more complex than is necessary and some users simply opt to put all their data into one large partition in an attempt to avoid the issue.
Once the user has guessed how much space is needed for /home /usr / (or has let the installation program do it) then is quite common for one of these partitions to fill up even if there is plenty of disk space in one of the other partitions.
With logical volume management, the whole disk would be allocated to a single volume group and logical volumes created to hold the / /usr and /home file systems. If, for example the /home logical volume later filled up but there was still space available on /usr then it would be possible to shrink /usr by a few megabytes and reallocate that space to /home.
Another alternative would be to allocate minimal amounts of space for each logical volume and leave some of the disk unallocated. Then, when the partitions start to fill up, they can be expanded as necessary.
As an example: Joe buys a PC with an 8.4 Gigabyte disk on it and installs Linux using the following partitioning system:
/boot /dev/hda1 10 Megabytes swap /dev/hda2 256 Megabytes / /dev/hda3 2 Gigabytes /home /dev/hda4 6 Gigabytes |
Sometime later Joe decides that he want to install the latest office suite and desktop UI available but realizes that the root partition isn't large enough. But, having archived all his MP3s onto a new writable DVD drive there is plenty of space on /home.
His options are not good:
Reformat the disk, change the partitioning scheme and reinstall.
Buy a new disk and figure out some new partitioning scheme that will require the minimum of data movement.
Set up a symlink farm on / pointing to /home and install the new software on /home
With LVM this becomes much easier:
Jane buys a similar PC but uses LVM to divide up the disk in a similar manner:
/boot /dev/hda1 10 Megabytes swap /dev/vg00/swap 256 Megabytes / /dev/vg00/root 2 Gigabytes /home /dev/vg00/home 6 Gigabytes |
boot is not included on the LV because bootloaders don't understand LVM volumes yet. It's possible boot on LVM will work, but you run the risk of having an unbootable system. |
root on LV should be used by advanced users only | |
---|---|
root on LVM requires an initrd image that activates the root LV. If a kernel is upgraded without building the necessary initrd image, that kernel will be unbootable. Newer distributions support lvm in their mkinitrd scripts as well as their packaged initrd images, so this becomes less of an issue over time. |
When she hits a similar problem she can reduce the size of /home by a gigabyte and add that space to the root partition.
Suppose that Joe and Jane then manage to fill up the /home partition as well and decide to add a new 20 Gigabyte disk to their systems.
Joe formats the whole disk as one partition (/dev/hdb1) and moves his existing /home data onto it and uses the new disk as /home. But he has 6 gigabytes unused or has to use symlinks to make that disk appear as an extension of /home, say /home/joe/old-mp3s.
Jane simply adds the new disk to her existing volume group and extends her /home logical volume to include the new disk. Or, in fact, she could move the data from /home on the old disk to the new disk and then extend the existing root volume to cover all of the old disk.
Hosting by: Hurra Communications Ltd.
Generated: 2007-01-26 17:58:11