Ok I guessing this is a udev
issue (most Linux distros use this by default), this is what creates the symlinks. You can fix this by add a new rule. I will give some info on this, but it is largely anchored in my own distro - Debian.
First off, you need to find where your rules are. Debian has them in two locations - /lib/udev/rules.d
and /etc/udev/rules.d
. If this is the case for you should only add/change the ones under /etc
as changing another location is more likely to lead to being overwritten by an update.
Go to the rules directory and see if you can find the file(s) with the rules for creating the links under disk/by-id
. The command grep -r disk/by-id/
is going to help here (though only run it in the rules directory to avoid searching other places). For me the file is /var/lib/rules.d/60-persistent-storage.rules
. Here are the lines that are creating the``disk/by-id/usb-*` links for me:
ENV{DEVTYPE}=="disk", ENV{ID_BUS}=="?*", ENV{ID_SERIAL}=="?*", \
SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
ENV{DEVTYPE}=="partition", ENV{ID_BUS}=="?*", ENV{ID_SERIAL}=="?*", \
SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"
There are two possibilities here (apart from the one where your system doesn't use udev
at all):
- You have no line similar to this and you need to create one.
- You do, but it just doesn't work for you disk.
The lines might look like gibberish, but basically the first two (really one as the \
is just a way of splitting long line) are for links relating to the disk itself, the other two are for its partitions.
Hopefully running this command should make things less confusing:
udevadm info --name=/dev/sdb --query=property
This shows the names/values of all the properties of your device. Basically all the rule does is go through all the properties of each device and matches them against the first part of the line (eg the first looks for devices with DEVTYPE=disk
, and non-empty ID_BUS
and ID_SERIAL
). The next part creates a symlink with its name containing ID_BUS
and ID_SERIAL
.
Anyway, what this boils down to is if you have ID_BUS=usb
, you can probably go ahead and add the above rule. If not, you probably need to add specific rules for your device. Something like:
ENV{ID_SERIAL}=="SAMSUNG_HM321HX_C5733G82AB0BPW", \
SYMLINK+="disk/by-id/usb-$env{ID_SERIAL}"
ENV{ID_SERIAL}=="SAMSUNG_HM321HX_C5733G82AB0BPW", \
SYMLINK+="disk/by-id/usb-$env{ID_SERIAL}-part%n"
I have guessed your ID_SERIAL
from the question, if its wrong go ahead and put in the right one.
The rules are probably best in a file of their own, something like s2-samsung-usb.rules
in the directory you found at the start.
Update: the below probably isn't necessary, just unplug and the plug the device in again - How to reload udev rules without reboot?
Once you are done, you can reload the rules with (unplug your device first):
udevadm control --reload-rules
Then plug in your device again. If this doesn't work, you can always try rebooting (in fact this may be safer anyway).
udev
, so my answer should put you on the right track. – Graeme Mar 07 '14 at 00:07