Last active
August 13, 2021 14:18
-
-
Save JakeDEvans/908d9a75aa5fc24c9eee24f4912af9aa to your computer and use it in GitHub Desktop.
Kickstart config for full disk LVM (no partitions)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Expects 2 vm disks | |
# Disk 1 = 1GB | |
# Disk 2 = DATA (5GB or larger) | |
# Disk Layout | |
clearpart --all --initlabel --drives=sda | |
part biosboot --fstype=biosboot --size=1 --ondisk=sda | |
part /boot --fstype=xfs --size=512 --grow --ondisk=sda | |
logvol swap --fstype=swap --name=swap --vgname=vg01 --size=512 | |
logvol /tmp --fstype xfs --name=tmp --vgname=vg01 --size=1024 | |
logvol / --fstype xfs --name=root --vgname=vg01 --size=2048 --grow | |
%pre | |
pvremove -y -ff /dev/sdb | |
pvcreate /dev/sdb | |
vgcreate vg01 /dev/sdb | |
vgscan | |
%end |
update, this worked for me for rhel8:
#mark the whole disk as pv
partition pv.8 --grow --onpart=sdb
volgroup vg01 --pesize=4096 pv.8
You could also just tell Anaconda about the VG you made, like:
volgroup vg01 --noformat --useexisting
Also, at least from my experience, you don't need to call vgscan
at the end of the %pre section ... but if there's any existing LVM setup, you may need a little more to get it cleaned up. I use something like:
%pre
vgchange -y -ff -a n --select pv_name=/dev/sdb
vgremove -y -ff --select pv_name=/dev/sdb
pvremove -y -ff /dev/sdb
pvcreate /dev/sdb
vgcreate vg01 /dev/sdb
%end
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fyi this doesn't work on rhel8, since device tree is scanned by blivet python module in anaconda before the pre is executed. So even after the vgscan the vg01 is not known to anaconda :-(
If someone has a solution for this in rhel8?