[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Linux mount alternating USB drives via UUID

Posted on 2015-02-12
5
Medium Priority
?
169 Views
Last Modified: 2015-03-04
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.
0
Comment
Question by:jmarkfoley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 40609020
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
0
 
LVL 40

Accepted Solution

by:
noci earned 2000 total points
ID: 40610092
Maybe a better approach is to label the USB stick identical f.e. with BackupStick and use LABEL=BackupStick in the /etc/fstab.. in stead of UUID.., UUID is meant to uniquely identify objects, so it uses an algorithm that should lead to universally unique labels.
Only one entry should be needed then.
0
 
LVL 40

Expert Comment

by:noci
ID: 40632806
Any progress?, follow-up info?
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40644802
Sorry for the delay. Other fires to put out. I will try the "Label" solution later on today and post back.
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 40645722
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
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question