Wednesday, April 20, 2011

Auto Mount Partitions on Boot (Linux Mint/ Ubuntu)

If you are using Linux Mint or Ubuntu, you might have observed that you need to mount all partition each time when you boot the system. So, here I come with solution "Automounting".. The partition will be automouted. So, you can get rid of mouting partition after every boot.

To auto mount drive on boot, follow steps ahead :)


1. Create mount point, where drive will mount. So, you need to create a folder somewhere in /media/ or /home. Anywhere you are comfortable.

Example:  $mkdir /media/c

2. Find Out  Partition Identifier, there are three types of partition identifier :
 a) /dev/sdxx  : you can use blkid  or df command to determine the same.

For Example: /dev/sda1

 b)Either, you can find UUID for all drive, the robust option, it works well even if you remove drive and plug it again.

UUID="BCFC8B73FC8B26AC"

c) LABLE as partition Identifiere: If you use gparted for partitioning, they provide facility to give label name for partition.
For Example : LABLE="Songs"


Lets look at command blkid :

sudo blkid
[sudo] password for me:
/dev/sda1: UUID="BCFC8B73FC8B26AC" TYPE="ntfs"
/dev/sda5: LABEL="New Volume" UUID="C6CCD31FCCD30917" TYPE="ntfs"
/dev/sda6: LABEL="Songs" UUID="A404DC7904DC4FC2" TYPE="ntfs"
/dev/sda7: LABEL="Hindi Movies" UUID="D2FCE9A3FCE98259" TYPE="ntfs"
/dev/sda8: LABEL="New Volume" UUID="9854F0E454F0C5D2" TYPE="ntfs"
/dev/sda9: LABEL="New Volume" UUID="D8F0F85AF0F84074" TYPE="ntfs"
/dev/sda10: UUID="32C3-97D8" TYPE="vfat"
/dev/sda11: UUID="fcdb8151-3a1e-42cb-92dc-e0aa8c66791e" TYPE="swap"
/dev/sda12: UUID="953d99ee-5fe1-482e-8ee8-0900a9260500" TYPE="ext4"



You can clearly see all type of Partition Identifier.


3. Now, look at file  /etc/fstab. Here goes the all auto mount script. You may already find default automounting script. So now, you need to construct mounting line based on your system, as follows:

For NTFS partition:
mkdir /media/c
sudo su
echo "/dev/sda1 /media/c ntfs defaults,umask=007,gid=46 0 0" >> /etc/fstab

For FAT32 partition:

mkdir /media/c
sudo su
echo "/dev/sda1 /media/c vfat umask=0000,uid=1000,gid=1000,auto,rw,users 0 0" >> /etc/fstab 

For EXT3 partition:

mkdir /media/c
sudo su
echo "/dev/sda1 /media/c ext3 defaults,noatime 0 2" >> /etc/fstab


In this example, you can see we are using /dev/sda1 as Partition Identifier.

You can also make use of UUID or LABLE like given below:

echo " UUID=C6CCD31FCCD30917 /media/c ext3 defaults,noatime 0 2" >> /etc/fstab

OR

echo " LABEL=Songs /media/c ext3 defaults,noatime 0 2" >> /etc/fstab


Note: change your bold characters according to your system.

Restart the sytem. You can find your partition auto mounte.

Cheers!!!! :)

-Neel


Sunday, January 9, 2011

What is init.d

If you are Linux user, the time will come when you should know about init.d.

Nice explanation given on the link below about init.d
http://www.ghacks.net/2009/04/04/get-to-know-linux-the-etcinitd-directory/