Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install to disk by ID #30

Closed
briancolecoinmetrics opened this issue Sep 21, 2020 · 5 comments
Closed

Install to disk by ID #30

briancolecoinmetrics opened this issue Sep 21, 2020 · 5 comments

Comments

@briancolecoinmetrics
Copy link

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, #14 (comment) 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?

@asciiprod
Copy link
Collaborator

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

@briancolecoinmetrics
Copy link
Author

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.

@ableischwitz
Copy link

ableischwitz commented Aug 18, 2022

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,

@func0der
Copy link

For me the experience was that everything worked out fine, BUT the software raid. @ableischwitz PRs seemed to have the fix in the place that was broken for me.

mkswap is failing for me, but I do not know why:

[22:30:32] :   mkswap: cannot open /dev/disk/by-id/ata-SAMSUNG_XXXX-part1: Device or resource busy

I think it might be the software raid sync blocking the formatting, which is kinda weird.
The order should be create partitions -> create raid, shouldn't it?

I copied the whole installimage into my home folder in the rescue system to apply the patch from @ableischwitz . Maybe that confuses the script somehow 🤷

@func0der
Copy link

func0der commented Nov 14, 2023

Found the error. The script could not replace the fstab entries and therefore tried to format the underlying drive instead of the raid arrays.

#92 should hit all the right points.

I copied the whole installimage into my home folder in the rescue system to apply the patch from @ableischwitz . Maybe that confuses the script somehow 🤷

About this. It does not. Just be sure to call installimage with an absolute path. Else it WILL get confused, because the script will switch into a temporary directory for most of its work. :)

landorg pushed a commit to Onlim/installimage that referenced this issue Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants