What is LVM?
LVM1 versus LVM2
Planning Disk Layout
Growing a partition
Backing up LVM metadata
LVM recovery
Ignoring CD-ROM devices
There are two parts to LVM: the disk format and the utilities to access LVM partitions. LVM2 utilities are backward compatible with the LVM1 disk format, but LVM1 utilities cannot read the LVM2 disk format.
The LVM2 disk format is alleged to be better. You can upgrade your disk format from LVM1 to LVM2 with vgconvert, but may not be able to go back.
2.4 kernels work with LVM1 and LVM2 utilities. 2.6 kernels only work with LVM2 utilities.
With LVM, it is no longer critical to
accurately estimate future disk usage. Partitions may easily be
resized, in some cases without unmounting the file system.
Why use multiple partitions at all?
For example, most kernels can read the
Ext3 file system, but maybe not more advanced systems such as XFS. The
system's root file system is constrained to Ext3, but most of the files
can be XFS. Or stripped across multiple disks (similar, but not the
same, as RAID 0 stripping).
Rather than give most or all of your
entire hard disk to the LVM, consider saving a significant portion as
unpartitioned storage. It's easy enough to partition the next chunk and
adding it to LVM later. (Nice idea, though not mine.) For example,
give the first 20 GB of an 80 GB drive to LVM and leave the rest
available for the future. Who knows what could come up?
To grow a partition "/dev/vg/usr" by 5GB, run:
lvextend -L+5G /dev/vg/usr
Then the file system will have to be
resized. Some file systems must be umounted before resizing. Unmounting
is not required before enlarging an LVM partition (it is before
shrinking one). Also see the LVM Howto: Extending a Logical Volume.
To see how much space is available in the LVM:
# vgdisplay
This is the sequence for growing an ext3 partition by 5 GB:
With the 2.6 kernel, you can grow an ext3 filesystem without unmounting.
LVM's metadata tells it where the physical and logical partitions are. If it gets damaged, you can't see your files.
LVM automatically backs up metadata to "/etc/lvm" after each change. However, if you want to explicitly backup the metadata, run "vgcfgbackup".
Use "vgcfgrestore" to restore the metadata if it gets damaged. You will most likely never use this command.
Tell the LVM utilities to ignore CD-ROM devices by adding the text:
devices { filter=["r/cdrom/"] }
to "/etc/lvm/lvm.conf" (Create the file, if necessary).
| Copyright © 2004 Craig Lawson | ||
| Index | ![]() |