Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have few Linux (RHEL 5.x / Centos 5.x) boxes running on KVMs, on which I used to attach and detach disks on the fly. Now the problem with EL5 versions are, when we add a disk, initially it will be marked as /dev/sdb. When I remove it and re-attach the disk again it is pointing to /dev/sdc instead of /dev/sdb again, if I repeat the process the disks will be /dev/sdd.. /dev/sde.. so on.

I want the disk always to attach to the /dev/sdb. How to I achieve this ?

I googled a lot and it took me no where :(.

Any help on this will be appreciated !

share|improve this question – quanta Jun 6 '12 at 7:50
The Docs in redhat is not helping getting this setup done, I have given a try but it wasn't helping. I am checking the first reply"";, and will update here. Thank you ! Looking forward for more info about this case – Kiranjith Tg Jun 6 '12 at 8:21
up vote 1 down vote accepted

Do you need to refer the disks by device? If you just need to e.g. mount them, you can get away by referring to their partitions by label or even UUID. If that's not what you are after, you may want to look in the udev machinery, that allows you to write your own device naming rules.

Cheers, Alf

share|improve this answer

Use an alternate identifier for the block device instead of /dev/sdb. The two common methods are labels and UUID numbers. Examples for both entries in /etc/fstab are below:

LABEL=restore /restore ext3 defaults,noauto 0 0

UUID=7bbbc4ba-029a-4f5c-95e9-1efc74e55b68 /restore ext3 defaults,noauto 0 0

The command blkid displays the label and/or UUID for all block devices. Hope that helps.

share|improve this answer

If you want to refer to a device as the same name then udev is the answer. It adds a name to a device. So even if the device identity changes the label to refer to the device remains the same. Like for example if /dev/sda is assigned the udev name BOOT then even if sda becomes sdb the name BOOT refers to the same device. I haven't used udev myself. So can't give you the exact udev rule to follow. But google should ample hits to solve it yourself, it should be pretty simple.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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