Page 1 of 1

How to mount NTFS partition so I have ownership?

Posted: Tue Mar 05, 2019 1:29 am
by adpace
I just built my first Linux box with Mint 19.1 Cinnamon. I used a windows pc that has 2 hard drives that were both ntfs. I formatted the c drive and successfully installed Mint. It shows me as the owner of the drive, and everything is great. The second drive however shows as root owner. My account name is ari. I've tried
sudo chown ari:ari /media/ari/[the name of the drive] -R
sudo chown ari:ari /media/ari/[the name of the drive] -R -v
sudo chown ari: /media/ari/[the name of the drive] -R

The terminal shows the hard drive and all of it's directories being updated with no failure message. It successfully returns to a ready command prompt. It is not changing the ownership however. I can cd into it and and ls -l and see ownership as root, no matter what I try. Every thread I've read says the same thing, but it's not working. I can see the drive from linux (it is read only), I have no trouble getting it to automatically mount.

I spoke with a buddy who said he came across this an vaguely remembers it being how the drive was mounting in his case. Any help would be greatly appreciated, I'm pulling my hair out with this one!

Re: How to mount NTFS partition so I have ownership?

Posted: Tue Mar 05, 2019 8:56 am
by WharfRat
Hello adpace Image

Welcome to Linux Mint and the Linux Mint forum :)

You can chown and chmod til the cows come home and owner:group and permissions will not change because the NTFS file system does not store that information.

There are mount options uid=1000,gid=1000 to set the owner:group and dmask=002,fmask=111 to set permissions.

Basically they are faked via the ntfs-3g NTFS driver mount options.

So mount -t ntfs-3g -o defaults,noatime,utf8,dmask=002,fmask=111,uid=1000,gid=1000 /device /mointpoint will allow read/write

Good luck :wink:

Re: How to mount NTFS partition so I have ownership?

Posted: Tue Mar 05, 2019 11:50 pm
by adpace
Awesome, going to give this a try. I'll let you know how it turns out. Thanks again!

Re: How to mount NTFS partition so I have ownership?

Posted: Thu Mar 07, 2019 5:18 am
by adpace
Can you elaborate a bit on the /device and /mountpoint ? I'm not able to get it to work. I've tried a few combinations, but get different errors.
/media/ari/6E2EA16F2EA1314F is the hard drive. I've tried:

Code: Select all

 sudo mount -t ntfs-3g -o defaults,noatime,utf8,dmask=002,fmask=111,uid=1000,gid=1000 /6E2EA16F2EA1314F /media/ari
ntfs-3g: Failed to access volume '/6E2EA16F2EA1314F': No such file or directory

Code: Select all

sudo mount -t ntfs-3g -o defaults,noatime,utf8,dmask=002,fmask=111,uid=1000,gid=1000 /media/ari/6E2EA16F2EA1314F
mount: /media/ari/6E2EA16F2EA1314F: can't find in /etc/fstab.

Code: Select all

sudo mount -t ntfs-3g -o defaults,noatime,utf8,dmask=002,fmask=111,uid=1000,gid=1000 /6E2EA16F2EA1314F /media/ari/6E2EA16F2EA1314F
ntfs-3g: Failed to access volume '/6E2EA16F2EA1314F': No such file or directory
Thanks again for your help!

Re: How to mount NTFS partition so I have ownership?

Posted: Thu Mar 07, 2019 7:52 am
by AndyMH
On my dual boot desktop I mount my NTFS partitions in mint in fstab (so they are mounted automatically), the entries are:

Code: Select all

# mount point for windows D:
UUID=1A7C80714BFAF6B2 /home/andy/data           ntfs    windows_names,auto,users,uid=1000,gid=1000,noatime        0       2
# mount point for windows C:
UUID=40E45A0AE45A0298 /home/andy/win10           ntfs    windows_names,auto,users,uid=1000,gid=1000,noatime        0       2
fstab lives in /etc and has to be edited as root (navigate to /etc in your file manager, right click and select open as root). You can find out the UUID of the partitions by typing blkid in a terminal.

I've mounted mine in home but you can mount them wherever you like.

Re: How to mount NTFS partition so I have ownership?

Posted: Thu Mar 07, 2019 9:28 am
by WharfRat
adpace wrote:
Thu Mar 07, 2019 5:18 am
Can you elaborate a bit on the /device and /mountpoint ? I'm not able to get it to work. I've tried a few combinations, but get different errors.
/media/ari/6E2EA16F2EA1314F is the hard drive. I've tried:
The device is its designation e.g, /dev/sda1 or /dev/sda2 etc.etc.

