0

I'd like to have 2 eSATA drives, which can be hot swapped, mounted at the same mountpoint. Only one of them will every be mounted at a time.

Since they may not be attached when the computer boots, having them in /etc/fstab is not a good option, I presume. I tried using autofs for this, but it does not seem to support multiple drives with the same mountpoint.

This question is about the same topic, but using fstab. It seems like there is no solution for what I want, other than writing my own script and manually running that after inserting one of the drives.

I have an auto.mine file that looks like this. It works when I have one but not both of the lines enabled. I can see that it might be a bad idea in general to set up the same mountpoint for multiple disks, but I would still like to know if it is possible, because it would certainly be handy in my case.

# drive1
storage -fstype=auto UUID="xxx-xxx-xxx-xxx"

# drive2
# This works (new mountpoint):
storage1 -fstype=auto UUID="yyyy-yyyy"
# This doesn't work (same mountpoint):
storage -fstype=auto UUID="yyyy-yyyy"

1 Answer 1

3

It's certainly possible, in a number of different ways.

1) All automounter work by using udev rules which invoke programs or scripts. Find a automounter you like (usbmount is a simple one I prefer), and modify the scripts. Or write your own, using the existing scripts and rules as a template.

2) Give the volume (assuming a single volume) on each of the harddisks the same label or uuid (see man tune2fs), then use /dev/disk/by-label/... or /dev/disk/by-uuid/... to mount it in your preferred automounter (assuming it supports a configured path with a specific mountpoint).

And you should definitely think about what is going to happen if you accidentally attach both disks.

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.