LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-29-2011, 01:45 AM   #1
password636
Member
 
Registered: Jun 2006
Location: Beijing
Posts: 60

Rep: Reputation: 1
Why updating atime doesn't update ctime?


Hi,

ctime is the inode change time. If reading a file, its atime will be updated, which should cause inode member i_atime changed, which is an inode change. So ctime should also be updated. But if I try to ls a directory on redhat, only the directory atime gets updated, not ctime. Why?

THANKS!
 
Old 11-29-2011, 03:55 AM   #2
Nominal Animal
Senior Member
 
Registered: Dec 2010
Location: Finland
Distribution: Xubuntu, CentOS, LFS
Posts: 1,723
Blog Entries: 3

Rep: Reputation: 946Reputation: 946Reputation: 946Reputation: 946Reputation: 946Reputation: 946Reputation: 946Reputation: 946
Quote:
Originally Posted by password636 View Post
If reading a file, its atime will be updated, which should cause inode member i_atime changed, which is an inode change. So ctime should also be updated. But if I try to ls a directory on redhat, only the directory atime gets updated, not ctime. Why?
Because otherwise ctime would be just a copy of atime in practice.

Only changes made to inodes by userspace processes are reflected in ctime.
 
Old 11-29-2011, 04:22 AM   #3
password636
Member
 
Registered: Jun 2006
Location: Beijing
Posts: 60

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by Nominal Animal View Post
Because otherwise ctime would be just a copy of atime in practice.

Only changes made to inodes by userspace processes are reflected in ctime.
ctime changes in much more situations than atime. Any member change of inode would cause ctime change, such as i_mode (by chmod), i_uid, i_gid(by chown), etc.. But for atime, only file content access. So how can say "otherwise ctime would be just a copy of atime in practice"?
 
Old 12-03-2011, 06:58 AM   #4
Nominal Animal
Senior Member
 
Registered: Dec 2010
Location: Finland
Distribution: Xubuntu, CentOS, LFS
Posts: 1,723
Blog Entries: 3

Rep: Reputation: 946Reputation: 946Reputation: 946Reputation: 946Reputation: 946Reputation: 946Reputation: 946Reputation: 946
Quote:
Originally Posted by password636 View Post
ctime changes in much more situations than atime. Any member change of inode would cause ctime change, such as i_mode (by chmod), i_uid, i_gid(by chown), etc.. But for atime, only file content access. So how can say "otherwise ctime would be just a copy of atime in practice"?
Because in practice, files are read often, while ownership and mode changes extremely rarely (less than once per file lifetime on average).

Basically, mtime tells the last time the file contents have changed; atime tells the last time the content has been accessed (except for indexers and other applications that use the O_NOATIME open(2) flag); and ctime tells the last time the file ownership or access mode has been changed. This means that in practice, ctime is almost always older than atime.

If atime change also triggered an ctime change, then all typical files would have ctime == atime.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
find -atime brownie_cookie Linux - Newbie 4 04-01-2011 07:32 AM
atime updates umailtonikhil *BSD 4 09-10-2007 08:57 AM
atime update information umailtonikhil Solaris / OpenSolaris 2 09-07-2007 11:08 AM
updating RHEL AS4 update 1 to update 5 via CDs? icemaker Linux - Software 1 06-09-2007 07:29 PM
modify atime farslayer Linux - General 3 01-19-2007 01:27 PM


All times are GMT -5. The time now is 04: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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration