It is said that udev create symbolic links identifying the actual device and /dev/disk/by-uuid is an example.

[root@centos1 by-uuid]# pwd


[root@centos1 by-uuid]# ls -l

total 0 lrwxrwxrwx 1 root root 10 Jun 26 00:59 4cfc879d-1d4e-4289-856c-5f532a74bb2d -> ../../sda

Does the above means that a) /dev/sda is pointing to uuid 4cfc879d-1d4e-4289-856c-5f532a74bb2d


b) uuid 4cfc879d-1d4e-4289-856c-5f532a74bb2d is pointing to /dev/sda ?


If the answer is a, i always thought that link are suppose to be from left to right ? and how will someone reference the uuid to go to /dev/sda ? Also i thought /dev/sda is suppose to be dynamically added by udev and its naming is base on some rules.

If the answer is b, then where is sda pointing to ? It is said that the kernel add devices to the /dev/ folder dynamically and with udev we can persist of the naming of the devices in it.

[root@centos1 dev]# pwd


[root@centos1 dev]# ls -lt sda

brw-rw---- 1 root disk 8, 0 Jun 26 00:59 sda


I tried to find the rules in /etc/udev/rules.d/ but to no avail. I am on CentOS.

I am trying at /lib/udev/rules.d/, but can't see the rules that add sda into /dev/

Please advise.

  • Please see my Edit 2. I think now you have all the info you need. – MariusMatutiae Jun 28 '15 at 7:53

The link is to /dev/sda1. you can establish that with the file command: in my system, for instance,

  # file *
  ff28e743-4409-41b3-99ea-f133cdcc86be: symbolic link to `../../sda1' 

Thus, your option b is right. /dev/sda is not a link, hence it does not point to anything else at all: it is just a special (device) file, see for instance this Wikipedia article.

I do not use CentOS, but in my Debian/Kubuntu systems the disk rules are located in /lib/udev/rules.d, under

   # ls -lh 60-per*
     -rw-r--r-- 1 root root  616 apr 15 22:33 60-persistent-alsa.rules
     -rw-r--r-- 1 root root 2,5K apr 15 22:33 60-persistent-input.rules
     -rw-r--r-- 1 root root  947 apr 15 22:33 60-persistent-serial.rules
     -rw-r--r-- 1 root root  929 mag  4  2012 60-persistent-storage-dm.rules
     -rw-r--r-- 1 root root 5,6K apr 15 22:33 60-persistent-storage.rules
     -rw-r--r-- 1 root root 1,4K apr 15 22:33 60-persistent-storage-tape.rules
     -rw-r--r-- 1 root root  769 apr 15 22:33 60-persistent-v4l.rules

The relevant file, of course, is 60-persistent-storage.rules. If you cannot locate it here in your system, I suggest you try:

    find / -type f -name '*persistent-storage*.rules'


is /sda added in /dev by udev then ?


how do we ensure "sda" will always remain as "sda" ?

We do not. The rule is automatically generated by udev at installation time. In fact, the above-mentioned file contains the following rule:

   # scsi devices
   KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $devnode", ENV{ID_BUS}="scsi"


The simplest thing, given that you cannot make up your mind, is to set up your own rules. Suppose you have a device, called now sdd, but you want to call it sda at next reboot.

First you need to find out some parameters:

   udevadm info -a -p $(udevadm info -q path -n /dev/sdd)

This will spit out a lot of info. Search for lines such as these (yours will be different, of course):


You can now use these paramaters to craft your own rule, to be inserted into /etc/udev/rules.d/10-local.rules:

 ATTRS{idVendor}=="18a5", ATTRS{idProduct}=="0302", ATTRS{serial}=="TT0E4E008XW3DT9H", KERNEL=="sd?", NAME="sda", RUN+="/home/my_name/bin/my_program"

The last part, RUN+="/home/my_name/bin/my_program", is optional: you can use it to run a command, if you wish to, but you may omit it altogether.

  • is /sda added in /dev by udev then ? how do we ensure the disk refererenced to by "sda" will always remain as "sda" ? – Noob Jun 26 '15 at 10:23
  • @Noob Pls see my edit. – MariusMatutiae Jun 26 '15 at 10:44
  • thank you for your clear explanation. I am not really sure of the syntaxes use in the rules - but with the rule that is shown above, does it make sure that "sda" will remain as "sda" then ? could it happen that 1 day, i take out the disk which is assigned "sda" , and plug back it another day and got assigned "sdb" instead ? – Noob Jun 28 '15 at 4:42
  • why can't i @ to MariusMatutiae ? – Noob Jun 28 '15 at 5:18
  • @Noob Because you are replying to my answer, so it comes to me automatically – MariusMatutiae Jun 28 '15 at 5:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.