Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian User (http://www.linux-archive.org/debian-user/)
-   -   mounting two disks on the same mount point (not at the same time) (http://www.linux-archive.org/debian-user/229628-mounting-two-disks-same-mount-point-not-same-time.html)

Reid Priedhorsky 01-17-2009 10:38 PM

mounting two disks on the same mount point (not at the same time)
 
I have a couple of USB disks that I use for backups. I rotate them so only
one is attached at the same time. I have a nightly cron that mirrors the
directories of interest onto whichever one is attached using rsync.

I'd like to mount whichever one is attached at the same mount point,
without having to specify the device. For example, rather than:

$ mount /dev/disk/by-id/usb-ST316002_1A_DEF107679C83-0:0-part1 /mnt/backup

I'd like to say:

$ mount /mnt/backup

The latter works for whichever is specified first in /etc/fstab, but not
the other one.

They are both *usually* the only USB disk attached, so they both appear as
/dev/sdc1, but I don't really want to depend on that.

Is this possible?

Thanks,

Reid


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Jeff D 01-18-2009 01:19 AM

mounting two disks on the same mount point (not at the same time)
 
On Sat, 17 Jan 2009, Reid Priedhorsky wrote:

> I have a couple of USB disks that I use for backups. I rotate them so only
> one is attached at the same time. I have a nightly cron that mirrors the
> directories of interest onto whichever one is attached using rsync.
>
> I'd like to mount whichever one is attached at the same mount point,
> without having to specify the device. For example, rather than:
>
> $ mount /dev/disk/by-id/usb-ST316002_1A_DEF107679C83-0:0-part1 /mnt/backup
>
> I'd like to say:
>
> $ mount /mnt/backup
>
> The latter works for whichever is specified first in /etc/fstab, but not
> the other one.
>
> They are both *usually* the only USB disk attached, so they both appear as
> /dev/sdc1, but I don't really want to depend on that.
>
> Is this possible?
>
> Thanks,
>
> Reid

How about putting something like this in a shell script and just calling
that?

for DiskID in DISKID1 DISKID2 ; do
if [ -b /dev/disk/by-id/${DiskID} ] ; then
echo "mounting disk $DiskID"
mount /dev/disk/by-id/${DiskID} /mnt/backup
fi
done

Jeff
--
8 out of 10 Owners who Expressed a Preference said Their Cats Preferred Techno.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Paul Cartwright 01-18-2009 01:44 AM

mounting two disks on the same mount point (not at the same time)
 
On Sat January 17 2009, Reid Priedhorsky wrote:
> I'd like to mount whichever one is attached at the same mount point,
> without having to specify the device. For example, rather than:

use mount by-uuid , it is specific to each device..
you can put the lines in fstab like this:
/dev/disk/by-uuid/686C-7E81 /media/usb_DAWGS vfat
users,atime,rw,nodev,noexec,no

--
Paul Cartwright
Registered Linux user # 367800
Registered Ubuntu User #12459


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Raj Kiran Grandhi 01-18-2009 02:39 AM

mounting two disks on the same mount point (not at the same time)
 
Reid Priedhorsky wrote:

I have a couple of USB disks that I use for backups. I rotate them so only
one is attached at the same time. I have a nightly cron that mirrors the
directories of interest onto whichever one is attached using rsync.

I'd like to mount whichever one is attached at the same mount point,
without having to specify the device. For example, rather than:

$ mount /dev/disk/by-id/usb-ST316002_1A_DEF107679C83-0:0-part1 /mnt/backup

I'd like to say:

$ mount /mnt/backup

The latter works for whichever is specified first in /etc/fstab, but not
the other one.

They are both *usually* the only USB disk attached, so they both appear as
/dev/sdc1, but I don't really want to depend on that.

Is this possible?


Give the same label to both the disks. And add the line to mount by
label in the fstab, like:


LABEL=NIGHTLY_BACKUP_DRIVE /mnt/backup ...



Thanks,

Reid





--

If you can't explain it simply, you don't understand it well enough.
-- Albert Einstein


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


All times are GMT. The time now is 12:41 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.