Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I plug in my Seagate FreeAgent external hard drive and then plug the USB into my Ubuntu 10.04 machine and, as expected, it mounts in /media. OK, this is great. I can access the files, etc. Then, I edit my smb.conf file for this drive, so that I can share it and I add a line for sharing drives I don't own.

I share the drive and unmount it and then remount with

sudo mount -t ntfs /dev/sdb1 /media/FreeAgent

and it mounts fine. I can access the drive from a Windows XP machine on my network. Then, a short while later, it auto-mounts again, as /media/Main-BackUp and then the mount point /media/FreeAgent no longer has the drive mounted and the files are not present. The files are in the newly mounted directory. I should note that the name of the drive is Main-BackUp. I have edited my smb.conf file several ways to get this to work, including changing the name so it matches and the mount point directory where it should live. It is currently like so:

comment = Backup drive
path = /media/Main-BackUp
guest ok = yes
browseable = yes
read only = no
create mask = 0777
directory mask = 0777

But I have changed the line path = /media/Main-BackUp to path = /media/FreeAgent with no success.

Then, some time later, it does this again, and another mount point is created /media/Main-BackUp_ and then the previous mount doesn't have any files but this new one does. Each time, a window pops up with the new mount and the files on my external drive. If I leave this machine alone for an hour or so, it will repeat this process 5 or 6 times.

I successfully mounted a Drobo on my work network using a similar technique and it works great. Not sure what I'm doing wrong. Any help is greatly appreciated.

NOTE - So I commented out the lines in the smb.conf and experimented with the drive auto-mounting on it's own. Still happens. I searched for a way to run off auto-mounting, but in 10.04 I can't find it. I tried Preferences > File Management > Media and unchecked anything that seemed likely to cause this to no avail. Towards the end of the auto-mounting experiment after commenting out the lines in smb.conf this error was generated:

alt text

NOTE 2 - The drive mounts OK, but then several minutes later, the network share becomes blank and the files aren't there. I go to the server computer and look at the drive, and this most recent time, the drive shifted from sdb1 to sdc1. I remounted and it seemed to work again but then after a few minutes, the same behavior comes back... Empty share. This is odd behavior and I'm not sure I'm getting the root cause.

share|improve this question
up vote 2 down vote accepted

First of all there's two issues here. I usually prefer to leave my external hard drives plugged into my computer, then have them mount automatically when I start everything up. However, there's a function called udev that runs on boot that defines your attached hardware to the hardware abstraction layer. And it more or less assigns a device identifier based on the order it sees your external hard drives which can change from boot to boot. Usually the first one it sees it assigns to /dev/sdb1, the second to /dev/sdc1, the third to /dev/sdd1, etc. If you only had one external hard drive it would always pick up the /dev/sdb1 identifier, and you'd make an /etc/fstab entry to automount it and be done with it.

The key to making sure udev always assigns the same device identifier to the same device is to define a udev rule to do that based on the serial number of the device. And the way to do that is as root, create a new rule file in /etc/udev/rules.d. Within that directory create a file called 10-local.rules, (the 10 ensures that it gets executed early on). Here's what mine looks like:


To get the serial numbers, I just read them off the actual hard drive itself. Each line of the rule basically says, if the device is a block, and a usb, and has a serial number of XXXX, then asign it this name.

Then I know every time I boot, my 4 attached hard drives will always be assigned the same device identifier, /dev/usb2, /dev/usb3, /dev/usb4, /dev/usb5.

Once that's done, it's easy to edit the /etc/fstab file and add the mount commands for the drives, here's relevant lines from mine:

/dev/usb2   /media/usb2 ntfs    rw,auto 0   0
/dev/usb3   /media/usb3 ntfs    rw,auto 0   0
/dev/usb4   /media/usb4 ntfs    rw,auto 0   0
/dev/usb5   /media/usb5 ntfs    rw,auto 0   0

And when my system boots, everything is in the right place, mounted and ready to use...

woodwose@woodwose-server:~$ df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/sda1              72G   28G   40G  41% /
none                  493M  436K  493M   1% /dev
none                  497M  1.1M  496M   1% /dev/shm
none                  497M  340K  497M   1% /var/run
none                  497M     0  497M   0% /var/lock
none                  497M     0  497M   0% /lib/init/rw
/dev/usb4             1.4T 1023G  375G  74% /media/usb4
/dev/usb2             1.4T  1.1T  300G  79% /media/usb2
/dev/usb5             1.4T  1.3T   73G  95% /media/usb5
/dev/usb3             1.4T  1.3T   93G  94% /media/usb3

The order in which these usb devices are listed changes, because there's no guarantee that OS is going to find them in the same order every time, but since you control what device identifier is assigned to each device based on something that doesn't change, ie the serial number of the device, you can always automount the same device to the same mount point on startup.

And since your smb shares are based on the mount point, you also manage to share out the same files on the same share names consistently as well.

I hope that helps you.

share|improve this answer
no worries, i edited it about 5 times anyway making sure everything was as close to right as I could get it, lol – Woodwose Oct 14 '10 at 23:55

Add the drive to /etc/fstab:

/dev/sdb1  /media/FreeAgent  ntfs-3g  defaults  0  0

This will:

  • Cause the drive to be mounted on boot to /media/FreeAgent (if plugged in)
  • Stop GNOME and other utilities from trying to remount the drive
    • This also means that if it wasn't plugged in at boot, you'll need to manually mount it as you have been, or with sudo mount -a.
  • Make the drive mount at the correct location if other utilities do try to automount it.

I've done this with a couple of drives in the past and it's worked like a charm.

With regards to your most recent edit (NOTE 2) it seems like your drive may have a faulty connection if the device ID is changing unexpectedly.

share|improve this answer
I gave this a try and while Ubuntu was booting it gave me the "Drive isn't ready or can't be found, please press S to skip......" message. I will try again, and go through the sequence. Maybe the drive was still active when rebooting... – nicorellius Sep 15 '10 at 23:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.