Re: pvcreate can't open /dev/md1 exclusively

Christopher Huhn <[email protected]> Fri, 24 Jan 2025 19:06:08 +0100
Newsgroups gmane.linux.debian.fai
Organization GSI
Message-ID <[email protected]>
Hi Matthew,

Am 24.01.25 um 18:18 schrieb Matthew Pounsett:
> The server has four drives:  two SSDs that I'm trying to mirror and put 
> volumes on, and two larger HDDs that FAI should be ignoring.   It does 
> seem to be ignoring the two HDDs now, thanks to help in the last thread.
> […]
> $disklist shows up as expected:
> root@srv03:/etc/lvm# echo $disklist
> sda sdb sdc sdd
 > […]
> root@srv03:/tmp/fai# lsblk
> NAME MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
> sda    8:0    0   7.3T  0 disk
> sdb    8:16   0   7.3T  0 disk
> sdc    8:32   0 447.1G  0 disk
> sdd    8:48   0 447.1G  0 disk
as you can see here the large disks are sda (disk1) and sdb (disk2) 
while the SSDs are sdc and sdd.
This mapping is not stable through reboots, so you have to make sure 
your disks are in the intended order in your disklist.

We use a very basic hook to sort our disks by size:

 > # cat class/31-sortdisks.sh
 > disklist=$(grep -H '^[1-9]' /sys/block/[hsv]d[a-z]/size 
/sys/block/nvme*n[0-9]/size | sort -n -t : -k 2 | cut -f4 -d / | xargs)
 > echo "disklist=\"$disklist\"" >> "$LOGDIR/additional.var"

IIRC there were some discussions on this list on how to create a 
reliably sorted disklist but nothing seem to have made it to the example 
FAI config on github.

Best

Christopher
smime.p7s (application/pkcs7-signature, 4.7 KB) - not displayed