Este script faria o truque, pelo menos para a maioria dos cenários típicos. Requer em blkid
, lsscsi
e sed
:
#!/bin/bash
mkdir -p /dev/disk/by-{path,uuid}
for dev in 'blkid -o device | grep -v block'; do
ln -s "$dev" "/dev/disk/by-uuid/$(blkid -o value -s UUID "$dev")"
done
lsscsi -v | sed 'N;s/\n//' |\
sed 's/.*\(\/dev\/\w\+\).*\(pci\)[0-9]\{4\}[^/]\+\/[^/]\+\/\([0-9:.]\+\)[^ ]*\/\([0-9:]\+\)[]].*/ --scsi-/' |\
sed 's/.*\(\/dev\/\w\+\).*\(pci\)[^/]*\/\([0-9:.]\+\)\/ata[^ ]*\/\([0-9:]\+\)[]].*/ --ata-/' |\
while read dev pci; do
pp="/dev/disk/by-path/$pci"
ln -s "$dev" "$pp"
for part in "${dev}"[0-9]*; do
[ -e "$part" ] && ln -s "$part $pp-part${part/$dev/}"
done
done