I am trying to learn more about partitioning in Linux, specifically LVM partitioning. So I have been looking through many sources on this, various examples, but none of them seem to go into more detail on this, so I was hoping to get some insight to understand better.
-
Reading the RHEL 7 guide. It lists the available file systems of xfs, ext4, ext3, ext2, vfat, swap, bios boot, bios boot with efi. This section is referenced in the kickstart syntax section here (ctrl+f for
--fstype
). In a number of examples I notice people using--fstype="lvmpv"
, when making LVM physical volumes. What is the purpose of that? If I want to make a partition for/var
, wouldn't a command likepart pv.4 \var...
, excluding the fstype automatically create a LVM physical volume? I just find it odd that its being used as a file system type, yet not defined in the file system section as a valid value. -
The second part of the above question has to do with the
pv.id
portion, am I correct in understanding that the id can be any number? Is there any reason I shouldn't just automatically number each of my physical volumes 1,2,3,4..? I noticed in a few guides people were partitioning withpv.18
followed bypv.11
. As an example, the one here
Best Answer
You're right that
lvmpv
isn't a real filesystem type. But, the point of that parameter isn't as much to define a filesystem. It's to define what goes into the partition. In this case, instead of a filesystem, the partition contains an LVM physical volume.On that note, you may wish to study LVM a bit closer. The point of it is to create logical volumes, i.e. block devices, out of arbitrary physical devices. While your only PV may be one partition of one disk, it's possible for space on several physical disks to be used to create logical volumes which use all of the physical disks.
Which brings us to
pv.###
. This is just a random number, used within the kickstart file, to uniquely identify LVM PVs during installation. It's not used at all post-installation.Continuing with our study, logical volumes exist within volume groups, which are groups of one or more physical volumes in which the logical volumes will be created.
Let's take a look at my workstation. As you may know, if you do a manual installation, a kickstart file will be generated which represents the installed system, which you can then use to repeat the installation. When I open this up, I have:
Partition
pv.409
consists of one partition onsda
. If I wanted, I could have had another partition onsdb
, e.g.pv.812
, and also used that for LVM.My volume group
fedora_musken
usespv.409
, and if I'd created any more PVs, I could have added them to the volume group as well. Then, logical volumes would have spanned across all of the physical volumes.Finally I have some logical volumes, which ought to be familiar enough.
For a detailed explanation of how LVM works, see Chapter 2 of RHEL's Logical Volume Manager Administration document.