External USB Harddrive mounts with different names [SOLVED]

Questions about hardware,drivers and peripherals
Forum rules
Before you post please read this

External USB Harddrive mounts with different names [SOLVED]

Postby triwave on Sat Sep 13, 2008 7:47 pm

Hello,

I've got an external HD with USB connection I use for certain backups. It has multiple EXT3 partitions on it.

It mounts OK and is perfectly usable, however when I plug it in or reboot the computer the partitions don't mount the same each time. For my backups this is problematic because files then go to the wrong partition so I have to set up the destination each time to point to the right place. I can't do an automatic cron job because of that.

So how do I get this HD to mount to the same path/name the same each time it's plugged or the computer reboots?

Thanks
Last edited by triwave on Mon Sep 15, 2008 9:38 pm, edited 1 time in total.
triwave
Level 1
Level 1
 
Posts: 35
Joined: Thu May 29, 2008 12:32 pm

Linux Mint is funded by ads and donations.
 

Re: External USB Harddrive mounts with different names

Postby rhodry on Sun Sep 14, 2008 12:46 am

You need to give each of the partitions on the external drive a name; such as 'data1', 'backup', or whatever.

To name an ext3 partition, first do an 'sudo fdisk -l' command to get the device name of the partition you want to name; such as /dev/sdb1,2,3 etc. then unmount the device and use one of either of the following commands as super user:

e2label /dev/(device) new-label or

tune2fs -L MyNewExt3Label /dev/????

Do a Google or Forum search and run the 'man' on the two commands to make sure you know what you are doing and how to undo any errors before you start.

Make a mount point for each name in /mnt/backup (or whatever).

Reboot your machine; once the partition has a name it will always boot to the same name and can be used in /etc/fstab and in cron jobs for backups etc.

Cheers,
rhodry.
rhodry
Level 4
Level 4
 
Posts: 347
Joined: Mon Jun 04, 2007 7:32 am

Re: External USB Harddrive mounts with different names

Postby triwave on Mon Sep 15, 2008 9:12 pm

I tried tune2fs first, it errors out saying there was no valid superblock ??

Next I tried e2label and it worked fine

Now when the drive mounts it shows up as the label name I used with e2label. I updated simplebackup to point to that label name and things seem OK :D

Thanks for the tip, that was a very easy fix.

One other question while I'm on the external drive topic ...

All the partitions from the said drive automount when I plug in the drive. How do I keep everything from mounting and opening up nautilus windows on my desktop? The only partition I want to automount is the one I set the label with above. The others are just special use and I can mount them when I need them.

Thanks
triwave
Level 1
Level 1
 
Posts: 35
Joined: Thu May 29, 2008 12:32 pm

Re: External USB Harddrive mounts with different names [SOLVED]

Postby rhodry on Mon Sep 15, 2008 11:27 pm

Glad it worked ok.

At a terminal prompt can you type in

$ mount

and post the output here. Also, post a copy of your /etc/fstab file. Auto mounting is invariably tied up with these things, so it is important to just see what is happening before suggesting changes.

Rhodry.
rhodry
Level 4
Level 4
 
Posts: 347
Joined: Mon Jun 04, 2007 7:32 am

Re: External USB Harddrive mounts with different names [SOLVED]

Postby triwave on Fri Sep 19, 2008 4:56 pm

Rohdry:

Sorry it's been a while but I still wanted to follow-up on the automount questions.

Output of mount is as follows:

Code: Select all
/dev/sda5 on / type ext3 (rw,relatime,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
/sys on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
udev on /dev type tmpfs (rw,mode=0755)
devshm on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
lrm on /lib/modules/2.6.24-16-generic/volatile type tmpfs (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
gvfs-fuse-daemon on /home/user1/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=user1)
/dev/sda2 on /media/DATA type fuseblk (rw,nosuid,nodev,noatime,allow_other,blksize=512)
/dev/sdb1 on /media/disk type ext2 (rw,nosuid,nodev,uhelper=hal)
/dev/sdb2 on /media/work_backup type ext3 (rw,nosuid,nodev,uhelper=hal)


fstab is:

Code: Select all
# /etc/fstab: static file system information.

#

# <file system> <mount point>   <type>  <options>       <dump>  <pass>

proc            /proc           proc    defaults        0       0

# /dev/sda5

UUID=4967683f-9097-4bbe-9cfa-f61a58268827 /               ext3    relatime,errors=remount-ro 0       1

# /dev/sda6

UUID=4fe6b0d2-240c-4654-82e9-ea5e719f89dd none            swap    sw              0       0

/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0


If you have any suggestions I appreciate hearing them. I'm not sure how this whole automount thing works.
triwave
Level 1
Level 1
 
Posts: 35
Joined: Thu May 29, 2008 12:32 pm

Re: External USB Harddrive mounts with different names [SOLVED]

Postby rhodry on Sun Sep 21, 2008 8:06 am

triwave wrote:Rohdry:

Sorry it's been a while but I still wanted to follow-up on the automount questions.

...............[stuff snipped]...........

fstab is:

Code: Select all
# /etc/fstab: static file system information.

#

# <file system> <mount point>   <type>  <options>       <dump>  <pass>

proc            /proc           proc    defaults        0       0

# /dev/sda5

UUID=4967683f-9097-4bbe-9cfa-f61a58268827 /               ext3    relatime,errors=remount-ro 0       1

# /dev/sda6

UUID=4fe6b0d2-240c-4654-82e9-ea5e719f89dd none            swap    sw              0       0

/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0


If you have any suggestions I appreciate hearing them. I'm not sure how this whole automount thing works.


OK, 1st my disclaimer?! :) I am by no means an expert and I must confess Mint is not my primary os, but I think this stuff is pretty generic.

The cdrom line ( ie /dev/scd0 etc) in your /etc/fstab is the clue. Notice in the options section there is the "noauto" option used. You want your cdrom drive available for easy mounting but you do not want it to automount at system start because there may well be nothing in it to mount. This is what the "noauto" option achieves. The system knows all about the drive and its file systems etc because you have a line in the /etc/fstab file; but, it will not try to mount the drive automatically.

You need to add similar lines to the bottom of the /etc/fstab file for your external drive partitions. Those you wish to leave unmounted will have a "noauto" option and the one you want mounted will have an "auto" option. Here is an example of what I mean:

/dev/sdb2 /mnt/sdb2 ext3 user,exec,rw,noauto 0 0

That line says to the os that when the device at address /dev/sdb2 is mounted, mount it to /mnt/sdb2, use an ext3 file system on it, let the user mount it, allow program execution on the mount, mount it read/write but do not try to automount it. The last two zeros tell the os about when to run a file system check on the drive.

If you want that drive automatically mounted, you just change the "noauto" option to "auto".

A couple of things! First and foremost - BACKUP your /etc/fstab file before making any changes. You must be superuser to edit /etc/fstab (use gksudo gedit /etc/fstab). Also, substitute your preferred partition names and mount points for the ones used in the example.

Now, one qualifier. When I do this, my external usb drive is permanently attached to the system and I know this works. I don't plug it in and unplug it. I automount a shared file partition but I only manually mount my backup partition when I want to do a backup. So, I am not 100% certain that this will work in Mint and do exactly what you require. Someone else may have other ideas, but you probably need to remove the solved for a while.

Good luck,
Rhodry.
rhodry
Level 4
Level 4
 
Posts: 347
Joined: Mon Jun 04, 2007 7:32 am


Return to Hardware Support

Who is online

Users browsing this forum: No registered users and 21 guests