大网数据广告活动
服务器运维问答

CentOS/RHEL 7 LVM Partitioning in Kickstart?

· 52CE 我爱测

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…

问题原文

原帖链接 · Alex Mikhaelson · CC BY-SA 3.0

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

已采纳解答

原帖链接 · Michael Hampton · CC BY-SA 3.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-01-13)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。