CentOS/RHEL 7 LVM Partitioning in Kickstart?

Alex Mikhaelson asked:

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.

  1. 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 like part 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.

  2. 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 with pv.18 followed by pv.11. As an example, the one here

My 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:

# Disk partitioning information
part pv.409 --fstype="lvmpv" --ondisk=sda --size=67600 --encrypted
part /boot --fstype="ext4" --ondisk=sda --size=1024
part /boot/efi --fstype="efi" --ondisk=sda --size=200 --fsoptions="umask=0077,shortname=winnt"
volgroup fedora_musken --pesize=4096 pv.409
logvol /  --fstype="xfs" --grow --size=1024 --name=root --vgname=fedora_musken
logvol swap  --fstype="swap" --size=16384 --name=swap --vgname=fedora_musken

Partition pv.409 consists of one partition on sda. If I wanted, I could have had another partition on sdb, e.g. pv.812, and also used that for LVM.

My volume group fedora_musken uses pv.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.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.