Re: Making sure to partition the right disk(s)

2024-02-23 Diskussionsfäden Diego Zuccato
Just found another issue: if the MY-DATA partition is on the target 
disk, reinstall errors out at partitioning because it finds that 
partition in use. Error happens even if the partition is correctly 
flagged preserve_lazy :(


Enough tampering for today.
BYtE,
Diego


Il 19/01/2024 15:44, Thomas Lange ha scritto:

On Fri, 19 Jan 2024 15:33:02 +0100, Diego Zuccato  said:


 > But it seems it doesn't get mounted (at least a custom script did not
 > find it mounted). I don't know FAI internals enough :(
This mounting of a partition labeled MY-DATA will only work from FAI
6.2, which is not yet released.



--
Diego Zuccato
DIFA - Dip. di Fisica e Astronomia
Servizi Informatici
Alma Mater Studiorum - Università di Bologna
V.le Berti-Pichat 6/2 - 40127 Bologna - Italy
tel.: +39 051 20 95786


Re: Making sure to partition the right disk(s)

2024-01-19 Diskussionsfäden Thomas Lange
> On Fri, 19 Jan 2024 15:33:02 +0100, Diego Zuccato 
>  said:

> But it seems it doesn't get mounted (at least a custom script did not 
> find it mounted). I don't know FAI internals enough :(
This mounting of a partition labeled MY-DATA will only work from FAI
6.2, which is not yet released.

-- 
regards Thomas


Re: Making sure to partition the right disk(s)

2024-01-19 Diskussionsfäden Diego Zuccato

Tks a lot. Really interesting & useful.
I prefer to keep per-host configs in their own subdir (like 
94-disklist-order.d/testserver1 so I don't have to touch a working 
script, but that's mostly "cosmetic".


Diego

Il 19/01/2024 13:29, Andrew Ruthven ha scritto:

On Sat, 2024-01-20 at 01:27 +1300, Andrew Ruthven wrote:

On Fri, 2024-01-19 at 09:48 +0100, Thomas Lange wrote:



I use this script to manipulate the disklist:
http://fai-project.org/download/misc/99-disklist.sh


Attached is the script which I wrote to do this. It goes in the class
directory.

Some of our servers have NVMe drives that should be used for operating
system disks, which is why they can be skipped.


Although I see a stale comment in there now about the NVMe disks. Ah well.




--
Diego Zuccato
DIFA - Dip. di Fisica e Astronomia
Servizi Informatici
Alma Mater Studiorum - Università di Bologna
V.le Berti-Pichat 6/2 - 40127 Bologna - Italy
tel.: +39 051 20 95786


Re: Making sure to partition the right disk(s)

2024-01-19 Diskussionsfäden Diego Zuccato

Il 19/01/2024 10:12, Thomas Lange ha scritto:


It may also work if you do a reinstallation via network and the kernel
will find a partition with label MY-DATA. I guess this should also
work.

Seems it does not work with network boot and default config.

I added:
logical -   120M:preserve_lazy ext4  noauto 
createopts="-L MY-DATA"
to disk_config and (after zapping clean the disk) it got created [*]. 
But it seems it doesn't get mounted (at least a custom script did not 
find it mounted). I don't know FAI internals enough :(

Not a big issue, since it can be replaced by a few lines in a script:
#!/bin/bash
datadisk=/dev/disk/by-label/MY-DATA

if [ -e $datadisk ]; then
mkdir -p /media/data
mount $datadisk /media/data
src=/media/data/$(hostname -s)
if [ -d $src ]; then
cp -r $src/ $target/
fi
fi


[*] Currently wrestling with "preserved partition /dev/sda7 does not end 
at a cylinder boundary, parted may fail to restore the partition" 
messages in error.log... "disk_config" line have "align-at:1M", isn't it 
enough?


--
Diego Zuccato
DIFA - Dip. di Fisica e Astronomia
Servizi Informatici
Alma Mater Studiorum - Università di Bologna
V.le Berti-Pichat 6/2 - 40127 Bologna - Italy
tel.: +39 051 20 95786


Re: Making sure to partition the right disk(s)

2024-01-19 Diskussionsfäden Andrew Ruthven
On Sat, 2024-01-20 at 01:27 +1300, Andrew Ruthven wrote:
> On Fri, 2024-01-19 at 09:48 +0100, Thomas Lange wrote:
> 
> 
> > I use this script to manipulate the disklist:
> > http://fai-project.org/download/misc/99-disklist.sh
> 
> Attached is the script which I wrote to do this. It goes in the class
> directory.
> 
> Some of our servers have NVMe drives that should be used for operating
> system disks, which is why they can be skipped.

