Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Sep 2007 14:05:19 +0200 (CEST)
From:      Oliver Fromme <olli@lurza.secnetix.de>
To:        freebsd-chat@FreeBSD.ORG, deeptech71@gmail.com
Subject:   Re: filesystem timestamps and their usage
Message-ID:  <200709131205.l8DC5Jwr033230@lurza.secnetix.de>
In-Reply-To: <46C863A6.5010404@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
deeptech71@gmail.com wrote:
 > Let's talk about file system timestamps. What kind of timestamps are
 > there currently, and what are they used for?

This is a late reply, but I haven't seen that question of
yours answered so far, so I try to give it a shot.

First of all, time stamp support depends on two things:
the file system and the operating system.  In order to
be able to use a certain kind of time stamp, both of
them have to support it.  For example, FAT does not
distinguish between mtime and ctime, so FreeBSD treats
them the same on FAT file systems.

The following assumes you use UFS2, which is FreeBSD's
default.  It supports four kinds of file time stamps:

 - mtime (displayed by "ls -l"):  This is updated each
   time the file is written to.

 - atime ("ls -lu"):  Updated each time the file is read.
   Can be disabled (for performance reasons) by mounting
   a file system with the "noatime" option.

 - ctime ("ls -lc"):  Updated each time the file status
   changes.  In other words, when the meta data contained
   in the inode changes, or when a directory entry
   associated with the inode changes.  For example,
   renaming or moving a file will update the ctime,
   also changing ownerships, permissions etc.

 - birthtime ("ls -lU"):  The time when the inode was
   created.  It never changes.

You can read the details in the stat(2) manual page,
including an exact enumeration of syscalls which affect
the various time stamps.

The first three of the time stamps (mtime, atime and
ctime) are specified by standards (POSIX, SUS), so
there's not much room for discussion, I think.  Also
keep in mind that FreeBSD needs to be interoperable
with other systems, so adhering to the standards is
a must.  The birthtime is an extension, but I think
it is a natural and useful one (FAT supports it, too,
by the way).

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

"Clear perl code is better than unclear awk code; but NOTHING
comes close to unclear perl code"  (taken from comp.lang.awk FAQ)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200709131205.l8DC5Jwr033230>