1

I am customizing NFS v3 server. When I copy files from other location to NFS Drive on Linux, the copied file times are set to current time. I think, when copy is done, at least, create, modify are same as source file, but it does not work. I am using NFS v3 protocol.

For example: cp ./i686-linux-gnu-ar /mnt/nfs

/mnt/nfs : mount point

enter image description here

As you can see above screenshot, source file and copied file's time attribute are different.

enter image description here

In NFS server, I know SETATTR is used to set file attribute including time properties, but when I debug it, I couldn't get timestamp "Feb 20 2021" from SETATTR argument. Actually, The copied file time can be updated only if can get the timestamp ("Feb 20 2021"), I think.

Does anyone know about this? Thanks!

DotNetStar A
  • 123
  • 1
  • 7

1 Answers1

1

Have you tried the --archive aka -a option to the cp command?

-a, --archive
same as -dR --preserve=all

--preserve[=ATTR_LIST]
preserve the specified attributes (default: mode,ownership,timestamps), if possible additional attributes: context, links, xattr, all

Dan Bonachea
  • 2,408
  • 5
  • 16
  • 31
  • 1
    it seems like it is not code issue or nfs protocol leak as you mentioned. If I know more about linux command, i would not post this question. Let me check again and get back to you. Thanks! – DotNetStar A Dec 17 '22 at 04:26