Link to home
Start Free TrialLog in
Avatar of Mark
Mark

asked on

Linux mount alternating USB drives via UUID

I have 2 external USB drives mounted to my Slackware 14.1 system. One of these drive pretty much stays mounted. The other is used for a backup and is switched weekly. My current /etc/fstab look like:
/dev/sdb1       /archive                ext2          defaults   0 2
/dev/sdc1       /remoteBackup   auto            noauto,user,rw 0 2

Open in new window

The problem is that if e.g. sdc1 doesn't get unmounted before being unplugged, the next time a drive is plugged in it goes to sdd1 and sometimes upon reboot /archive ends up on sdc1 ... which messes up the backup AND access to /archive.

I though about using UUID. This works just fine for the semi-permanent drive /archive, but not so well for the drive I swap weekly. I tried:
UUID=53c2ee69-5952-407c-af94-52b9b4a773d7 /archive auto noauto,user,rc      0 2
UUID=60881cd8-2968-4e1d-b1b1-5b60cddd2d1f /remoteBackup auto noauto,user,rw  0 2
UUID=a6bbab22-25e9-4423-a070-a519119699a4 /remoteBackup auto noauto,user,rw  0 2

Open in new window

Which worked for /archive, but I got a message saying it couldn't find 60881cd8-2968-4e1d-b1b1-5b60cddd2d1f, which is true, I had its twin a6bbab22-25e9-4423-a070-a519119699a4 mounted.

Is there a way to specify an "or" condition with UUIDs? Alternatively, I suppose I could symlink a different directory to /remoteBackup, but that seems messy.
Avatar of Gerwin Jansen
Gerwin Jansen
Flag of Netherlands image

Can you try with auto and 0 0 at the end of your fstab entries?

So like this:

UUID=60881cd8-2968-4e1d-b1b1-5b60cddd2d1f /remoteBackup auto auto,user,rw  0 0
UUID=a6bbab22-25e9-4423-a070-a519119699a4 /remoteBackup auto auto,user,rw  0 0
ASKER CERTIFIED SOLUTION
Avatar of noci
noci

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of noci
noci

Any progress?, follow-up info?
Avatar of Mark

ASKER

Sorry for the delay. Other fires to put out. I will try the "Label" solution later on today and post back.
Avatar of Mark

ASKER

noci: That LABEL idea did the trick! Commands involved:

$ e2label /dev/sdc1 REMOTEBU
$ mount -L REMOTEBU /remoteBackup

fstab:
LABEL=REMOTEBU  /remoteBackup    auto noauto,user,rw  0 2