Mount NTFS with normal rights management, and time

This forum is dedicated to basic help and support :

Ask here your questions about basic installation and usage of Mageia. For example you may post here all your questions about getting Mageia isos and installing it, configuring your printer, using your word processor etc.

Try to ask your questions in the right sub-forum with as much details as you can gather. the more precise the question will be, the more likely you are to get a useful answer

Mount NTFS with normal rights management, and time

Postby morgano » Feb 8th, '15, 13:21

This is for a dual boot machine MS W7 / mga5.
As Microsoft dont support standard file systems we need to use a NTFS partition for files both OS can use.
So i have a standard partition formatted NTFS, in W7 it is "D:", mga5 use ntfs-3g and it is /media/win_d/
It is very nice /media/win_d/ shows up in Dolphin directly after install with no manual fussing.

Problem is the rights management.
Any mageia user can read and write, owner is root, and it can not be changed (chown fails silently)

I have no problem with any user can read and write (other might)
The hard problem is that when in mageia any file i copy to it using cp -a, a file synchronising thingy (synkron/freefilesync), or ownCloud, all files copied to the NTFS get the current time.
Not only do it mess up history for both myself, file listing, and and some programs, also the file syncing kicks back all files as new versions propagaring through file synchronisers and cloud back to pushing date changed but identical files down to the original sharer making mess there too.

I guess the used method to mount NTFS is made to risk hurting the windows aspects of file system as little as possible.

I googled a bit and one method is to mount the whole NTFS partition as a specific user, this seem to be the traditional solution. In fstab:
Code: Select all
<UUID here> /media/win_d ntfs-3g defaults,umask=002,uid=1000 0 0
Of course then all is owned by one user. Other can access it as group members, providing rights are set for that - the umask.
Not bad. I did not test.

It can also be mounted by the user who need it using udisks, example
Code: Select all
/usr/bin/udisks --mount /dev/sda3
and that may be added to some script run by user login by i.e KDE or gnome i presume. I did not test.

I am trying a more automated method - it seem we can have it handle owner and rights as normal from the linux side.
Code: Select all
<UUID here> /media/win_d ntfs-3g permissions,users,auto,exec 0 0
...unmounted and mounted it as root and executed
Code: Select all
umount /media/win_d
mount /media/win_d
chown -R me:users /media/win_d/
And it seem to work as expected on the linux side :)
More intelligently I could have chosen to have different subfolders there for each user, like it is under /home
Windows said trash was corrupt and tried to rebuild but in the end asked if OK to empty cache, OK.

I did not dare trying it on C: and i do not need it there - i specifically made D: for all data (and windows swap) to keep C: small for partition image backup reasons, and not toutched by anything but MSwindows so i know what to blame. (well, the "small" failed...)

What all this rant is about

§ Can we as default make NTFS from linux side to handle normal linux owner and standard rights, wihtout causing havoc on the windows side?

§ Can the default be improved at least the little bit so time on files copied to NTFS can be preserved? (without risking any havoc on windows side)
- At least *I* would think that be a great improvement, and cause less hairpulling around the globe - just think environmentally ;)

Some links:
http://askubuntu.com/questions/92863/mo ... r-as-owner
https://wiki.archlinux.org/index.php/NTFS-3G
http://linux.die.net/man/8/mount.ntfs-3g
http://www.tuxera.com/community/ntfs-3g-manual/
At home & work Mandriva since 2006, Mageia 2011. Thinkpad T40, T43, T60, T400, T510, Dell M4400, M6300, Acer Aspire 7. Workstation using LVM, LUKS, VirtualBox, BOINC
morgano
 
Posts: 1493
Joined: Jun 15th, '11, 17:51
Location: Kivik, Sweden

Re: Mount NTFS with normal rights management, and time

Postby doktor5000 » Feb 8th, '15, 18:19

morgano wrote:§ Can the default be improved at least the little bit so time on files copied to NTFS can be preserved? (without risking any havoc on windows side)

If you create a new file as target of a cp operation, the time of creation is used by default as timestamp, this is the same for linux filesystems.
If you want to preserve the timestamp then use e.g. --preserve=timestamps option for cp.

So if you want to preserve permissions, ownership and timestamps you need to use cp -p which is the short form of --preserve=mode,ownership,timestamps
Or you can use a tarball, that is what I'm doing when creating a selective backup of my /home and writing it to an NTFS drive, but for different reasons (to preserve directory structure of many files, and for easy verification of all files).

For the other question about using permissions option to mount ntfs partitions by default, you should probably create a bugreport as enhancement request.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18060
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Mount NTFS with normal rights management, and time

Postby jiml8 » Feb 8th, '15, 21:41

morgano wrote:The hard problem is that when in mageia any file i copy to it using cp -a...


doktor5000 wrote:If you create a new file as target of a cp operation, the time of creation is used by default as timestamp, this is the same for linux filesystems.
If you want to preserve the timestamp then use e.g. --preserve=timestamps option for cp.


Code: Select all
jiml@dadsbox:jiml> man cp

...
 -a, --archive
              same as -dR --preserve=all
...
jiml8
 
Posts: 1254
Joined: Jul 7th, '13, 18:09

Re: Mount NTFS with normal rights management, and time

Postby doktor5000 » Feb 8th, '15, 22:28

Seems I've overlooked the -a.
But I've tried explicitly with --preserve=timestamps and it works, the timestamp of the original file is preserved on the NTFS partition.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18060
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Mount NTFS with normal rights management, and time

Postby morgano » Feb 9th, '15, 00:56

weird it did not work here... what is your fstab line, doctor?

