Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I use Ubuntu 11.10 and Windows7 dual boot with Ubuntu as my primary OS.

Every time I need to access a document I need to mount the respective drive, though this is not at all tiresome, still, is there any way that drives becomes automatically mounted when I login?

share|improve this question
add comment

6 Answers

up vote 20 down vote accepted

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.

share|improve this answer
1  
Thank you. Your answer helped. –  missingfaktor Aug 22 '12 at 12:17
    
Is running this command on startup better than adding an entry to /etc/fstab? –  Dan Sep 3 '13 at 7:25
    
If adding to startup works, you don't have to add it in /etc/fstab –  Anwar Shah Sep 3 '13 at 7:41
add comment

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

share|improve this answer
    
Btw, at least in Xubuntu, it's a bit different: udisksctl mount -b /dev/disk/by-uuid/THE_UUID. udisksctl is in the udisks2 package and I don't have a udisks package. –  janos Mar 29 at 7:42
add comment

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

share|improve this answer
add comment

You could do this directly with the mount command.

Edit /etc/rc.local. This gets executed at startup after boot as root:

gksudo gedit /etc/rc.local

and put the mount code inside:

mount_at="/media/OS"
partition="/dev/sda3"

if [ ! -d $mount_at ] #create mound directory if it doesn't exist
then
  mkdir $mount_at
fi

mount -t ntfs $partition $mount_at

where $mount_at is the folder where you want to mount to, and $partition is the name of the partition. My windows partition is at "/dev/sda3" and not "/dev/sda1" because I have a Dell with other small system partitions. To check what is the name of your windows partition do:

sudo fdisk -l

which for me gives

Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048      206847      102400   de  Dell Utility
/dev/sda2   *      206848    30926847    15360000    7  HPFS/NTFS/exFAT
/dev/sda3        30926848   540132512   254602832+   7  HPFS/NTFS/exFAT
/dev/sda4       540133374   625141759    42504193    5  Extended
/dev/sda5       540133376   619132927    39499776   83  Linux
/dev/sda6       619134976   625141759     3003392   82  Linux swap / Solaris

So /dev/sda3 is the largest NTFS partition, probably the one you want.

share|improve this answer
add comment

simple - method is to install the pysdm package (in Gutsy) and then use System-Administration-Storage Device Manager without any manual editing of the fstab file, and disregard most of the instructions that follow.

check this site for any doubts

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.