Tag Archives: automount

Auto mount partition in ubuntu

I have a dual boot system consisting of 3 partitions – one for windows, one for ubuntu and a bulky MEDIA drive that I share with both of them as it contains all my media files like Music and Videos.

The easiest way to mount a partition automatically to a destination is by editing the fstab.

Open the terminal and determine the device to be mounted.
You need to be root in order to see the disk list

amit@texens:~$ sudo su
[sudo] password for amit:

Use fdisk -l to determine the disk

root@texens:/home/amit# fdisk -l

You’ll get something like this

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x54e308d9

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 102400 7 HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2 13 6528 52326400 7 HPFS/NTFS
/dev/sda3 6529 33523 216837337+ 5 Extended
/dev/sda4 33524 38913 43295175 83 Linux
/dev/sda5 6529 33274 214837213+ 7 HPFS/NTFS
/dev/sda6 33275 33523 2000061 82 Linux swap / Solaris

Note, the line

/dev/sda5 6529 33274 214837213+ 7 HPFS/NTFS

/dev/sda5 is the partition that we want to mount. Make a note of it.

Now we’ll edit the fstab file located at /etc/fstab.
Again you need to be root in order to edit the fstab file.
Make sure you are the root and use an editor of your choice to edit the file. I’ll be using vi editor for the same.

root@texens:/home/amit# vi /etc/fstab

The fstab file looks something like this.

# /etc/fstab: static file system information.
# Use 'vol_id --uuid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
proc /proc proc defaults 0 0
# / was on /dev/sda4 during installation
UUID=1e6770f3-7cd7-4be9-b6f0-3c30f96f852f / ext3 relatime,errors=remount-ro 0 1
# swap was on /dev/sda6 during installation
UUID=232230d0-236c-4e62-9c05-99b61d48b23e none swap sw 0 0

Now, all we need to do is to add the
I want to mount the partition to the location /media/bulk
Create the folder /media/bulk

root@texens:/home/amit# mkdir /media/bulk

Now, add the following line to the end of the file.

/dev/sda5 /media/bulk ntfs-3g defaults,locale=en_US.utf8 0 0

And save this file.
Now, hit the mount command to mount it just this time.

root@texens:/home/amit# mount -a

Next time when you boot into your computer, it will be automatically mounted at its designated position.