The mountpoint is the folder you would mount the NTFS filesystem to. e.g., /media/NTFS or /media/windows ect.,ect.

If you follow AndyMH advice and mount it from /etc/fstab it will make things easier.

So if your device designation is /dev/sda2 and you create the folder /media/windows you would enter the following to mount it

Code: Select all

sudo mount -t ntfs-3g -o defaults,noatime,utf8,dmask=002,fmask=111,uid=1000,gid=1000 /dev/sda2  /media/windows

Re: How to mount NTFS partition so I have ownership?

Posted: Thu Mar 07, 2019 5:45 pm
by adpace
Getting closer but got this...

Code: Select all

ari@linux-mint-server:~$ sudo mount -t ntfs-3g -o defaults,noatime,utf8,dmask=002,fmask=111,uid=1000,gid=1000 /dev/sda1 /home/ari/Storage
Mount is denied because the NTFS volume is already exclusively opened.
The volume may be already mounted, or another software may use it which
could be identified for example by the help of the 'fuser' command.
unmounted the drive, then got this...

Code: Select all

ari@linux-mint-server:~$ sudo mount -t ntfs-3g -o defaults,noatime,utf8,dmask=002,fmask=111,uid=1000,gid=1000 /dev/sda1 /home/ari/Storage
The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
Falling back to read-only mount because the NTFS partition is in an
unsafe state. Please resume and shutdown Windows fully (no hibernation
or fast restarting.)
This drive was in a windows box, but is not anymore. It is just a secondary drive on my linux machine now, which holds my media.

Re: How to mount NTFS partition so I have ownership?

Posted: Thu Mar 07, 2019 6:02 pm
by adpace
I ran...

Code: Select all

sudo ntfsfix /dev/sda1
and that fixed it. I can now mount the drive with read write permissions and access it from my windows pc on the network. Thank you guys so much for your help, I couldn't have gotten this working without it! :D

For anyone else running into the ntfs issue, this was the post I found that helped with it...
https://askubuntu.com/questions/145902/ ... ibernation

Re: How to mount NTFS partition so I have ownership?

Posted: Fri Mar 08, 2019 7:10 am
by AndyMH
Hah... a windows problem. One of the first things I did when I set up my desktop dual boot with win10 was switch off hiberfil.sys. If nothing else it was a multi-GB file.

Re: How to mount NTFS partition so I have ownership?

Posted: Wed Mar 27, 2019 12:12 pm
by Alx_Blanco
Hi guys,
I followed step by step the solution you posted -Im struggling with the same thing- when I ran "sudo ntfsfix /dev/sda1" send me the following error message:

Mounting volume... Windows is hibernated, refused to mount.
FAILED
Attempting to correct errors...
Processing $MFT and $MFTMirr...
Reading $MFT... OK
Reading $MFTMirr... OK
Comparing $MFTMirr to $MFT... OK
Processing of $MFT and $MFTMirr completed successfully.
Setting required flags on partition... OK
Going to empty the journal ($LogFile)... OK
Windows is hibernated, refused to mount.
Remount failed: Operation not permitted

I read that AndyMH mentioned that he had "Switch Off" hiberfil.sys on Windows, how do you did it??
Im not Windows expert either,

thanx in advance

Re: How to mount NTFS partition so I have ownership?

Posted: Wed Mar 27, 2019 2:34 pm
by AndyMH
Google hiberfil.sys, this is just one:
https://www.techrepublic.com/blog/tr-do ... -function/
Also check in your BIOS that fast boot is disabled.

Re: How to mount NTFS partition so I have ownership?

Posted: Fri Mar 29, 2019 11:31 am
by Mark Phelps
It's more likely Fast Startup -- which is a Win10 feature -- as that enables Hibernation by default.

Fast Boot is similar, but is a BIOS/UEFI option, not a Windows option.

Re: How to mount NTFS partition so I have ownership?

Posted: Fri Jul 26, 2019 11:50 am
by rushiloke7
WharfRat wrote:
Tue Mar 05, 2019 8:56 am

So mount -t ntfs-3g -o defaults,noatime,utf8,dmask=002,fmask=111,uid=1000,gid=1000 /device /mointpoint will allow read/write
This command is working. But now I want to run it on startup?

I tried running this command from "Startup Application" but it failed. Probably because of root access. Is there a simple fix for this?

Re: How to mount NTFS partition so I have ownership?

Posted: Fri Jul 26, 2019 12:08 pm
by ajgringo619
You should add it to your /etc/fstab, like this:

Code: Select all

/device /mountpoint ntfs defaults,noatime,utf8,dmask=002,fmask=111,uid=1000,gid=1000 0 0