Re: filesystem timestamps and their usage

[ Available lists | Index of freebsd-chat | Month of Sep 2007 | Week of 13 Sep 2007 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Oliver Fromme <olli@lurza.secnetix.de>
Date
13 Sep 2007 12:36:18
Subject
Re: filesystem timestamps and their usage
Message-ID
200709131205.l8DC5Jwr033230@lurza.secnetix.de

Referenced by

[ Hide this part ]
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, Geschftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mn-
chen, HRB 125758, Geschftsfhrer: 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)


Elapsed time: 0.142 seconds