This page looks best with JavaScript enabled

Automatically mount NTFS partition on boot

 ·  ☕ 3 min read  ·  ✍️ noel

To mount ntfs partitions we need to specify where we want to mount those partitions. By default, when you mount any partition/plug in any flash drive/insert a cd, it is mounted in /media/ directory. So we’ll create a directory in /media/.
Step 1 : Create directories
sudo mkdir /media/directory name
replace “directory name” with the name of the directory you want to create.
I want to create a directory named data, so I will….
sudo mkdir /media/data
Now we need to get a list of all the partitions, this command will do just that.
Step 2 : get list of all partitions in all hard drives
sudo fdisk -l
Here is the output on my pc.
noel@Daedalus:~$ sudo fdisk -l [sudo] password for noel:
Disk /dev/sda: 40.0 GB, 40020664320 bytes 255 heads, 63 sectors/track, 4865 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000becdb
Device    Boot Start  End    Blocks     Id     System /dev/sda1 *    1      1305   10482381   7      HPFS/NTFS /dev/sda2      1306   4864   28587667+  f W95  Ext'd (LBA) /dev/sda5      1306   4864   28587636   7      HPFS/NTFS
Disk /dev/sdb: 10.2 GB, 10242892800 bytes 255 heads, 63 sectors/track, 1245 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x03640363
Device    Boot Start End    Blocks    Id   System /dev/sdb1      1     1147   9213246   83   Linux /dev/sdb2      1148  1153   48195     83   Linux /dev/sdb3      1154  1245   738990    82   Linux swap / Solaris
Now, the partition I want to mount at startup is /dev/sda5.
For that, we need to edit /etc/fstab file. This file holds the configurations of all the partitions that are mounted during boot. So DO NOT remove anything(unless you know what you are doing). All you need to do is to add one line(if you want to mount more than one ntfs partition you’ll need to add one line per partition).
Step 3 : editing /etc/fstab
Now the syntax of a fstab entery is like this :
[Device] [Mount Point] [File System Type] [Options] [Dump] [Pass]
note: options in the fstab entery & option parameters in mount command are similar.
in terminal, issue this command :
sudo gedit /etc/fstab
Here, gedit is the name of the text editor i use, you can replace it by the name of whicever editor you use(like nano or vi).
add following line at the end of the file.
/dev/xxxx /media/directory name ntfs defaults,users 0 0
& replace the xxxx with the partition you want to mount, & directory name with the name of the directory you created in the first step.
so mine will look like this…
/dev/sda5 /media/data ntfs defaults,users 0 0
here defaults & users are options. If you want to know more about all the options you can read it in manual of mount command.
man mount
save file, partiotion should auto mount the next time you boot.
you can read more about fstab here : http://help.ubuntu.com/community/Fstab

Share on

What's on this Page