26 lines
900 B
Bash
26 lines
900 B
Bash
|
#!/bin/bash
|
||
|
# run me with a sudo
|
||
|
|
||
|
DISK_TYPE="scsi-3220"
|
||
|
NUMBER_DISK="$(find /dev/disk/by-id -name "${DISK_TYPE}*" | wc -l)"
|
||
|
|
||
|
ZFS_VDEV_FILE="/etc/zfs/vdev_id.conf"
|
||
|
|
||
|
rm -f -- "${ZFS_VDEV_FILE}"
|
||
|
mkdir -p -- "$(dirname "${ZFS_VDEV_FILE}")"
|
||
|
|
||
|
printf "%b" "# Tiroir ${NUMBER_DISK} disques IBM $(hostname)\\n" > "${ZFS_VDEV_FILE}"
|
||
|
printf "%b" "# by-vdev\\n" >> "${ZFS_VDEV_FILE}"
|
||
|
printf "%b" "# name fully qualified or base name of device link\\n\\n" >> "${ZFS_VDEV_FILE}"
|
||
|
|
||
|
# On veut un numéro de disque identique à la référence de l'étiquette du caddie
|
||
|
for disk_scsi_id in $(find /dev/disk/by-id -name "${DISK_TYPE}*" | cut -d"-" -f 3)
|
||
|
do
|
||
|
#printf "%b" "disk_scsi_id = ${disk_scsi_id}\\n";
|
||
|
printf "%b" "alias ${disk_scsi_id} /dev/disk/by-id/scsi-${disk_scsi_id}\\n" >> "${ZFS_VDEV_FILE}"
|
||
|
done
|
||
|
|
||
|
printf "%b" "\\nNow, please check the content of ${ZFS_VDEV_FILE}\\n\\n";
|
||
|
|
||
|
exit 0
|