When inode change time changes?

Oliver Fromme olli at lurza.secnetix.de
Wed Jun 20 13:54:33 UTC 2007


Artem Kuchin <matrix at itlegion.ru> wrote:
 > I use gtar (gtar because it has incremental
 > backups, and tar does not)

You _can_ use BSD tar for incremental backups.  I do that
every day.

When you do a level-0 backup, simply "touch" a flag file
somewhere.  Then when you do the level-1 backup, use the
--newer-than option with that flag file, so only files
that were modified after the level-0 backup get archived.

The --newer-than option checks the ctime.  If you want to
look at the mtime only (i.e. ignoring renames, chmod,
chown etc.), use --newer-mtime-than instead.

Please refer to the tar(1) manpage for details.

 > I use inode change time in order to backup
 > all changed files. I have notices that some
 > files are always backed up even if they did not
 > change. For example all mysql database.
 > I checked their file change time and it is not
 > changed, howeever, inode change time changes
 > on every mysql restart.
 > 
 > Maybe someone can englighten me when
 > inode change time changes? What must be done
 > with file to change it (except writing to it)?
 > I tried chmoding - it does not affect inode time.

The mtime changes upon every data write to the file, the
ctime additionally changes upon every change of the inode
data (i.e. file meta data).  This is documented in the
stat(2) manpage:

   st_ctime   Time when file status was last changed (inode data
              modification).  Changed by the chmod(2), chown(2),
              link(2), mknod(2), rename(2), unlink(2), utimes(2)
              and write(2) system calls.

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

'Instead of asking why a piece of software is using "1970s technology,"
start asking why software is ignoring 30 years of accumulated wisdom.'


More information about the freebsd-stable mailing list