Sunday, November 30, 2008

Kickstart and LVM

There are no examples of reusing an LVM partition after a kickstart. So here we go. Two scenarios: In the first we keep a partition, but blow away the LVM. In the second, we retain one or more of the LVs.

Scenario 1:
# fdisk -l /dev/sda
--- output truncated ---
  Device       Start       End       Blocks   Id   System
/dev/sda1         1        13      104391   83   Linux
/dev/sda2       14      1033   8193150   8e   Linux LVM
/dev/sda3    1034     1670    5116702   83   Linux
We want to keep /dev/sda3, so we can't do a clearpart --all.
The kickstart code:
clearpart --none
part /boot --onpart /dev/sda1 --fstype ext3
part pv.16 --onpart /dev/sda2
volgroup vg0 pv.16 --pesize=32768
logvol swap --fstype swap --name=swap --vgname=vg0
logvol / --fstype ext3 --name=root --vgname=vg0
logvol /var --fstype ext3 --name=var --vgname=vg0
logvol /tmp --fstype ext3 --name=tmp --vgname=vg0
Take note of the --onpart statements. Since all the listed items include --fstype, they are all formatted. Since /dev/sda3 was not formatted, we need to have /etc/fstab mount it at boot time. In the post add:
echo "/dev/sda3   /home   ext3   defaults   0 0" >> /etc/fstab

No comments:

Post a Comment