installimage icon indicating copy to clipboard operation
installimage copied to clipboard

Install to disk by ID

Open briancolecoinmetrics opened this issue 4 years ago • 5 comments

We are trying to install servers with 1 OS drive and several data drives. Installing with ex. -d sda is unreliable, both because the disk which installimage sees as sda is random and because it then installs a system where fstab refers to partitions as /dev/sda[123]. In what appears to be a similar case, https://github.com/hetzneronline/installimage/issues/14#issuecomment-531679014 says that "installimage will always use UUIDs for that reason. If UUIDs are also used to reference the second disk, the order should not be an issue", but attempting to actually use ex. -d wwn-0x500a075419ae8a61 results in an error, and when using -d sdX installimage is not converting to UUIDs or anything else stable when writing fstab, which results in sometimes-broken systems. What is the correct way to handle this, short of manually correcting the installed fstab from rescue system?

briancolecoinmetrics avatar Sep 21 '20 18:09 briancolecoinmetrics

The kernel does not guarantee the order in which devices are detected. Hence even if you manage to get this working the way you want it, the next kernel upgrade or even after a reboot, the order might change again. The proper way to deal with this scenario is to also install the bootloader also the data drives. This can be done via a post-install skript, e.g

#!/bin/bash
for i in sdb sdc sdd; do
  sgdisk -Z /dev/$i
  sgdisk --new 1:2048:+1M -t 1:EF02 /dev/$i
  grub-install /dev/$i
done

This will create a 1M bios_grub partition on each drive and installs grub in the MBR and the partition

asciiprod avatar Oct 27 '20 15:10 asciiprod

I'm aware that the kernel adds devices in a nondeterministic order; that's why I'm asking for a way to use WWNs. Installing a bootloader on every disk won't help when installimage gives us a system fstab that refers to devices by their non-deterministic names, e.g. /dev/sdb2 none swap sw 0 0.

briancolecoinmetrics avatar Oct 27 '20 17:10 briancolecoinmetrics

I added a pull request: #56 which should provide support for either /dev/disk/by-id/<id> or /dev/disk/by-id/wwn-<xx>. Without this addition, a automated installation by using the autoconfig feature is a gamble when intending to make use of two out of 3 disk - as the names may change between different reboots. It only handles the device names used for software raid though - so there is no improvement when using plain disks,

ableischwitz avatar Aug 18 '22 06:08 ableischwitz