LVM (Logical Volume Manager) is an alternative system to partitioning. It allows logical volumes (i.e. "virtual partitions") to be spread over many physical volumes (i.e. hard disks and/or partitions). LVM is supported on Linux version 2.4, and later.
RAID (Redundant Array of Inexpensive Disks) is a system for using many disks and/or partitions together, as a "virtual partition". There are a few different modes of utilising software RAID, that are essentially:
Software RAID is supported on Linux version 2.0, and later.
Hardware RAID is supported normally by Parted - so you need not read this section if you are using hardware RAID (as opposed to software RAID).
LVM, software RAID and partitions are often used simultaneously, but they can all be used independently. LVM and software RAID are often composed of partitions, rather than raw hard disks.
GNU Parted does not support LVM and software RAID in full, but it is still useful when used in combination with their respective tools. Parted is useful for these tasks:
To create a RAID or LVM partition, you must:
(parted) mkpart primary ext2 0 4000 (parted) set 1 lvm on
Note: the LVM or RAID partition will not be ready for use yet. You still need to run mkraid(8) for RAID, or use the LVM tools to initialise the physical volume, and create logical groups, etc.
Parted can manipulate RAID and LVM logical volumes, even though it does not understand RAID or LVM. It utilises Linux's support for RAID and LVM. Therefore, you can only use these methods if your Linux kernel supports RAID and/or LVM.
To manipulate a file system on a RAID or LVM logical volume (or, a raw partition, for that matter), you can start parted by selecting the logical volume (partition) device. For example:
# parted /dev/md0
For the rest of this chapter, "virtual device" will refer to the device Parted is editting (in our example cases, `/dev/md0').
To create a file system on an LVM volume, use the following steps:
(parted) mklabel loop
(parted) print Disk geometry for /dev/md0: 0.000-47.065 megabytes Disk label type: loop Minor Start End Filesystem Flags (parted) mkpartfs primary ext2 0 47.065 (parted) print Disk geometry for /dev/md0: 0.000-47.065 megabytes Disk label type: loop Minor Start End Filesystem Flags 1 0.000 47.065 ext2
You usually resize the file system at the same times as you resize your virtual device. If you are growing the file system and virtual device, you should grow the device first (with the RAID or LVM tools), and then grow the file system. If you are shrinking the file system and virtual device, you should shrink the file system first, and then the virtual device afterwards.
To resize the file system in Parted, use the resize command. For example:
(parted) select /dev/md0 (parted) resize 1 0 20
To copy a filesystem from an LVM or RAID virtual device, just use the cp command. For example:
(parted) select /dev/hda (parted) cp /dev/md0 1 3
To copy a file system from an LVM or RAID virtual device, use the following recipe:
(parted) select /dev/md0 (parted) mklabel loop
(parted) mkpartfs primary ext2 0 47.065
(parted) select /dev/hda (parted) cp /dev/md0 3 1
Go to the first, previous, next, last section, table of contents.