Automatically mount NTFS drive when I login

Notice: If you are using Ubuntu 14.04 and later, Don't forget to check the note at the end of the answer


Go to the Startup Applications, by Clicking right-top corner Settings icon ---> Startup Applications.

enter image description here

The click on the Add button, Write a name for this operation such as "Mount ntfs drives", then in command input box, write this udisks --mount /dev/sda2, to automount the ntfs partition.

Note: You need to replace the /dev/sda2 with your actual NTFS partition number.

You can get this number by this command:

sudo blkid

Below is the output of this command in my computer.

/dev/sda1: UUID="89b18940-d5ff-4ce1-a85a-42cdd0369016" UUID_SUB="57d79ff6-7b53-44bc-82ec-ef783a23efc3" TYPE="btrfs" 
/dev/sda2: LABEL="Main" UUID="A80C1BD70C1B9F7E" TYPE="ntfs" 
/dev/sda3: LABEL="Work" UUID="01CCB271A80A07E0" TYPE="ntfs" 
/dev/sda5: LABEL="Free" UUID="CA9A-4F0A" TYPE="vfat" 
/dev/sda6: LABEL="Ubuntu" UUID="364126ac-01c9-4dd2-ab19-eecc733a9640" TYPE="ext4" 
/dev/sda7: LABEL="Free2" UUID="ed26eebb-524b-4533-869a-9dbd2b92bd64" TYPE="xfs" 
/dev/sda8: UUID="312d4cd9-21a9-4c0d-aa34-26230e70fa89" TYPE="swap" 

For Mounting with Executable permission

For those of you (like me) who wants to have executable permission to be set upon mounting, so that you can have options for execute a file with double-clicking , Add this extra bit of options with udisks command.

--mount-options=umask=022

So, the total line for /dev/sda2 should be like this (tested on 13.04)

udisks --mount /dev/sda2 --mount-options=umask=022

Caution: If you are a bit worried with security, you may choose not to have this functionality.


Note: Change for Ubuntu 14.04 and later

If you are using Ubuntu 14.04 or newer versions, You may notice that udisks packages is no longer available there. Yes, it is replaced by udisksctl package. So, You need to use udisksctl instead of udisks. It is basically do the same things, but syntax is more easier.

The mount command is --

udisksctl mount -b /dev/sda2 

(in the case your targeted partition is /dev/sda2) Here, -b is indicating that it is a block device

To enable executable permission ---

udisksctl mount -b /dev/sda2 -o umask=022

(Here -o indicating that following are options for udisksctl).

You can access the man page of udisksctl with man udisksctl command or read it online here!


The udisks command does the same thing as nautilus

It comes installed by default and doesn't require any changes to your system files.

just add something like:

/usr/bin/udisks --mount /dev/disk/by-uuid/1313-F422

to your startup list.

https://help.ubuntu.com/community/AutomaticallyMountPartitions#udisks


I think simply you can add your partition configuration to /etc/fstab as well.

Basically get the partition name from command line either through sudo blkid or sudo fdisk -l SO add to your /etc/fstab with gksu gedit

The entry should look like this:

/dev/sd[ab]# /path_to/mount_point ntfs-3g defaults 0 0

where path to mount point may be something like /home/YourUserName/Windows. You may need to mkdir Windows. Then you can access windows partition in Windows folder inside your Home folder