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?
/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 09 '17 at 17:35/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 '17 at 18:09