Auto Mount Partitions on Boot (also Windows partitions)
Posted: Fri Feb 13, 2009 12:06 am
Introduction:
Lately I have seen a number of people trying to get partitions to mount on boot. This is understandable since Ubuntu, hence Mint, does not auto mount all partitions by default anymore. There is good information on this subject in the wiki but I still see lots of questions so either people aren't understanding or they are not searching the wiki for answers before posting. My purpose here is to give you a quick reference for auto mounting on boot, the three most common partition types.
Discussion:
In order to auto mount a partition on boot, two criteria must be met. First, you must have a folder somewhere in the Linux file system to be used as a mount point. It can be named anything you wish. By convention, it should be located in /media and/or /home, but it could be placed almost anywhere you wish. I would urge you to refrain from putting it in other places as it is almost always better to stick with the assumptions that time has proven to be the most practical and serviceable.
The second criteria is you must put the appropriate mounting lines in your /etc/fstab file to bind or mount the partition to the folder you have chosen to be the mount point. The fstab file is run on system boot and does the mounting operation automatically as defined therein.
There are currently three partition identifiers in common usage. The legacy /dev/sdxx identifier has been around since dirt was still clean. This is the identifier you see on the far left of the Gparted partition table screen. With the mixed use of multiple types of storage media this type of identifier can present some problems so other unique identifiers have been developed.
Example: /dev/sda3 /home/fred/data ext3 ...
Label is an alternative partition identifier that I personally favor that uses readable text as the unique identifier. The easiest way to assign text labels to partitions is probably to use one of the later versions of Gparted. There is an option to assign a text label to a selected partition in the GUI.
Example: LABEL=Data1 /home/fred/data ext3 ...
The third method, which is the default used by Ubuntu and Mint, is UUID. UUID is a string of characters, letters numbers, generated by the computer to uniquely identify a partition. The UUID of a partition can be found by typing in a terminal:
sudo vol_id -u /dev/sdxx
To get a listing of all the UUIDs in the system type in a terminal:
sudo blkid
Example: UUID=010619e3-7c2f-43c3-b71f-133f736c8bff /home/fred/data ext3 ...
Instructions:
I will use the CLI to do this as it is faster, and more universal to the various flavors of Mint. If you look at the line you will be pasting into the terminal you can probably figure out what it is doing. In the instructions below I will use the legacy partition identifiers and place the mounting folder in my home folder or in the /media folder. You can of course modify the instructions for your own purposes if you wish. Be sure to substitute your user name in place of mine and put the right partition designator in the command.
Be sure to modify the parts in bold to match your system.
To auto mount an ntfs Windows partition in your /home open a terminal and type:
mkdir /home/fred/Windows
sudo su
echo "/dev/sdxx /home/fred/Windows ntfs defaults,umask=007,gid=46 0 0" >> /etc/fstab
To auto mount an ntfs Windows partition in /media open a terminal and type:
sudo mkdir /media/Windows
sudo su
echo "/dev/sdxx /media/Windows ntfs defaults,umask=007,gid=46 0 0" >> /etc/fstab
To auto mount a fat32 data partition in your /home open a terminal and type:
mkdir /home/fred/Data
sudo su
echo "/dev/sdxx /home/fred/Data vfat umask=0000,uid=1000,gid=1000,auto,rw,users 0 0" >> /etc/fstab
To auto mount a fat32 data partition in /media open a terminal and type:
sudo mkdir /media/Data
sudo su
echo "/dev/sdxx /media/Data vfat umask=0000,uid=1000,gid=1000,auto,rw,users 0 0" >> /etc/fstab
To auto mount an ext3 data partition in your /home open a terminal and type:
mkdir /home/fred/Data
sudo su
echo "/dev/sdxx /home/fred/Data ext3 defaults,noatime 0 2" >> /etc/fstab
To auto mount an ext3 data partition in /media open a terminal and type:
sudo mkdir /media/Data
sudo su
echo "/dev/sdxx /media/Data ext3 defaults,noatime 0 2" >> /etc/fstab
The mounting options I used above are typical and can be changed to meet your needs, if you so choose and know what you are doing. Be careful transcribing the above commands. Typos are not allowed. All the spaces and punctuation are required. There are no returns in the above lines.
I hope this is helpful to you and will take some of the mystery out of auto mounting partitions on boot.
Fred
Lately I have seen a number of people trying to get partitions to mount on boot. This is understandable since Ubuntu, hence Mint, does not auto mount all partitions by default anymore. There is good information on this subject in the wiki but I still see lots of questions so either people aren't understanding or they are not searching the wiki for answers before posting. My purpose here is to give you a quick reference for auto mounting on boot, the three most common partition types.
Discussion:
In order to auto mount a partition on boot, two criteria must be met. First, you must have a folder somewhere in the Linux file system to be used as a mount point. It can be named anything you wish. By convention, it should be located in /media and/or /home, but it could be placed almost anywhere you wish. I would urge you to refrain from putting it in other places as it is almost always better to stick with the assumptions that time has proven to be the most practical and serviceable.
The second criteria is you must put the appropriate mounting lines in your /etc/fstab file to bind or mount the partition to the folder you have chosen to be the mount point. The fstab file is run on system boot and does the mounting operation automatically as defined therein.
There are currently three partition identifiers in common usage. The legacy /dev/sdxx identifier has been around since dirt was still clean. This is the identifier you see on the far left of the Gparted partition table screen. With the mixed use of multiple types of storage media this type of identifier can present some problems so other unique identifiers have been developed.
Example: /dev/sda3 /home/fred/data ext3 ...
Label is an alternative partition identifier that I personally favor that uses readable text as the unique identifier. The easiest way to assign text labels to partitions is probably to use one of the later versions of Gparted. There is an option to assign a text label to a selected partition in the GUI.
Example: LABEL=Data1 /home/fred/data ext3 ...
The third method, which is the default used by Ubuntu and Mint, is UUID. UUID is a string of characters, letters numbers, generated by the computer to uniquely identify a partition. The UUID of a partition can be found by typing in a terminal:
sudo vol_id -u /dev/sdxx
To get a listing of all the UUIDs in the system type in a terminal:
sudo blkid
Example: UUID=010619e3-7c2f-43c3-b71f-133f736c8bff /home/fred/data ext3 ...
Instructions:
I will use the CLI to do this as it is faster, and more universal to the various flavors of Mint. If you look at the line you will be pasting into the terminal you can probably figure out what it is doing. In the instructions below I will use the legacy partition identifiers and place the mounting folder in my home folder or in the /media folder. You can of course modify the instructions for your own purposes if you wish. Be sure to substitute your user name in place of mine and put the right partition designator in the command.
Be sure to modify the parts in bold to match your system.
To auto mount an ntfs Windows partition in your /home open a terminal and type:
mkdir /home/fred/Windows
sudo su
echo "/dev/sdxx /home/fred/Windows ntfs defaults,umask=007,gid=46 0 0" >> /etc/fstab
To auto mount an ntfs Windows partition in /media open a terminal and type:
sudo mkdir /media/Windows
sudo su
echo "/dev/sdxx /media/Windows ntfs defaults,umask=007,gid=46 0 0" >> /etc/fstab
To auto mount a fat32 data partition in your /home open a terminal and type:
mkdir /home/fred/Data
sudo su
echo "/dev/sdxx /home/fred/Data vfat umask=0000,uid=1000,gid=1000,auto,rw,users 0 0" >> /etc/fstab
To auto mount a fat32 data partition in /media open a terminal and type:
sudo mkdir /media/Data
sudo su
echo "/dev/sdxx /media/Data vfat umask=0000,uid=1000,gid=1000,auto,rw,users 0 0" >> /etc/fstab
To auto mount an ext3 data partition in your /home open a terminal and type:
mkdir /home/fred/Data
sudo su
echo "/dev/sdxx /home/fred/Data ext3 defaults,noatime 0 2" >> /etc/fstab
To auto mount an ext3 data partition in /media open a terminal and type:
sudo mkdir /media/Data
sudo su
echo "/dev/sdxx /media/Data ext3 defaults,noatime 0 2" >> /etc/fstab
The mounting options I used above are typical and can be changed to meet your needs, if you so choose and know what you are doing. Be careful transcribing the above commands. Typos are not allowed. All the spaces and punctuation are required. There are no returns in the above lines.
I hope this is helpful to you and will take some of the mystery out of auto mounting partitions on boot.
Fred