Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
141
rated 0 times [  141] [ 0]  / answers: 1 / hits: 481886  / 3 Years ago, fri, november 19, 2021, 12:37:17

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 RW 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

More From » fstab

 Answers
0

Permissions for ntfs and vfat file systems must be set with the dmask, fmask and umask options. dmask controls permissions for directories, fmask controls permissions for files, and umask 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 and gid options for user and group, respectively. You can find your UID with the command id -u. To find your GID, use id -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 to drwxr-x---.


Here are examples of a working /etc/fstab


UUID=EEA2B69CA2B668AB        /WIN_C     ntfs-3g   defaults,nls=utf8,umask=000,dmask=027,fmask=137,uid=1000,gid=1000,windows_names 0 0 
UUID=65AEC0E830EA0497 /WIN_D ntfs-3g rw 0 0


  • To get the UUID for your partition, you can use ls -l /dev/disk/by-uuid/ or lsblk -f | grep -v loop or gnome-disks



  • If you get no visible error after rebooting and partitions stay readonly or you get an error similar to:




    Error mounting /dev/sda6 at /media/WindowsDrive: 
Command-line `mount -t "ntfs" -o "uhelper=udisks2,nodev,nosuid,uid=1000,gid=1000,dmask=0077,fmask=0177" "/dev/sda6" "/media/rolindroy/Media Center"' exited with non-zero exit status 14: The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
Failed to mount '/dev/sda6': Operation not permitted The NTFS partition is in an unsafe state.
Please resume and shutdown Windows fully (no hibernation or fast restarting), or mount the volume read-only with the 'ro' mount option

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".


UUID=01D9318DD8A39810  /run/media/$user/Win11   ntfs-3g uid=$user,gid=$user,umask=0022 0 0
UUID=01D9317B8D647610 /run/media/$user/Storage ntfs-3g uid=$user,gid=$user,umask=0022 0 2

In the above example win11 will be mounted read-only, while Storage as read-write.


& they will be visible in file manager as drives Since they are mounted in folder /run/media/$user
Also don't forget to replace $user with your username.


[#39805] Saturday, November 20, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brasiplacar

Total Points: 314
Total Questions: 124
Total Answers: 97

Location: Dominican Republic
Member since Wed, Mar 17, 2021
3 Years ago
brasiplacar questions
Sat, Sep 4, 21, 13:11, 3 Years ago
Tue, Jan 10, 23, 06:22, 1 Year ago
Wed, Oct 13, 21, 15:19, 3 Years ago
Wed, May 4, 22, 00:06, 2 Years ago
Thu, Jan 5, 23, 15:40, 1 Year ago
;