Example of why this might be desired: I connect a block device, which shows up as /dev/sdb, and mount it. Later that device gets removed without being unmounted. The block device is reconnected, but this time given the name /dev/sdc. I unmount /dev/sdb but then want to switch /dev/sdc to be /dev/sdb.
How can I do this from the command line on OpenSUSE 13.1, without using persistent names?
The purpose of the question is for fixing a problematic state, such as the example given, not as a workaround for deliberately doing something incorrectly (such as not unmounting). This is also why persistent names would not be a solution.
sdX
names are assigned by the kernel as soon as the device is detected. Creating an alias forsd<something>
under<some-persistent-name>
is easy and clean. Trying to renamesd<something>
tosd<something-else>
on the other hand is problematic. What if the device name you want to rename to is already taken? Do you shuffle names around until they fit? And even if you succeed then the kernel and the/dev
filesystem will have a different idea of what the name is, which can be confusing when consulting kernel logs./dev/sdc
to/dev/sdb
" and "rename device from/dev/sdc
to/dev/sdb
". Also, remember the underlying reason why the kernel chosesdc
in the first place instead ofsdb
. It's becausesda
andsdb
were already taken at the time!