How to Auto Mount NTFS Partitions at startup on Ubuntu Linux
Auto Mount NTFS Partitions at startup on Ubuntu Linux.
Lets suppose You have 2 NTFS partition in windows C Drive and D Drive.
If you want Ubuntu to auto mount these drives when you start Ubuntu then do the following.
First create the folders c_drive, d_drive in your root.
sudo mkdir /c_drive sudo mkdir /d_drive
Select your ntfs partitions (Volumes) and one by one and note down the device name of all. Lets suppose your C Drive partition is 96 GB. Then select the label that is labeled as (File System Partition … 96 GB NTFS). When you click on it, it will display some information related to your partition (volume). Note down the device name in front of label ‘Device’ (like
/dev/sda2). This is path of your C Drive that Ubuntu has specified. Note down the path.
Create a file
/etc/rc.local and make it executable using below commands
sudo touch /etc/rc.local sudo chmod +x /etc/rc.local
Now open the file
/etc/rc.local in a text editor with root permission. My favourite is gedit.
sudo gedit /etc/rc.local
In the file
/etc/rc.local paste the following lines before ‘exit 0’
sudo mount /dev/sda2 /c_drive sudo mount /dev/sda3 /d_drive
Basically commands written inside
/etc/rc.local file will be executed at startup. We can execute sudo commands from here at startup.
/dev/sda3 are the paths of c drive and d drive in my system. You have to put the paths (that you noted / found in previous steps through
disks app ) of c drive and d drive of your own system
So our final
/etc/rc.local will look something like this
#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. sudo mount /dev/sda2 /c_drive sudo mount /dev/sda3 /d_drive exit 0
Save and exit and restart that’s it.
Now you will find your c drive contents inside /c_drive directory and d drive contents inside /d_drive directory. You can bookmark these locations in your nautilus (ctrl + D) for faster access. Bookmarks are a great way in Nautilus to directly go to any of your favourite location.