Linux Hard Drive – How to Detect Drives as Designated Block (e.g., /dev/sde)

filesystemshard drivelinuxssd

If I attach a hard drive to the system, and I want the system to recognize this device as a /dev/sde device rather than the default /dev/sdb. How should I do that?


Best Answer

Actually, there is a way to do this: it involves udev, and it is the simplest possible use of its rules.

Create a file /etc/udev/rules.d/10-local.rules and insert into it this single line:

  KERNEL=="sd?1", NAME="my_hdd1"

This rule simply takes anything which would be called sda1, or sdb1, or sdc1,... and renames it to a name of your choice, in this case `my_hdd1'. The device node will appear at


If you wish you can do this with devices, not with partitions, whichever you like best:

  KERNEL=="sd?", NAME="my_hdd"

The above rules will be applied to the first disk to be discovered, which is normally the root disk, /dev/sda. If you prefer to continue calling this disk /dev/sda, but you wish to apply this rule to all other disks, then these rules become:

   KERNEL=="sd[b-z]", NAME="my_hdd"
   KERNEL=="sd[b-z]1", NAME="my_hdd1"

again as per your wishes.

Restart udev, or reboot, and that's it.

Related Question