CentOS 7 Re-Image Using Kickstart, Keeping Existing Partitions and LogVols

General support questions
Post Reply
CaveDann
Posts: 23
Joined: 2018/12/14 15:05:27
Location: UK

CentOS 7 Re-Image Using Kickstart, Keeping Existing Partitions and LogVols

Post by CaveDann » 2020/01/09 08:52:29

Hey Everyone,

I've got a CentOS 7 machine which I want to re-image using kickstart, whilst preserving the data on a single logical volume. Here's how the current image's partitions were configured using kickstart.

Code: Select all

# Creating RAID Partitions
part raid.bootdiska --size=1000 --ondisk=sda
part raid.bootdiskb --size=1000 --ondisk=sdb
part raid.preservediska --size=1000 --ondisk=sda
part raid.preservediskb --size=1000 --ondisk=sdb
part raid.diska --size=800000 --ondisk=sda
part raid.diskb --size=800000 --ondisk=sdb

# Creating RAID Devices
raid /boot --fstype=ext4 --level=1 --device=rd0 raid.bootdiska raid.bootdiskb
raid /preserve --fstype=ext4 --level1 --device=rd1 raid.preservediska raid.preservediskb
raid pv.disk --fstype=ext4 --level=1 --device=rd2 raid.diska raid.diskb

# Creating Logical Group and Volumes
volgroup delta --pesize=131072 pv.disk
logvol / --fstype=ext4 --name=root --vgname=delta --size=50000
logvol swap --name=swap --vgname=delta --size=8000
logvol /projects --fstype=ext4 --name=projects --vgname=delta --size=600000
As above, I want to re-image the machine, whilst preserving the data on the logvol /projects . Here's my attempt at doing that.

Code: Select all

# Creating RAID Partitions
## No entries needed as we'll be using the existing RAID Partitions

# Creating RAID Devices
raid /boot --device=rd0 --useexisting
raid /preserve --device=rd1 --noformat
raid pv.disk --device=rd2 --noformat

#Creating Logical Group and Volumes
volgroup delta --noformat
logvol / --fstype=ext4 --name=root --vgname=delta --useexisting
logvol swap --name=swap --vgname=delta --useexisting
logvol /projects --fstype=ext4 --name=projects --vgname=delta --noformat
However, the CentOS 7 Installer GUI fails to interpret this. I see the message "Failed to save storage configuration" over the disk button. Then it prompts me to manually configure the partitions to proceed with the re-image. I'm able to manually issue the commands in the manner I want, except for the root logvol. The only way around it I have found is to manually remove this partition at this screen, and then recreate it to proceed. However, this is a little inconvenient and annoying; I'd rather just tackle the problem within kickstart so I don't have to venture down to the physical machine.

I'm not looking for critique / criticism of kickstart, or alternative solutions beyond kickstart. If anyone can see what I'm doing wrong, or knows that what I'm trying to do with the root logvol is impossible, please could you let me know?

Cheers,
CD

tony_down_under
Posts: 83
Joined: 2019/08/07 01:50:24
Location: Perth, Australia but originally from Carshalton, Surrey

Re: CentOS 7 Re-Image Using Kickstart, Keeping Existing Partitions and LogVols

Post by tony_down_under » 2020/01/10 09:01:19

I have this problem as well. I am forced to "delete old partitions" and set them up again in Anaconda.

Following...

Just an idea, have you tried using the "reformat" option on the existing partitions?

CaveDann
Posts: 23
Joined: 2018/12/14 15:05:27
Location: UK

Re: CentOS 7 Re-Image Using Kickstart, Keeping Existing Partitions and LogVols

Post by CaveDann » 2020/01/10 15:05:14

Hey Tony,

The best I've managed at this point is to manually perform the kickstart instructions in the GUI. So I can select all the partitions I want, reformatting or otherwise, except for the / partition. I have to manually remove the / partition, then create a new one which is identical to the previous, and the installation is able to continue.

I believe I've tracked the problem down though. Doing a 'text mode' install indicates that the installer can't find the raid devices. Indeed, ctrl+alt+F2 shows that none of the raid devices (rd0,rd1,rd2) are present in /dev. I've not figured out how to resolve that, if at all possible, but as above shows I've worked around it.

Cheers,
CD

Post Reply

Return to “CentOS 7 - General Support”