I have a five 4TB usb drives. I want to setup a mount point, /mnt/backups so that when I plug in any of those drives, they get automatically mounted to /mnt/backups.

The problem is that when the drive path changes all the time for the drives even though I put them in the same usb slot. I've seen /dev/sde1 through /dev/sdh1...

OS is Ubuntu.

migrated from serverfault.com Jul 3 '13 at 13:08

This question came from our site for system and network administrators.

  • What version of Ubuntu are you using? Is it the server or desktop version? – Ernie Jul 2 '13 at 15:37
  • It's the server version. – Chris G. Jul 2 '13 at 15:40
  • And the version number? – Ernie Jul 2 '13 at 15:45

Have a look at /dev/disk. There are some other ways to access the devices. by-path may suit your needs, dependent from the usb controllers in your drives. If this does not work you might just label (e2label(8)) your partitions and use by-label.

  • How do I mount a drive by its path? I'm assuming if I can mount a drive by-path then I can plug a different drive into the same usb slot and it will work. – Chris G. Jul 2 '13 at 15:40
  • in the by-path folder are symlinks to e.g. /dev/sde1. So you can just mount /dev/disk/by-path/pci-0000:01:00.0-scsi-0:0:0:0-part1 /mnt/backups. Some for by-path – krissi Jul 3 '13 at 7:45
  • And in laymens terms that path references the usb slot? – Chris G. Jul 3 '13 at 12:05
  • That depends on your drives usb controller. Just plug in your devices and check if the path changes. If you want to be sure use the by-label way. – krissi Jul 3 '13 at 12:35

My understanding is that you can use udev to define the disk locations as static as well.


I don't know about your Ubuntu version, but 12.04 LTS will automatically mount USB devices and put them in /media/disklabel, where 'disklabel' is the actual name of the disk according to the partition metadata. This makes the path of the disk consistent across each mounting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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