Sunday, September 16, 2012

Auto Mount Partition/Disk in Ubuntu/Linux

By default, it needs to mount any partitions and disks every single sign in to your, in this case, Ubuntu laptop. Without 'mount' the partition, you can't do such tasks like copying, making directory, deleting, moving and renaming files and or folders. Without mounting any partitions to the filesystem automatically, it make the system safe, but it also make a repeating job mounting the partition every you log in to your computer. The following is the 'how to' make your partition permanently mounted to your system.

First step, make directory to your /media/ where your partitions will be mounted. The number of directory depends on your partitions to be mounted. For example, I want to permanently moundted /dev/sda6 and /dev/sda7 to my system. So I make the following directory in the /media

sudo mkdir /media/bagustris
sudo mkdir /mdia/atmaja

In this case, I want to mount /dev/sda6 to /media/bagustris and /dev/sda7 to /media/atmaja. How can I know the disk name (sda6/sda7), please check it using sudo fdisk -l which will show the list of your partition.

The next is to edit /etc/fstab (using sudo nano /etc/fstab). I add the last two lines to the /etc/fstab to make my two partitions permanently mounted in Ubuntu system.

# /etc/fstab: static file system information.
# Use 'blkid' 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    nodev,noexec,nosuid 0       0
# / was on /dev/sda5 during installation
UUID=d80dc7fe-c637-4c3b-8010-7d0169e59285 /               ext2    errors=remoun$
/dev/sda6       /media/bagustris        ntfs    rw,defaults     0       0
/dev/sda7       /media/atmaja   ext2    rw,defaults     0       0

Some parameters you need are: filesystem, mount point, partition type (ntfs, ex2, ex4, xfs),  type (r:read,w:write and others), and passworded or not. After editing this file, your partition will be permanently mounted to your Ubuntu system. If you get error, please check again your /etc/fstab file. Another task to do after this, is to change partition name by adding label (make it the same partition name to make easy) to each partition using gparted. It is not difficult task.

Related Posts Plugin for WordPress, Blogger...