Mount a partition in Ubuntu automatically at startup

Posted by Mikko at 2 July 2009

Category: How-To, Life Hacks, Linux

Tags:

Everytime I boot Ubuntu, I have to mount all the partitions I need to get them up and running. But seriously, I find it annoying. Here’s a workaround that worked for me.

Identify the partition you want to automount. Mount that specific partition and open its content using File Browser. Keep in mind it’s mount point, the ones found on the location bar.

Advanced knowledge in using Linux IS NOT A prerequisite. :D

Mount point

Open System Monitor (System -> Administration -> System Monitor). Go to the File Systems tab and find the corresponding Device of the mount point. The format would be something like /dev/sd[a-z][1-9].

Unmount the device by going to Places -> Computer. Right click the partition and click Unmount Volume.

Now, open terminal (Applications -> Accessories -> Terminal). Navigate to /dev/disk/by-id by typing this command:
cd /dev/disk/by-id.

Get the list of files and directories on the path by typing ls. Find your appropriate device. If it's /dev/sda3, it should end with something like -part3. Copy the file name and paste it somewhere else such as a text-editor.

Now, edit /etc/fstab by typing the command sudo gedit /etc/fstab. At the end of the file, paste this:
/dev/disk/by-id/[replace_01] /media/disk [replace_02] defaults 0 0

Replace replace_01 with the filename you pasted somewhere else a while ago and replace_02 with the file system of the partition (ntfs, ext3, etc).

It should look like this:
/dev/disk/by-id/scsi-SATA_ST9160821AS_5MA20LDN-part1 /media/disk ntfs defaults 0 0

Now, create the /media/disk folder by typing the command:
sudo mkdir /media/disk

Finally, mount the volume by typing:
sudo mount /media/disk

The partition should automount automatically the next time you reboot it. Have fun!

======================================

Related posts:

  1. Quick Hack: How to remove icons mounted disks / volumes in Desktop (Ubuntu)
  2. Ubuntu and Smart Telecom Internet (Philippines) thru Bluetooth
  3. SOLUTION: Ubuntu 9.04 Jaunty Jackalope won’t update repositories
  4. How To: Install Adobe Flash Player on 64-bit Ubuntu 10.10 Maverick Meerkat
  5. Disk Knight Remover

3 Comments

  1. Ed Salisbury says

    Good post – I’m more command-line oriented, so I wrote this to do the same thing from the command line: http://bit.ly/CO2Wl

    Reply
  2. Alonso says

    good guide thanks , I hope it works.

    Reply
  3. Gintarman says

    That works fine. Nice :)

    Reply

Leave a Reply

Leave a Reply
  • (required)
  • (required) (will not be published)