Although I see a stale comment in there now about the NVMe disks. Ah well.


-- 
Andrew Ruthven, Wellington, New Zealand
and...@etc.gen.nz |
Catalyst Cloud:   | This space intentionally left blank
 https://catalystcloud.nz |



Re: Making sure to partition the right disk(s)

2024-01-19 Diskussionsfäden Andrew Ruthven
On Fri, 2024-01-19 at 09:48 +0100, Thomas Lange wrote:


> I use this script to manipulate the disklist:
> http://fai-project.org/download/misc/99-disklist.sh

Attached is the script which I wrote to do this. It goes in the class
directory.

Some of our servers have NVMe drives that should be used for operating
system disks, which is why they can be skipped.

> In the next FAI version 6.2 (the release may come in the next few
> days) there are more functions to change the order of the disks, like
> smallestdisk or matchdisks which can match to a certain serial number.

Nice!

Cheers,
Andrew

-- 
Andrew Ruthven, Wellington, New Zealand
and...@etc.gen.nz |
Catalyst Cloud:   | This space intentionally left blank
 https://catalystcloud.nz |



94-disklist-order
Description: application/shellscript


Re: Making sure to partition the right disk(s)

2024-01-19 Diskussionsfäden Henning Glawe
Moin,

On Fri, Jan 19, 2024 at 09:34:49AM +0100, Henning Glawe wrote:
> On Fri, Jan 19, 2024 at 09:03:57AM +0100, Diego Zuccato wrote:
> > It's not too unusual that sometimes disks get recognized in a different
> > order across reboots.
> > How can I make sure I'm repartitioning the right disk and not another
> > one containing data? I can't find any way to bind some info about HDD to
> > "disk1" instead of "disk2".
> > 
> > If it's not currently supported, it shouldn't be too hard to add to
> > 20-hwdetect.sh (I can do it and share the result, if someone is
> > interested). But if it's already supported, better to use the official
> > method. :)
> 
> you can put the /dev/disk/by-id/$disk_id directly into your disk_config.
> 
> where $disk_id could be the WWN, serial number or other identifiers
> generated by kernel+udev on your hardware.

Example:

 $FAI/disk_config/mpsd-srv-ibm-001 
# set boot flag on /boot/efi
disk_config /dev/disk/by-id/wwn-0x600605b002b15b50203efd9326bb4cf7 
disklabel:gpt fstabkey:uuid bootable:2

# boot-related
#   first GPT partition: bios_grub, flag set in $FAI/scripts/BOOT_GRUB/10-setup
primary -  16M --
primary /boot/efi 128M vfat rw  createopts="-F32"
primary /boot 512M xfs  rw,noatime
# system partitions
primary swap   16G swap sw
primary / 100G xfs  rw,noatime
primary /var   0-  xfs  rw,noatime
---

-- 
Mit freundlichen Grüßen
Henning Glawe

Dr. Henning Glawe
Max-Planck-Institut für Struktur und Dynamik der Materie
Geb. 99 (CFEL), Luruper Chaussee 149, 22761 Hamburg, Germany
http://www.mpsd.mpg.de/, Email: henning.gl...@mpsd.mpg.de
Building/Room: 99/O2.100, Phone: +49-40-8998-88392


Re: Making sure to partition the right disk(s)

2024-01-19 Diskussionsfäden Thomas Lange
> On Fri, 19 Jan 2024 10:03:50 +0100, Diego Zuccato 
>  said:

> PS: looking at the source, I noticed that a partition labeled "MY-DATA" 
> is automatically mounted to /media/data . Does it work only for boots 
> from CD or also from network? It could be useful to store machine's 
> static data (SSH server key, just to say one)...
It only works for boots from an ISO that is uses as an USB stick.
This is for a initial installation, if all disks are empty.

It may also work if you do a reinstallation via network and the kernel
will find a partition with label MY-DATA. I guess this should also
work.

-- 
regards Thomas


Re: Making sure to partition the right disk(s)

2024-01-19 Diskussionsfäden Diego Zuccato

Wonderful!
I'll wait for 6.2 to be out, then.
For now, the use of explicit device path can be enough, but being able 
to tell it to "select the 2 small disks and create a RAID1" is surely 
way better (and handles disk replacement w/o reconfiguration).


