# Making sure /dev/sda always refers to the same device

## optilude

Hello,

I've got a laptop and lots of USB gadgets, so connections sometimes vary. My problem is that I've got a USB SD card reader; normally this takes /dev/sda (via the usb-storage module, which performs SCSI emulation) since it's permanently connected, and my Creative Labs MuVo NX takes /dev/sdb when I occasionally plug it in. I've set up /etc/fstab to use these device names, too. 

However, when I'm not at home, the card reader that's normally /dev/sda is not used; now, when I plug in my MuVo, things get b0rked, because it takes /dev/sda (makes sense since it's the first device to be plugged in). How on earth do I tell it to stick to /dev/sda? I could imagine ways to be very clever with symlinks in /dev and hotplug, but surely this problem must've been solved before?

Martin

----------

## blueworm

The most sensible thing to do is permanently but the muvo on /dev/sda since it is used home and away.

Is there any compelling reason that the card reader must be /dev/sda?

----------

## optilude

Well, first off, that's not really a solution, because if I ever wanted to leave the MuVo at home, and then take the card reader with me, I'd have the same problem again. 

Second, I don't think it's actually possible: The MuVo is only ever connected to the computer when I need to transfer songs to it; the card reader is connected to my 7 port hub when I'm at home. Hence, when I boot, this is found first, so it becomes /dev/sda. If I then put in the MuVo to transfer some songs later, it comes /dev/sdb. If there is some way to force the MuVo to stay on /dev/sda, and get the card reader to be /dev/sdb regardless, then that's the same as my original question, so I don't know how.

Is there some way to get devfsd to do this? Would udev fix it (I have no idea how udev works)? The simplest solution would be to have a symlink to "/dev/muvo" and "/dev/sdreader", for example, and have these set up automagically. I think I can make hotplug to do that, maybe even write a general set of scripts (and probably integrate them with hprofile). Would others be interested in that?

But I refuse to believe no simple solution has been found/created before - it seems like such a common problem!

Martin

----------

## blueworm

Merry Christmas...

This is probably of not much help, but I would do this.

In my /etc/fstab

```
/dev/sda1   /mnt/aux1   vfat    noauto   0 0

/dev/sdb1   /mnt/aux2   vfat    noauto   0 0
```

You will have to mount manually.

```
mount /mnt/aux1
```

----------

## optilude

No, that doesn't help.  :Smile: 

I need the mount directories to correspond to the devices, otherwise things get messy, and I can't rely on them.

I've almost worked out how to do it with 2.6 hotplugging; I get a message when I plug a device in, and I know how to get to it from /sys/devices and /proc/bus/usb, which lets me check where it's connected and what device it is. However, I can't work out which device it's assigned in /dev - whether it gets /dev/sda or /dev/sdb. If I could work that out, I could make a symlink in /dev and make sure it points to the right device.

----------

## really

see this https://forums.gentoo.org/viewtopic.php?t=118474&highlight=muvo+mount+storage

----------

