7 Stacking up everything
With all the different concepts related to using mass storage space, how should a file system be structured? The following is a
stack of concepts, from the lowest level to the highest level.
- Hard disk drive. This is the most basic component. There is a trend to use solid state hard drives even in servers
for energy efficiency and speed. The purpose of a hard disk drive is simple: to provide non-volatile storage.
- RAID (usually RAID1 or RAID5). Hard disk drives are combined to RAID1 or RAID5 devices using either
hardware or software implementation. In either case, a block device is created for each RAID device. Note
that Linux cannot boot to a file system that uses RAID5 as an underlying device. This is why a the boot
device should use RAID1 if the implementation is software based. The purpose of RAID is to provide low-level
redundancy (against data loss due to hardware failure), high availability (hot swap capability) and large volume
(by combining the capacities of multiple drives).
- PV. A RAID device is marked as a physical volume in LVM. Note that a PV is designated by the block device
that is marked as a PV using metadata. Because a PV needs to be marked by a special metadata, it cannot
support any normal file systems directly. The purpose of a PV is to supply basic storage units to VGs.
- VG. One or more VGs are created from PVs. A VG is represented not as a block device, but rather a directory
in the /dev directory. This is because a VG is logically a container of logical volumes. This means that a VG
cannot support a normal file system. The main purpose of a VG is to isolate PVs from LVs. Without the VG
layer, every LV needs to know about PVs and coordinate the allocation of extents. With the VG layer, each
LV only needs to belong to a VG, there is no need to know about PVs.
- LV. Each VG contains one or more LVs. Each LV is represented as a generic block device without any mandatory
metadata (like a PV). As a result, an LV can support a file system. LVs are the final product of LVM, its main
purpose is to provide a generic block device for file systems. In the world of LVM, an LV is equivalent to a
partition. Note that with RAID1 or RAID5 as an underlying storage device, there is no need to specify LVM
mirroring.
- File system. In this hierarchy, a file system is the last (highest level) component to implement files and
directories. To utilize the full potential of LVM, it is best to use a file system that supports live resize operations,
such as ext3 (with proper kernel support) and XFS.