I have two partitions that I want to mount on startup:
/dev/sda3 /mnt/devel ext4 defaults 0 2
/dev/sda2 /mnt/excess ntfs defaults 0 2
The ext4
partition mounts fine (owned by me, writable only by me), but the NTFS
mounts owned by root
with R\W permission for all.
How to fix this?
drwxr-xr-x 7 amanda amanda 4096 2012-03-14 19:07 devel
drwxrwxrwx 1 root root 4096 2012-03-14 22:38 excess
Permissions for ntfs and vfat file systems must be set with the
dmask
,fmask
andumask
options.dmask
controls permissions for directories,fmask
controls permissions for files, andumask
controls both. Since these options set masks, they should be the complement of the permissions you want. For example, rwx for the owner and rx for others is 022 rather than 755.To set the owner, use the
uid
andgid
options for user and group, respectively. You can find your UID with the commandid -u
. To find your GID, useid -g
. These values are both usually 1000.A common set of mount options for ntfs is
uid=1000,gid=1000,dmask=027,fmask=137
. This sets you as the owner of the drive, and sets the permissions todrwxr-x---
.Here are two lines from my /etc/fstab working
If you get no visible error after rebooting and partitions stay readonly or you get an error similar to:
This is because Windows 8 and 10 offer a "Fast Startup" option that depends on a "non-complete" shutdown. You can disable fast startup by following these steps under "Power Options".
If you mount the ntfs partition with the permissions option, then chmod / chown will work
You can then
Easier then uid,dmask,fmask.
I had some trouble with this because when I reboot the disk name changes... (sda0 to sdb2)
I fixed the problem by mounting them by UUID in the fstab, you can view the UUID for your harddrives by entering:
sudo blkid
Make a back-up of your fstab file:
Make sure you tripple check the >>, if you place one > you overwrite your fstab!
If you still screwed up you can replace your fstab with the original:
Next make a folder:
Configure the fstab:
Don't forget to comment the output from the blkid with a '#' on the beginning of the lines!
Add this to the fstab file, you can find the UUID in the block on the bottom you inserted with the command above. media/mydrivename is where the partition should be mounted.
This is my fstab file:
Reboot the system by typing:
To check if the partition is mounted you can type
df -k
.Give ownership to yourself:
Did this on Ubuntu Server 14.04.01!
Hope this answer helps someone ;-)
You can use ntfs-config GUI utility to mount NTFS partitions in fstab.
ntfs-3g
driver is required to provide full read-write support for the NTFS partition and gksu to run NTFS Configuration GUI with root privileges.Search for and open ‘NTFS Configuration Tool’ from the Unity Dash. In the window that appears select the partitions you want to configure. Here, I would prefer to have only my storage partition mounted. Just tick ‘Enable write support for internal device’.
NTFS-Config Utility will backup the original fstab file, so we can easily review the changes that were made by the application. To review the changes,
I use the following that I find correctly gives me permissions upon mount (NTFS drive from a dual-boot system setup):
Edit
/etc/fstab
:UUIDs can be found in
/dev/disk/by-uuid/
(usually map to/dev/sd*
)Replace
<your uuid>
with your UUIDUUID=<your uuid> /mnt/e ntfs auto,users,uid=1000,gid=1000,dmask=027,fmask=137 0 0
Might not be a good solution , but you can always map user id to your own one , or the group id:
Just an example here , my user id was 1000
/dev/sda5 /mnt/excess ntfs defaults,uid=1000,rw 0 0
In that case , all files mounted owned by user ided 1000
Note that if you mount your ntfs drive using a label and wish to be able to change the permissions of directories or files on this drive then the following works well (edit the /etc/fstab e.g. sudo nano /etc/fstab and then add):
Whereas the below would NOT allow you to change permissions of directories or files: