((Version info: I am using foreman 2.0, katello 3.15, CentOS 7))
sda vs. vda
Situation: Default kickstart templates for Centos/RHEL by default want to install to /dev/sda.
But when installing virtual machines in a libvirt (qemu/KVM) hypervisor, my default disk type is virtio, and those disks are inside presented as /dev/vda.
Kickstart will then fail with a message like “not enough space available”, and one has to look several lines back to notice that the problem is that it can’t find “sda” at all.
(This problem is not foreman/katello specific, but I describe how I configure foreman to handle it).
Since the majority of things I am installing, will be VMs, I modified the default to be vda:
Hosts => Partition tables => “Kickstart custom” => right side, “Clone”, to make a new (modifiable one) as “Kickstart custom clemens”. In the code snippet, around line 13, changed
dev = host_param(‘part_device’) || ‘sda’
to
dev = host_param(‘part_device’) || ‘vda’
.
For the few hosts where I would want to use sda, I create a host specific parameter.
Hosts => Create host => after you have filled “Host” and “Operating system” and “Interfaces”, under Parameters create a “Host Parameter”
Name: part_device
Type: String
Value: sda
Actually for my physical host I don’t use exactly that, because for them I need to do a special trick, because… read on.
More than one disk device - which to use?
My playground hypervisors have two LSI Raid devices, one faster RAID1 136 GB and another RAID5 a bit slower 600 GB or 1.2 TB. Naturally I want to install the OS to the smaller, faster disk.
But which will appear as sda and which as sdb seems to be random (I have three such servers).
One trick I have seen elsewhere, is that one can use as argument for the disk device (what normally is “sda” also things like /dev/disk/by-uuid/… etc. For example:
[root@fuji3 ~]# ll -d /dev/disk/by-*
drwxr-xr-x 2 root root 480 May 21 10:31 /dev/disk/by-id
drwxr-xr-x 2 root root 80 May 21 10:31 /dev/disk/by-label
drwxr-xr-x 2 root root 80 May 21 10:31 /dev/disk/by-partuuid
drwxr-xr-x 2 root root 200 May 21 10:31 /dev/disk/by-path
drwxr-xr-x 2 root root 100 May 21 10:31 /dev/disk/by-uuid
[root@fuji3 ~]# ll -d /dev/disk/by-path
drwxr-xr-x 2 root root 200 May 21 10:31 /dev/disk/by-path
[root@fuji3 ~]# ll /dev/disk/by-path
total 0
lrwxrwxrwx 1 root root 9 May 21 10:31 pci-0000:00:1f.5-ata-2.0 -> ../../sr0
lrwxrwxrwx 1 root root 9 May 21 10:31 pci-0000:02:00.0-scsi-0:1:0:0 -> ../../sdb
lrwxrwxrwx 1 root root 10 May 21 10:31 pci-0000:02:00.0-scsi-0:1:0:0-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 May 21 10:31 pci-0000:02:00.0-scsi-0:1:0:0-part2 -> ../../sdb2
lrwxrwxrwx 1 root root 10 May 21 10:31 pci-0000:02:00.0-scsi-0:1:0:0-part3 -> ../../sdb3
lrwxrwxrwx 1 root root 9 May 21 10:31 pci-0000:02:00.0-scsi-0:1:2:0 -> ../../sda
lrwxrwxrwx 1 root root 10 May 26 18:55 pci-0000:02:00.0-scsi-0:1:2:0-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 May 26 18:55 pci-0000:02:00.0-scsi-0:1:2:0-part2 -> ../../sda2
[root@fuji3 ~]#
[root@fuji3 ~]# lsblk /dev/sda
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 557G 0 disk
├─sda1 8:1 0 300G 0 part
│ └─data-data 253:1 0 300G 0 lvm /data
└─sda2 8:2 0 256.9G 0 part
[root@fuji3 ~]# lsblk /dev/sdb
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb 8:16 0 136G 0 disk
├─sdb1 8:17 0 500M 0 part /boot
├─sdb2 8:18 0 35G 0 part
│ └─fuji3-root 253:0 0 25G 0 lvm /
└─sdb3 8:19 0 100.5G 0 part
[root@fuji3 ~]#
So in this case sdb is the smaller disk, thus:
lrwxrwxrwx 1 root root 9 May 21 10:31 pci-0000:02:00.0-scsi-0:1:0:0 -> ../../sdb
and I can specify it in kickstart, i.e. in foreman/katello as Host parameter:
Name: part_device
Type: string
Value: /dev/disk/by-path/pci-0000:02:00.0-scsi-0:1:0:0
And indeed this way, installing that bare metal with PXE and kickstart, it did nicely install my OS to the small disk.