Linux file system has three major time attributes, namely, ctime (change time), atime (access time), mtime (modify time). It is easy to confuse the three time to prepare in-depth understanding of Linux's shoes, please tell the difference between these three
atime: Access time, when reading files or executable file changes, the last time the file that is being read.
Time when file data was last accessed. Changed by the
following functions: creat (), mknod (), pipe (),
utime (2), and read (2).
mtime: Modified time, is written to the file with the changes to the file content to change, refers to the contents of the file was last modified.
Time when data was last modified. Changed by the fol-
lowing functions: creat (), mknod (), pipe (), utime (),
and write (2).
ctime: Change time, is written to the file, change the owner, with the Inode content and changes when setting permissions or link that file status was last changed time.
Time when file status was last changed. Changed by the
following functions: chmod (), chown (), creat (),
link (2), mknod (), pipe (), unlink (2), utime (), and
A lot of people understand it as create time, including many misleading books is so written. Ctime actually refers to change time.
1, modify the content of the text itself is changed (mtime)
Change is the inode file has changed (ctime)
2, if you modify the contents of the file, the update ctime and mtime
3, if only the file inode change, such as modifying permissions, you just change the ctime
4, if you use the ext3 file system when in use when the noatime mount parameter will not update atime information that atime will not be modified after the access to the file, but this does not represent the real situation
Tips: This three time stamp are placed in the inode. If the mtime, atime modify inode will certainly change, the corresponding inode change, and that ctime will follow to change, the reason for using the noatime mount option, the file system just do not want to make too many changes to improve reading performance.
atime view files, ctime and mtime.
ctime # ls -lc filename listed in files
# Ls -lu filename listed atime file
mtime # ls -l filename listed in files
1: # echo "Hello World" >> myfile atime constant while varying the ctime and mtime
2: # cat myfile ctime and mtime constant, changing only atime
# Ls myfile
ctime and mtime and atime not change
3: # chmod u + x myfile mtime and atime constant, only change the ctime
4: # mv myfile ../
mtime and atime constant, only change the ctime
From kernel2.6.29, the default integrates a relatime attributes. After using this feature to mount the file system only if mtime than atime update time, will update atime.
scenes to be used:
Read in the file system very frequently, atime update brings much overhead, so use noatime mount the file system attributes in time to stop the update atime. But some procedures require some judgment and operate according to atime, this time relatime feature comes in handy. In fact, in fact, this time the atime and mtime are already the same time, so this option is to be understood that in order to achieve compatibility of atime was launched, time is not a new property.
Use: # mount -o relatime / dir ## mounted directory when adding parameters relatime