When inode change time changes?
Oliver Fromme
olli at lurza.secnetix.de
Fri Jun 22 07:52:40 UTC 2007
Artem Kuchin wrote:
> Also, i use inode time because i only need files
> which really have been changed. For example,
> i you restore a file from a month ago it will have
> a date which is a month ago. Then that backup
> is destroyed but this file would not be backed up
> because the date is too much in the past. So, we
> loose the file. If i used inode change time the file
> will be backup in any case. However, some
> "stupid" programs like mysql or qmail seem to
> touch files so,
Pretty much _any_ operation on a file (except reading it)
will update the ctime of the inode. So I'm not surprised
that the ctime of database files and mail files gets
updated often.
(However, I do agree that mysql and qmail are "stupid",
but for entirely different reasons. ;-)
> for example, all mail message and
> databases are backed up every time. And this sucks.
Seems like you need to make a distinction: Use mtime
for /var/mail and /var/db/mysql/data (or wherever your
db files are), and use ctime for everything else.
With find(1) and bsdtar(1) that's pretty easy:
# set -f # disable shell-expansion of "*"
# MDIRS="( -path ./var/mail/* -o -path /var/db/mysql/data/* )"
# FLAG="/var/db/lastbackup.flag"
# find . $MDIRS -mnewer $FLAG -o ! $MDIRS -cnewer $FLAG \
| tar -cn -T- -f- | gzip -c > $DESTINATION.tar.gz
However, as you pointed out, it will not record the fact
that a file has been deleted since the last level-0 backup,
so it's not a perfect incremental backup. (However, it's
sufficient for me personally. Another solution would be
to store the output from "find" along with the level-1
backup, so you can easily find out what files didn't exist
anymore when you restore the backup.)
You might also use the "-print0" flag on find(1) and the
"--null" flag on tar(1) if there's the possibility that
file names could contain whitespace ... I omitted some
details for brevity.
Anyhow, it's just a suggestion. It works perfectly fine
for me, but it might not work for you. YMMV.
> What is still do not understand is what time gtar uses for
> --newer option.
>
> Man page says:
>
> --newer date Only store files with creation time newer than
> date.
>
> This is simply not true. NOT creation time defenetly.
Sure? Did you test it?
> It is either modification time or inode change time. Which one?
You can either simply test it by creating a few test files
and making a test archive. Or look it up in the source
code of gtar. I don't have gtar installed so I can't tell.
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
Perl is worse than Python because people wanted it worse.
-- Larry Wall
More information about the freebsd-stable
mailing list