The hard drive under the server has a mechanical hard disk, a solid state drive, and a RAID array, and the kernel assigns the drive letter in the order of/DEV/SDA,/dev/sdb .... During system startup, the kernel assigns the drive letter in the order in which it is scanned to the hard disk (the pass-through, then the array is allocated first). In the same hard disk slot, hot-swappable hard disk, the system will follow the existing drive letter assignment, such as the previous allocation is/DEV/SDB, the last hard drive of the system is/DEV/SDF, then the/dev/sdb/hot plug, the system will reassign the disk letter of the drive is/DEV/SDG, A situation in which the drive letter is garbled.
Assuming that there are 14 hard disk slots on the machine, slot numbers are 0~13, and in the Centos7.3 environment, the R730XD server allocates slots as follows:
/dev/sda |
/dev/sdd |
/dev/sdg |
/dev/sdb |
/dev/sde |
/dev/sdh |
/dev/sdc |
/dev/sdf |
/dev/sdi |
In this case, we should be able to solve the problem of disk character dislocation in the following ways:
[Email protected] ~]# udevadm info-q path-n/DEV/SDA
/devices/pci0000:00/0000:00:10.0/host0/target0:0:0/0:0:0:0/block/sda
Get the number, in the/etc/udev/rules.d/80-mydisk.rules, increase
devpath== "/devices/pci0000:00/0000:00:10.0/host0/target0:0:0/0:0:0:0/block/sda", NAME= "SDA", MODE= "0660"
So the second of the corresponding slots will always correspond to the drive letter SDC without the problem of the jump drive, and we can use a small script to implement all the drive and slot bits:
#!/bin/bash
Disk= "A b c D e F g h i j k l I j k M N"
For i in ${disk};
Do
A= '/usr/sbin/udevadm info-q path-n/dev/sd${i} ';
if [!-n "$a"]; Then
Break 1;
Else
echo devpath== "\" ${a} "\", name= "\" Sd${i} "\", mode= "\" 0660 "\" >>/etc/udev/rules.d/80-mydisk.rules;
Fi
Done
Linux Drive-Letter binding slots