SMB2: Timestamps are not preserved when copying to a SMB share

Solution Verified - Updated -

Issue

  • # cp -p fails to preserve timestamps when copying to SMBv2.x share for non-empty files.
  • mtime is not preserved when copying to SMB2 share, but is for SMB.
  • mtime and atime is not preserved when copying to SMB2 share, but is for SMB.
  • This behavior is seen when copying to both a Samba and Windows SMB server.
  • Copying to newer versions of Windows correctly reports mtime.

Environment

  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8
  • SMBv2.x and SMBv3.x
  • SMB server

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In