LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-04-2013, 04:33 AM   #1
acidrop
LQ Newbie
 
Registered: May 2005
Location: athens greece
Distribution: ubuntu,debian,centos
Posts: 23

Rep: Reputation: 0
Preserve time stamps of files on a linux based NAS


Hello all,

I have a linux based NAS device (WD Sharespace). I have noticed that each time I make a modification (from Windows Client) on a file (word,excel,pdf etc), created,modified,accessed values are given the current date/time. Is it possible to preserve at least the "Creation Date/Time" at its original value?

thank you
 
Old 10-04-2013, 05:17 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Actually, there's no such thing as 'created' time in Unix
Quote:
Three fields in the inode structure contain the last access, change, and modification times: atime, ctime, and mtime. The atime field is updated each time the pointer to the file's data blocks is followed and the file's data is read. The mtime field is updated each time the file's data changes. The ctime field is updated each time the file's inode changes. The ctime is not creation time; there is no way under standard Unix to find a file's creation time.

Reading a file changes its atime only. Changing a file's name doesn't change atime, ctime, or mtime, because the directory entry changed (it does change the atime and mtime of the directory the file is in, though). Truncating a file doesn't change its atime (because we haven't read; we've just changed the size field in its directory entry), but it does change its ctime because we changed its size field and its mtime because we changed its contents (even though we didn't follow the pointer to do so).
Perl CookBook

Under the new ext4 filesystem there is a new birth time field, but its not currently supported by most tools, so its usually empty.

The only guaranteed way to preserve the date/time of eg creation is to embed it in the filename (or content).
The usual convention is YYYYMMDD (& optionally '_HHMISS') eg name_YYYYMMDD.ext .
This cause the files to sort naturally if you've got multiple same name files.

HTH

Last edited by chrism01; 10-04-2013 at 05:19 AM.
 
Old 10-04-2013, 05:21 AM   #3
acidrop
LQ Newbie
 
Registered: May 2005
Location: athens greece
Distribution: ubuntu,debian,centos
Posts: 23

Original Poster
Rep: Reputation: 0
So you mean that actually there is no way to preserve those values on a samba share on a linux server?
The only way to preserve them is to share those files on a ntfs volume?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] add time stamps to files VickIsSlick Linux - Newbie 5 12-16-2010 07:53 PM
[SOLVED] Files sizes and checksums changed, but not time stamps? spockdude Linux - Security 2 11-24-2010 03:27 PM
are linux date/time stamps correct? Trio3b Linux - General 4 11-18-2010 11:49 AM
Samba time-stamps files incorectly k41184 Linux - Software 1 10-02-2005 08:24 AM
Help - My Samba share changes the timestamp when copying files to it.. Preserve Time. hheejj Linux - Software 2 06-28-2005 09:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration