I have usb disk attached to my linux box (Ubuntu 14.04). When I boot up the PC, the disk is automatically bound to /dev/sdb (and the partition to /dev/sdb1).

When I put PC to sleep for some time with rtcwakup command:

 rtcwake -m standby -s 120

after the computer is woken up, my disk gets rebound to /dev/sdc (and partition do /dev/sdc1)... and after another rtcwake to /dev/sdd. Device mapping isn't always changed, but usually it is the case.

I tried to follow sugestion in this thread: How to bind USB device under a static name?

but it does not seems to work for me. My assumption is that the problem might be with that this is block device and in aforementioned example this is not the case..but that's just a guess.

Could you give me a clue how to bind an usb disk to the same device each time computer is woke up?

  • Have you tried to use one of the many /dev/disk/by-* alternatives instead of /dev/sdb, e.g. /dev/disk/by-id? Never rely on /dev/sd* staying constant accross boots/wakeups, that's why these alternatives exist.
    – dirkt
    Jan 9, 2017 at 17:35
  • @dirkt: thans for that info. I was not aware about /dev/disk/by mappings. So far it looks promissing. I'll comment again after more tests.
    – walkeros
    Jan 13, 2017 at 18:36
  • @dirkt: Your solution works, but I need to unmount the disk before pc goes to sleep and mount again after it wakes up. This is because the /dev/disk/by-id is a link. Mounting the device by link still mounts /dev/sd*. Threfore after wake up the mount point is invalid because it really pointed to /dev/sdX which changes after wakup. However remounting the disk using disk/by-id works because the link is updated after wakeup. If you wish please post the answer as in your comment, I'll edit it with my findings and accept.
    – walkeros
    Jan 21, 2017 at 18:09

1 Answer 1


One should never rely on /dev/sd* to be consistent accross reboots, hibernation etc. The letters are assigned in whatever order the kernel modules or user space software is run, and there's no guarantee with respect to that order.

However, udev already creates various kinds of symlinks in /dev/disk/, which start with by-. These symlinks remain consistent.

Apparently not of all these are updated during a wakeup, but at least the /dev/disk/by-id ones are. Also, the mount is still invalid after wakeup, but remounting these solves the problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .