We're upgrading from RHEL6 --> CentOS 7. The host in question has the OS on /dev/sda, and has some supplementary data drives at /dev/sdb and /dev/sdc. When I run the kickstart installation, I obviously want the content of /dev/sda (old OS) to be overwritten with the new OS.

If it's /dev/sda now, I'm betting it will be /dev/sda in the kickstart environment. But I seem to recall reading somewhere that this is not a 100% guarantee that should be trusted.

It would be a tragedy of epic proportions if the contents of what is currently known as /dev/sdb or /dev/sdc were, in the kickstart environment, determined to be /dev/sda and overwritten with the OS.

Any suggestions on how I can guarantee that the kickstart installs the OS on a specific drive?

My best guess is to, in the kickstart file, check to make sure that /dev/sda contains the LVM entities that we expect such as "lv_root" for our root logical volume. If /dev/sda contains lv_root, assume that indeed the proper drive has been assigned /dev/sda and proceed on.


In the kickstart file you're looking for:

ignoredisk --only-use=sda

This will cause every disk except sda to be ignored by the install.

The sd letter should remain the same (since it's based off of which SATA port is used). However it's worth noting that removable media can offset the sd letters if it's used prior to the hard drive and is normally identified as use sd* (e.g. if you're installing from a USB drive).

If you also don't specify autopart or part sections in your kickstart the install will pause before it wipes your drive (to ask how you want to partition. Any other prompts in your kickstart/install will also prevent the disk from being wiped right away). Here you can switch to TTY2 using CTRL + ALT + F2 before the install starts and try mounting the drive.

On TTY2 you'll have a free root terminal, so you can make a directory, mount sda# to it, and browse around to ensure those are the files.

After you can go back to TTY1 and resume the install if the disk is correct.

The RHEL documentation on kickstarts is golden for this kind of stuff.

  • EDIT: I just made a comment asking how the "sd" letter is assigned, and I just realized you actually answered that already! So it IS based on SATA port. That was the bulk of my question, but the ignoredisk option is great to know, as well. Thank you for this. I'll mark it as the answer. Nov 8 '16 at 16:29
  • 1
    The sd letter won't necessarily remain the same. "Device names in the sdX (or /dev/sdX) format are not guaranteed to be consistent across reboots" link. The sd letter is based on controller and port - two controllers (e.g. a RAID controller and a SATA controller) will race against each other, and whichever finishes device enumeration first will get sda.
    – bain
    Jan 17 '19 at 12:55

I think you could script it so that you use the disk uuid instead of block device label. For example: part / --fstype=ext4 --onpart=/dev/disk/by-id/ata-ST3160815AS_6RA0C882. At least that would guarantee consistency across reboots.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.