Setting the creation time of a file on a CIFS share

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I'm trying to replace an old Windows laptop I've been using as a "sneakernetting station" to copy files from NTFS-formatted hard drives to a Samba share using the WIndows robocopy utility. rsync is a more-than-capable replacement for robocopy, with one exception: it can't set creation timestamps, because historically Linux filesystems haven't supported them. CIFS shares certainly do, though, so I'm looking for a way to set the creation timestamps to fix them up after copying the files. (I already know how to get the creation time from NTFS.)



There are a few different questions here and on Super User about Linux creation times generally (1, 2, 3, 4, 5, 6), whose answers boil down to "Linux doesn't creation time". But I only need to set times for files on CIFS shares, and I'm willing to use filesystem-specific interfaces or a userspace program that talks directly to the server.



The statx system call reports the creation time (birth time) if available and requested, and the cifs filesystem does support this. However, as of February 2018, there is no Linux system call that allows setting the creation time.



The cifs filesystem also exposes creation time as the extended attribute user.cifs.creationtime, but this attribute is read-only because it is only checked for in cifs_xattr_get, not in cifs_xattr_set.



I can also access the share with the FTP-style smbclient program, and its allinfo command prints the creation time, but based on the man page and the command listing printed by the help command, there is no command to set any file timestamps.



How can I set the creation time of a file on a CIFS share?



(If it's currently not possible, there's no need to leave an answer saying so. Just leave the question unanswered.)







share|improve this question
























    up vote
    0
    down vote

    favorite












    I'm trying to replace an old Windows laptop I've been using as a "sneakernetting station" to copy files from NTFS-formatted hard drives to a Samba share using the WIndows robocopy utility. rsync is a more-than-capable replacement for robocopy, with one exception: it can't set creation timestamps, because historically Linux filesystems haven't supported them. CIFS shares certainly do, though, so I'm looking for a way to set the creation timestamps to fix them up after copying the files. (I already know how to get the creation time from NTFS.)



    There are a few different questions here and on Super User about Linux creation times generally (1, 2, 3, 4, 5, 6), whose answers boil down to "Linux doesn't creation time". But I only need to set times for files on CIFS shares, and I'm willing to use filesystem-specific interfaces or a userspace program that talks directly to the server.



    The statx system call reports the creation time (birth time) if available and requested, and the cifs filesystem does support this. However, as of February 2018, there is no Linux system call that allows setting the creation time.



    The cifs filesystem also exposes creation time as the extended attribute user.cifs.creationtime, but this attribute is read-only because it is only checked for in cifs_xattr_get, not in cifs_xattr_set.



    I can also access the share with the FTP-style smbclient program, and its allinfo command prints the creation time, but based on the man page and the command listing printed by the help command, there is no command to set any file timestamps.



    How can I set the creation time of a file on a CIFS share?



    (If it's currently not possible, there's no need to leave an answer saying so. Just leave the question unanswered.)







    share|improve this question






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I'm trying to replace an old Windows laptop I've been using as a "sneakernetting station" to copy files from NTFS-formatted hard drives to a Samba share using the WIndows robocopy utility. rsync is a more-than-capable replacement for robocopy, with one exception: it can't set creation timestamps, because historically Linux filesystems haven't supported them. CIFS shares certainly do, though, so I'm looking for a way to set the creation timestamps to fix them up after copying the files. (I already know how to get the creation time from NTFS.)



      There are a few different questions here and on Super User about Linux creation times generally (1, 2, 3, 4, 5, 6), whose answers boil down to "Linux doesn't creation time". But I only need to set times for files on CIFS shares, and I'm willing to use filesystem-specific interfaces or a userspace program that talks directly to the server.



      The statx system call reports the creation time (birth time) if available and requested, and the cifs filesystem does support this. However, as of February 2018, there is no Linux system call that allows setting the creation time.



      The cifs filesystem also exposes creation time as the extended attribute user.cifs.creationtime, but this attribute is read-only because it is only checked for in cifs_xattr_get, not in cifs_xattr_set.



      I can also access the share with the FTP-style smbclient program, and its allinfo command prints the creation time, but based on the man page and the command listing printed by the help command, there is no command to set any file timestamps.



      How can I set the creation time of a file on a CIFS share?



      (If it's currently not possible, there's no need to leave an answer saying so. Just leave the question unanswered.)







      share|improve this question












      I'm trying to replace an old Windows laptop I've been using as a "sneakernetting station" to copy files from NTFS-formatted hard drives to a Samba share using the WIndows robocopy utility. rsync is a more-than-capable replacement for robocopy, with one exception: it can't set creation timestamps, because historically Linux filesystems haven't supported them. CIFS shares certainly do, though, so I'm looking for a way to set the creation timestamps to fix them up after copying the files. (I already know how to get the creation time from NTFS.)



      There are a few different questions here and on Super User about Linux creation times generally (1, 2, 3, 4, 5, 6), whose answers boil down to "Linux doesn't creation time". But I only need to set times for files on CIFS shares, and I'm willing to use filesystem-specific interfaces or a userspace program that talks directly to the server.



      The statx system call reports the creation time (birth time) if available and requested, and the cifs filesystem does support this. However, as of February 2018, there is no Linux system call that allows setting the creation time.



      The cifs filesystem also exposes creation time as the extended attribute user.cifs.creationtime, but this attribute is read-only because it is only checked for in cifs_xattr_get, not in cifs_xattr_set.



      I can also access the share with the FTP-style smbclient program, and its allinfo command prints the creation time, but based on the man page and the command listing printed by the help command, there is no command to set any file timestamps.



      How can I set the creation time of a file on a CIFS share?



      (If it's currently not possible, there's no need to leave an answer saying so. Just leave the question unanswered.)









      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 26 at 3:25









      Jeffrey Bosboom

      2581412




      2581412

























          active

          oldest

          votes











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f426592%2fsetting-the-creation-time-of-a-file-on-a-cifs-share%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes










           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f426592%2fsetting-the-creation-time-of-a-file-on-a-cifs-share%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay