1

I used to access my NAS via Caja or some other GUI file managers. When I copied a file, the date modified on the target was the same as the source file copied.

Now, I mount my NAS via the command line. But, now, the date modified on the target takes on the current system date and time at the time of copying.

What option can I add or remove to my mount statement so that the date modified on the target takes on what the source file is?

The mount command I use is:

sudo mount -t cifs -o username=<username>,password=<password> //<ip address>/directory /<mount point>

Results of mount -l is:

//<ip address>/<directory> on /media/dnas type cifs (rw,relatime,vers=1.0,cache=strict,username=<username>,domain=<NAS domain>,uid=0,noforceuid,gid=0,noforcegid,addr=<ip address>,unix,posixpaths,serverino,acl,rsize=1048576,wsize=65536,actimeo=1)
4
  • 1
    First things first: how are you copying the files? For example if using cp without -p then it is expected that the modification time is not copied to the destination file. For the most reproducible result, please use cp -p to copy the file and check if the mod time is preserved.
    – Celada
    Jan 17, 2015 at 12:23
  • 1
    Did you use the same GUI manager to copy after mounting, or do you copy from the commandline?
    – Anthon
    Jan 17, 2015 at 12:23
  • Thanks Celeda, adding the -p eventually led me to the solution: I got an error message with something like Operation not permitted. So, I looked it up on Google and found something on Arch Linux. Forum users said to mount it with uid=<my local username> and gid=<my group id>. I did that and still got an error. Then I read up on cp and used --preserve=timestamps only. Then it worked. I'm not sure -p doesn't work even though it's mounted with my uid and gid, but, the --preserve=timestamps does what I want for now.
    – linstar
    Jan 18, 2015 at 2:59
  • I figured out that -p causes an error statement (even though it actually copies) due to the mode attribute. When I copy with --preserve=[timestamps|ownership], there are no issues, but, when I use mode, I get the error. Since -p includes mode, I believe that's causing the issue.
    – linstar
    Jan 19, 2015 at 12:05

0

You must log in to answer this question.

Browse other questions tagged .