Installation overwrites USB boot stick

Michael Klein m.klein at mvz-labor-lb.de
Thu Sep 28 13:52:57 CEST 2023


We are currently using an USB stick with autodiscover functionality.

Occasionally, the installation (Debian bookworm) goes to the USB stick 
instead of the internal disk.

This is from fai-disk-info:

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
checkdisk() {

     while read major minor blocks device suffix; do
         isdisk=1
         # skip ide cdrom
         [ -f /proc/ide/$device/media ] && grep -q cdrom 
/proc/ide/$device/media && isdisk=0
# old way of detecting disks: [ `cat /sys/block/$device/removable` -eq 1 
] && isdisk=0
         [ `stat -c %G /dev/$device` = "disk" ] || isdisk=0


During the installation, both the USB stick and the internal SSD is 
owned by root:disk, so the USB stick is not skipped here.

As expected, /sys/block/sd*/removable reads '1' for the USB stick and 
'0' for the SSD.

What is the advantage of checking the device group instead of the 
removable flag in /sys here anyway?

/Michael



More information about the linux-fai mailing list