[ubuntu-uk] Symlinking to USB hard drives
neil.greenwood.lug at gmail.com
Thu Oct 7 10:01:24 BST 2010
On 5 October 2010 19:11, Anton Piatek <anton at piatek.co.uk> wrote:
> On 5 Oct 2010 18:55, "Glen Mehn" <glen.mehn at oba.co.uk> wrote:
>> On 04/10/10 20:25, Neil Greenwood wrote:
>>> Hi all,
>>> I have a couple of matched USB hard drives that I use as part of my
>>> backup strategy. At the moment they both have the same label, so they
>>> end up mounted at /media/backup. But this means I can't easily tell
>>> which drive is which, and when I plug the second in, it gets mounted
>>> at /media/backup_.
>>> I'd like to re-label the drives to backup1 and backup2, but then have
>>> a symlink automatically created at /media/backup to whichever drive
>>> was first plugged in. I think I need to use a udev rule, but other
>>> than that I'm not sure.
>>> Does anyone have any ideas?
>> Hi Neil,
>> You can rename partitions in parted or gparted, which should sort it out
>> for you. Then in your backup script, put something like:
>> if test -d /mounts/backup1
>> do ln -s /mounts/backup1 /mounts/backup
>> elif test -d /mounts/backup2
>> do ln -s /mounts backup2 /mounts/backup
>> else print "neither backup mount point exists, exiting"; exit 1
>> Does that make sense?
> I use devices by id in my fstab to have unique mount points. Have a browse
> through /dev/ when the disk is connected
Sorry, I should have been clearer with my question!
I know how to rename the partitions: I named them both 'backup' in the
I don't have one specific backup script, I use the drive from
different applications for different backup purposes. I'd like the
first drive I plug in to get a symlink automatically, which I think
udev can do. I'm just not sure exactly how, nor how to check whether
or not the symlink has already been created.
More information about the ubuntu-uk