Anyhow i also noted owncloud client failed to set correct time and sync went bananas.
The system now mount the NTFS win_d usin g
Code: Select all
<UUID= or /dev/something etc here> /media/win_d ntfs-3g soft,uid=username,gid=users,umask=0022 0 0

ownCloud now syncs OK *)
All members of group users can read and write correctly i presume, although all files will seem to belong to that user.
I guess that is how it needs to be in order to avoid disturbing windows side of access rights.

If done by the installer, username can be the user that got registered at install, or simply 1000?
And yes i added soft too as i think it should be on all non critical mounts like also swap, and network mounts like NFS etc - it is easier to fix system if it starts.

*) Well the files get right time, but downcopied folders get current time - however that is how ownCloud do also in my ext4 home so it is some internal misfeature.
At home & work Mandriva since 2006, Mageia 2011. Thinkpad T40, T43, T60, T400, T510, Dell M4400, M6300, Acer Aspire 7. Workstation using LVM, LUKS, VirtualBox, BOINC
morgano
 
Posts: 1493
Joined: Jun 15th, '11, 17:51
Location: Kivik, Sweden

Re: Mount NTFS with normal rights management, and time

Postby doktor5000 » Feb 9th, '15, 08:15

morgano wrote:weird it did not work here... what is your fstab line, doctor?

Pretty much the default from the installer, apart from the obvious nofail which I've added.

Although the mount in question does not have any fstab entry, as it's mounted via dolphin:

Code: Select all
┌─[doktor5000@Mageia5]─[07:11:37]─[~]
└──╼ mount
[...]
/dev/sda2 on /run/media/doktor5000/EXTERN5 type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,uhelper=udisks2)
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18060
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Mount NTFS with normal rights management, and time

Postby morgano » Feb 9th, '15, 11:11

The fstab i got during install had this line:(and a similar for win_c)
Code: Select all
UUID=something /media/win_d ntfs-3g defaults,umask=000 0 0


Fresh install this autumn from cauldron DVD iso, but first I partitioned using gparted then installed windows, then mageia.
I do not remember editing anything from defaults, just picked partitions.
At home & work Mandriva since 2006, Mageia 2011. Thinkpad T40, T43, T60, T400, T510, Dell M4400, M6300, Acer Aspire 7. Workstation using LVM, LUKS, VirtualBox, BOINC
morgano
 
Posts: 1493
Joined: Jun 15th, '11, 17:51
Location: Kivik, Sweden

Re: Mount NTFS with normal rights management, and time

Postby doktor5000 » Feb 9th, '15, 20:31

My fstab mounts look the same, but I didn't try with them yet.

Code: Select all
┌─[doktor5000@Mageia5]─[19:24:47]─[~]
└──╼ grep -B1 ntfs /etc/fstab
# Entry for /dev/sda1 :
UUID=E4C06EF3C06ECAFE /media/win_c ntfs-3g nofail,defaults,umask=000 0 0
# Entry for /dev/sda2 :
UUID=7CDA724CDA7202A6 /media/win_d ntfs-3g nofail,defaults,umask=000 0 0


┌─[doktor5000@Mageia5]─[19:30:30]─[~]
└──╼ LC_ALL=C cp -a tobackup.sh /media/win_d
cp: preserving times for '/media/win_d/tobackup.sh': Operation not permitted


So to preserve filestamps you need root access with the default mount options, just tested.


doktor5000 wrote:Although the mount in question does not have any fstab entry, as it's mounted via dolphin:
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18060
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Mount NTFS with normal rights management, and time

Postby morgano » Feb 10th, '15, 01:16

Ummm I am not fully following the jargon, but the end result here is owncloud client failed to set right file times on a default system, but suceedes since i changed the line in fstab to
Code: Select all
/dev/sda5 /media/win_d ntfs-3g soft,uid=myname,gid=users,umask=0022 0 0
At home & work Mandriva since 2006, Mageia 2011. Thinkpad T40, T43, T60, T400, T510, Dell M4400, M6300, Acer Aspire 7. Workstation using LVM, LUKS, VirtualBox, BOINC
morgano
 
Posts: 1493
Joined: Jun 15th, '11, 17:51
Location: Kivik, Sweden

Re: Mount NTFS with normal rights management, and time

Postby doktor5000 » Feb 10th, '15, 20:19

Effectively you changed the ownership of the mountpoint with that, so it doesn't require root permissions anymore.
Isn't your initial query solved with that?

Apart from that, we cannot change the default mount options in fstab to any user.
Although for for the permissions options, see my previous comment.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18060
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Mount NTFS with normal rights management, and time

Postby morgano » Feb 11th, '15, 01:20

doktor5000 wrote:Effectively you changed the ownership of the mountpoint with that, so it doesn't require root permissions anymore.
Isn't your initial query solved with that?

For my own use, yes.
Apart from that, we cannot change the default mount options in fstab to any user.

I wanted to see if the default could be changed to give least headache.

Sidenote: i just realised ntfs-3g for some odd reason hickups occasionally when using owncloud client, others have found too: https://github.com/owncloud/client/issues/1143 , my name there is Morganleij .

EDIT: It is caused by windows by default saving each tha thave odd characters or long named under two names for 8dot3 compatibility, thus some apps like owncloud see them as hard links and refuse to sync. How to turn off: see my notes down in http://forum.owncloud.org/viewtopic.php ... 867#p78867
At home & work Mandriva since 2006, Mageia 2011. Thinkpad T40, T43, T60, T400, T510, Dell M4400, M6300, Acer Aspire 7. Workstation using LVM, LUKS, VirtualBox, BOINC
morgano
 
Posts: 1493
Joined: Jun 15th, '11, 17:51
Location: Kivik, Sweden


Return to Basic support

Who is online

Users browsing this forum: No registered users and 1 guest