kickstart logical volume on specific disk

Simply Seth asked:

Is it possible, in kickstart, to specify which physical volume a logical volume gets created in?

I have:

clearpart --all --initlabel --drives=sda,sdb,sdc,sdd
part /boot --asprimary --fstype="ext4" --ondisk=sdb --size=515
part pv.001 --asprimary --ondisk=sdb --size=1024 --grow
part pv.002 --asprimary --ondisk=sda --size=10240 --grow
volgroup rootvg pv.001 pv.002
logvol /       --fstype=xfs  --name=rootlv   --vgname=rootvg  --size=10240
logvol swap    --fstype=swap --name=swaplv   --vgname=rootvg  --size=32768
logvol /home   --fstype=xfs  --name=homelv   --vgname=rootvg  -size=10240
logvol /usr    --fstype=xfs  --name=usrlv    --vgname=rootvg  --size=10240
logvol /tmp    --fstype=xfs  --name=tmplv    --vgname=rootvg  --size=2048
logvol /varlv  --fstype=xfs  --name=varlv    --vgname=rootvg  --size=524288

I would like to have rootlv, swaplv and homelv on sdb and the rest on sda.

Is there an option to make this happen?

My answer:

You’re missing a level of indirection.

A logical volume is created in a volume group, which itself is comprised of one or more physical volumes in various possible topologies (not all of which can be constructed in kickstart, but that’s irrelevant here).

To put the LV in a different PV, the VG containing it must be on the desired PV. So, you need to create a second VG, and assign the PV to only that VG. For example:

volgroup rootvg pv.001
volgroup othervg pv.002

Then you can assign LVs to the othervg VG. For example:

logvol /usr    --fstype=xfs  --name=usrlv    --vgname=othervg  --size=10240

You should also reconsider your names. Having “lv” and “vg” in names is redundant and unnecessary. It’s always obvious which is which.

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.