How to auto mount my external hard drive?

65,606

Solution 1

I'm in a similar situation, except that my system worked just fine with 10.04. I have an external mybook hard drive that I use for backup using nfs4 and grsync. At the end of fstab I have these mount commands:

/media/mybook/laptop_backup /export/laptop_backup none bind 0 0
/media/mybook/laptop_D610 /export/laptop_D610 none bind 0 0
/media/mybook/laptop_www /export/laptop_www none bind 0 0

In 10.04, boot completed with these directories mounted and accessible over the network. When I upgraded to 10.10, the boot pauses with an error message regarding each one giving me the option to press S to skip or some other letter to manually fix the problem. Since I don't know how to fix it, I just skip (once for each directory) and boot completes. Manually executing sudo mount -a succeeds in mounting the directories. I guess the timing changed from 10.04 to 10.10 or something.

Note that there is no mount command for the mybook external USB 1 TB hard drive in /etc/fstab. So I guess the drive automounted in 10.04 and that's not happening in 10.10. I tried adding:

 /dev/sdd1 /media/mybook type ext3

But that failed in the same way that mounting the directories did.

Adding the nobootwait option fixed it. Oddly, it looks like nobootwait apparently causes the system to wait until the mount is completed, even though the man page says the opposite. Here's the commands from /etc/fstab:

/dev/sdd1 /media/mybook ext3 nobootwait 
/media/mybook/laptop_backup /export/laptop_backup none bind 0 0 
/media/mybook/laptop_D610 /export/laptop_D610 none bind 0 0 
/media/mybook/laptop_www /export/laptop_www none bind 0 0 –

Solution 2

This is the GUI way of doing it so you don't have to modify your fstab file manually.

If you look in the repositories you should see a program called mountmanager or from the terminal (command line) just type:

sudo apt-get update
sudo apt-get install mountmanager

Once it is installed you can open it by clicking System->Administration->Mount Manager from the menus.

Note: this program is currently supported till 12.10. It isn't yet available for 13.04.

Once the program is open you can click the extra drive you want to automount from the list on the left. In the options you have a area where you can pick the mount point. In my case I wanted my external drive to be mounted at /media/drive/ so I created a directory there and set it as the mount point. Then I clicked partition->apply from the mount manager menus.

Here it stated it would be modifying my fstab file but I clicked okay. Rebooted my machine and everything was good it was auto-mounted there.

Solution 3

I had this problem and it turned out to be that the device had changed for the drive and it was conflicting with the root drive. After the error the boot process stopped and queried me to type S to skip and continue or M to bring up a shell and do a manual fix.

Typing M and then mount -a resulted in a message that the device was already mounted as / which was not true. This was the hint that it was confused.

It is apparently safer to us UUIDs in the fstab than to use device labels as this avoids such conflicts. You can type "blkid" to find the device to UUID mapping and also see if the device has changed from what you had in the table.

The mountmanager utility allows you to specify labels or UUIDs , so this can be of help if you want to automatically generate the fstab from a GUI.

Solution 4

Basically ubuntu should automount your external harddrive. If it doesnot mount then you can enter the information on /etc/fstab. See here for mounting information.

Solution 5

Editing fstab is really the best way to go. It is really not a hard as it first appears. Just cp /etc/fstab /etc/fstab.orig and make sure that you have a live cd/usb handy in case you really mess up.

You could also try a script using gvfs-mount, and load it at startup. It is in the package gvfs-bin if it is not installed by default. The syntax is pretty straight forward.

Share:
65,606

Related videos on Youtube

Behzadsh
Author by

Behzadsh

A [Not Pro] web developer

Updated on September 17, 2022

Comments

  • Behzadsh
    Behzadsh over 1 year

    On login, ubuntu 10.10 would not mount external hard drives automatically, While ubuntu 10.04 mount them on login.
    I've tried Storage Device Manager but it give error when external hard is not plugged.

    any idea or suggestion?

    • Admin
      Admin about 12 years
      agreed with Takkat. ytg: you do need fstab for this. You learn by messing up! You also learn to create backups if you mess up so start with that ;)
  • Behzadsh
    Behzadsh over 13 years
    waiting for your codes :)
  • Behzadsh
    Behzadsh over 13 years
    it didn't help me :|
  • Behzadsh
    Behzadsh over 12 years
    thanks for trying to help but I don't understand your language :)
  • Luke
    Luke over 12 years
    Warning: I installed this program and ran it. I decided not to use any of its features since the user interface was horrible and I couldn't make heads or tails of it. I decided to close the program not using any of its functionality. To my horror, when I opened /etc/fstab in nano afterward I noticed that it had already rewritten /etc/fstab without my consent.
  • Rinzwind
    Rinzwind about 12 years
    cool! But I do advice everyone to dig into editing /etc/fstab. It is not that hard and at some point your gnome/unity is broken and you are left with is a command line prompt. All those changes you made on command line will help you to appreciate command line. (but it is a nifty program ;) )