Mount NTFS Partition on Startup in Ubuntu
Solution 1
The line in /etc/fstab
in your case would be something like:
/dev/sda4 /media/A476FC2E76FC033A ntfs-3g uid=1000,gid=1000,umask=077,fmask=177
You may want to change some of these:
- You can replace
/dev/sda4
by the UUID of the filesystem. Using a UUID has the advantage that if you ever plug in another disk which causes your current disk to appear as/dev/sdb
, the fstab entry would still work. - You can replace the mount point (second column) by a more meaningful name. Pick any empty directory. Note that the directory must exist.
- Replace
uid=1000,gid=1000
by your user ID and group ID (you can see them with the commandsid -u
andid -g
). These options cause all files to be owned by you, ignoring Windows file ownership (I don't think you can retain Windows file ownership with ntfs-3g). -
umask=077
causes files to be accessible only to you, not other users.umask=007
would cause files to be accessible only to you and other users in the group specified bygid
.umask=0
(the default) allows anyone to read and write all files.umask=022
allows anyone to read but only you to write. -
fmask=177
makes files non-executable even to you. - You may want to add other options.
- You can add two more columns
0 0
at the end, but they're optional. I only mention them because you might find them in some examples.
See the fstab
man page for more information on the /etc/fstab
file.
Once you've written the line in /etc/fstab
, test it by running
sudo mount /media/A476FC2E76FC033A
The next time you reboot, the filesystem will be mounted automatically.
Solution 2
For those who want to do this with some mouse clicks, you could also just open Disks
. Select the partition you want to mount, click on the gears button and then select Edit Mount Options
as seen in the screenshot:
Then change to On
the Automatic Mount Option
and also check Mount on startup
:
That's it.
Disclaimer: this might be Ubuntu specific and I tested on Linux Mint. I know this is unix.stackexchange.com, but the question did mention Ubuntu as distribution.
Solution 3
The system should try to mount everything at boot in /etc/fstab
unless it's marked noauto
(in the fourth column, "options"). Check for that, and if it's there, remove it. Regardless, Ubuntu usually tries to mount drives as soon as the system finds them. Are you getting any warnings when you mount it manually? Also check whether there are any system error messages: dmesg | less
, (in less, you can use /
to search).
For more information on fstab
, go to a console and type man fstab
.
Related videos on Youtube
Zéychin
Updated on September 18, 2022Comments
-
Zéychin over 1 year
I have a 10 gigabyte partition which I use for files which I share between my Windows installation and my Oneiric Ocelet (Ubuntu) installation.
My Eclipse workspaces exist on this partition. Eclipse loads up fine in Windows. In Ubuntu, however, if I have not mounted the partition manually, I receive an error about being unable to open the workspace.
I know that that partition mounts to
/media/A476FC2E76FC033A
, is formatted as NTFS, and is the/dev/sda4
partition.I know that I can change Ubuntu's filesystem table via modifying
fstab
, but I do not understand all of the options involved in doing so and would like to do this correctly.I appreciate any assistance any of you may be able to give to me.
-
Admin over 12 yearsYou should read the Ubuntu documentation on mounting and writing to NTFS drives: help.ubuntu.com/community/MountingWindowsPartitions -- it includes the relevant
fstab
options.
-
-
Gilles 'SO- stop being evil' over 12 years@enzotib Windows has a notion of file owner, like unix (groups are more complicated). Come to think of it, I'm not sure that ntfs-3g supports mapping the Windows permissions onto unix: the manual says “the defaults are the uid and gid of the current process”, so I guess it doesn't.
-
Zéychin over 12 yearsWonderful. This works very well for me and explained the options that I needed. Thank you very much.
-
Zéychin over 12 yearsI appreciate this answer. The partition wasn't in fstab and Ubuntu was not automatically mounting it, but Gilles answer helped me insert the proper line into fstab. Still a +1 for the help.
-
user13107 about 11 years@Gilles Thanks, but following the above procedure I got
mount: only root can mount /dev/sda6 on /home/user/mountPoint
when I ran themount /home/user/mountPoint
command. Any idea why this might have happened? fstab contains/dev/sda6 /home/user/mountPoint ntfs rw,auto,uid=1000,gid=1000,umask=0,exec,fmask=0022 0 0
-
Gilles 'SO- stop being evil' about 11 years@user13107 If you want to allow non-root users to mount, add the
user
option (and presumably changeauto
tonoauto
to avoid mounting at boot time). -
Gilles 'SO- stop being evil' over 10 years@milkovsky That would change the ownership of all the files on the Windows partition. Windows is unlikely to like this.