Blog

Auto mount partition at start up with fstab in Ubuntu

Priyanka Naskar Majumder

Every time I format my computer and reinstall UBUNTU, I just tend to forget a too easy process of auto mounting the extra partitions created during the installation. So for my own sake I am logging this down but you are also free to use it when you are stuck too.

PROCESS ONE (Short)

This is the process I use to auto mount a partition in ubuntu. Open terminal and type the following terminal codes as mentioned below.

Step1: To create the folder mount point DATA →

Terminal Code:

sudo mkdir /media/DATA

Step2: To get all permission of your folder (here username will be your username) →

Terminal Code:

sudo chown -R username:username /media/DATA/

Step3: Now open Disk Utility. Suppose you are in ubuntu 11.04 (Natty) or 11.10 (Oneiric) search for “Disk Utility” in the applications. Here you will find your partition details which are required in the next step. Like I now know that I need to mount (a)/dev/sda5 and file system is (b)ext4 as per below pic.

disk-utility-fstab

Step4: Again paste following code and press enter →

Terminal Code:

sudo gedit /etc/fstab

Step5: Your Fstab file will be open now. Add in Fstab the following code in the last line →

Fstab Code:

/dev/sda5 /media/DATA ext4 defaults 0 0

For additional information regarding “defaults“*, “0 0“** & “Fstab“+ syntax see post info below.

Step6: Save file and close.

Step7: You can now use →

Terminal Code:

sudo mount -a

OR just restart your computer.


PROCESS TWO (With backup)

The above process suits me, but there are many other processes, another common process is this one.

Step1: Open your terminal, paste and press enter →

Terminal Code:

sudo mkdir /media/DATA

Step2: Enter the next code to get all permission of your folder →

Terminal Code:

sudo chown -R username:username /media/DATA/

Step3: Additional step for permission issues of your folder →

Terminal Code:

sudo chmod -R 755 /media/DATA

Step4: Now find your partition name* →

Terminal Code:

sudo fdisk -l

fdisk-fstab

Step5: To get the file system-type open application Gparted and view the details, like if it is ext3, ext4 etc. If you do not have it installed use following command →

Terminal Code:

sudo apt-get install gparted

Step6: Paste following command to keep a backup of your fstab file →

Terminal Code:

sudo cp /etc/fstab /etc/fstab.backup

Step7: Paste following command →

Terminal Code:

sudo gedit /etc/fstab

Step8: In the open Fstab file, add the following code in the end →

Fstab Code:

/dev/sda5 /media/DATA ext4 defaults 0 0

Step9: Save & close file.

Step10: Use this command →

Terminal Code:

sudo mount -a

Your partition should be mounted now.


PROCESS THREE (GUI)

Those who love graphical user interface or is afraid of using the terminal and don’t want to manually edit the system files just go for this gui tool to manage your partitions, try Pysdm.

Option1: Search for “pysdm” in the ubuntu software center. It is there in the name “Storage Device Manager”.  Just hit the install button. Now use the application.

Option2: Or you can also install “pysdm” from terminal directly with this command →

Terminal Code:

sudo apt-get install pysdm

PROCESS FOUR (For windows ntfs)

Suppose case1> you are dual booting with windows and you need to mount a windows partition or case2> you just have a windows NTFS partition that you did not format during installation.

Step1: First install ntfs-3g driver →

Terminal Code:

sudo apt-get install ntfs-3g

Step2: Then, create the mount point for that device like in the above processes →

Terminal Code:

sudo mkdir /media/winstore

Step3: Not going into details about finding the partition informations. Please check PROCESS 1 > Step3 or PROCESS 2 > Step4 above which you will now require in the next step.

Step4: Open /etc/fstab file for editing →

Terminal Code:

sudo gedit /etc/fstab

Step5: Add the following code below the last part of the file →

Fstab Code:

/dev/sda7 /media/winstore ntfs-3g defaults 0 0

Step6: Save and close file.

Step7: Open terminal and issue this command →

Terminal Code:

sudo mount -a

MORE INFO

If you are interested to learn more and want to go deep into this, visit these links for more detail in the ubuntuforums and help.ubuntu.com

Priyanka Naskar Majumder - the Owner, Eyedea LAB. Graphic & Web Design Studio, lives in Kolkata, India. Interested in: Usability research, Graphic Design, Web Design & Development.

One Comment

  • If navigating to a partition’s mount point seems inconvenient, even with the links on the left of Gnome’s file browser, a link can be placed on the desktop, or anywhere else, for that matter.

Leave a comment.

Please do not spam and all * fields are required.

Allowed HTML tags: <strong> <em> <pre> <code> <a href="" title="">

Email *
http://

Send us your requirements

×
My Contact Form
Your name is required
Email is required
Please write a message

Please leave this field empty.

All fields are required