PS: looking at the source, I noticed that a partition labeled "MY-DATA" 
is automatically mounted to /media/data . Does it work only for boots 
from CD or also from network? It could be useful to store machine's 
static data (SSH server key, just to say one)...


Diego

Il 19/01/2024 09:48, Thomas Lange ha scritto:

On Fri, 19 Jan 2024 09:03:57 +0100, Diego Zuccato  said:


 > Hello all.
 > It's not too unusual that sometimes disks get recognized in a different
 > order across reboots.
 > How can I make sure I'm repartitioning the right disk and not another
 > one containing data? I can't find any way to bind some info about HDD to
 > "disk1" instead of "disk2".
I use this script to manipulate the disklist:
http://fai-project.org/download/misc/99-disklist.sh

In the next FAI version 6.2 (the release may come in the next few
days) there are more functions to change the order of the disks, like
smallestdisk or matchdisks which can match to a certain serial number.



--
Diego Zuccato
DIFA - Dip. di Fisica e Astronomia
Servizi Informatici
Alma Mater Studiorum - Università di Bologna
V.le Berti-Pichat 6/2 - 40127 Bologna - Italy
tel.: +39 051 20 95786


Re: Making sure to partition the right disk(s)

2024-01-19 Diskussionsfäden Thomas Lange
> On Fri, 19 Jan 2024 09:03:57 +0100, Diego Zuccato 
>  said:

> Hello all.
> It's not too unusual that sometimes disks get recognized in a different 
> order across reboots.
> How can I make sure I'm repartitioning the right disk and not another 
> one containing data? I can't find any way to bind some info about HDD to 
> "disk1" instead of "disk2".
I use this script to manipulate the disklist:
http://fai-project.org/download/misc/99-disklist.sh

In the next FAI version 6.2 (the release may come in the next few
days) there are more functions to change the order of the disks, like
smallestdisk or matchdisks which can match to a certain serial number.

-- 
regards Thomas


Re: Making sure to partition the right disk(s)

2024-01-19 Diskussionsfäden Henning Glawe
Moin,

On Fri, Jan 19, 2024 at 09:03:57AM +0100, Diego Zuccato wrote:
> It's not too unusual that sometimes disks get recognized in a different
> order across reboots.
> How can I make sure I'm repartitioning the right disk and not another
> one containing data? I can't find any way to bind some info about HDD to
> "disk1" instead of "disk2".
> 
> If it's not currently supported, it shouldn't be too hard to add to
> 20-hwdetect.sh (I can do it and share the result, if someone is
> interested). But if it's already supported, better to use the official
> method. :)

you can put the /dev/disk/by-id/$disk_id directly into your disk_config.

where $disk_id could be the WWN, serial number or other identifiers
generated by kernel+udev on your hardware.

I have a mechanism in place that aborts installations without this
setup when more than 1 disk is visible, therefore:
- I only have to provide explicit disk configs for storage servers
- but all the boring HPC nodes and simple servers take the generic
  partitioning classes


-- 
Mit freundlichen Grüßen
Henning Glawe

Dr. Henning Glawe
Max-Planck-Institut für Struktur und Dynamik der Materie
Geb. 99 (CFEL), Luruper Chaussee 149, 22761 Hamburg, Germany
http://www.mpsd.mpg.de/, Email: henning.gl...@mpsd.mpg.de
Building/Room: 99/O2.100, Phone: +49-40-8998-88392


Re: Making sure to partition the right disk(s)

2024-01-19 Diskussionsfäden Carsten Aulbert

Hi

On 1/19/24 09:03, Diego Zuccato wrote:
How can I make sure I'm repartitioning the right disk and not another 
one containing data? I can't find any way to bind some info about HDD to 
"disk1" instead of "disk2".


If it's not currently supported, it shouldn't be too hard to add to 
20-hwdetect.sh (I can do it and share the result, if someone is 
interested). But if it's already supported, better to use the official 
method. :)


I'd also be interested in an "official" solution, we help ourselves with 
a script which parses `lsblk` and tries to make the list stable. But as 
is it stateless (kind of by necessity), it may or may not be 100% stable 
after all.


Cheers

Carsten

PS: On that note, @MrFai is a ZFS extension for setup-storage planned?

--
Dr. Carsten Aulbert, Max Planck Institute for Gravitational Physics,
Callinstraße 38, 30167 Hannover, Germany, Phone +49 511 762 17185


smime.p7s
Description: S/MIME Cryptographic Signature