Re: When inode change time changes?
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 dateOnly 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 ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: When inode change time changes?
Julian H. Stacey wrote: Oliver Fromme wrote: 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. I was uncertain what when changed st_ctime st_atime st_mtime when I had to use SCO (ugh!) in 1990, as well as BSD. Not enough source then there, manuals were insufficient, so to observe, I wrote http://berklix.com/~jhs/src/bsd/jhs/bin/public/statv/ More tools since, but might still be handy. Well, this is FreeBSD in 2007. :-) All syscalls that change st_{a,m,c,birth}time should be documented in the stat(2) manpage. I think that those enumerations in the manpage are complete, but if someone finds something that's missing there, then he should file a PR to fix that bug. 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 If you think C++ is not overly complicated, just what is a protected abstract virtual base pure virtual private destructor, and when was the last time you needed one? -- Tom Cargil, C++ Journal ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: When inode change time changes?
Oliver Fromme wrote: 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. I was uncertain what when changed st_ctime st_atime st_mtime when I had to use SCO (ugh!) in 1990, as well as BSD. Not enough source then there, manuals were insufficient, so to observe, I wrote http://berklix.com/~jhs/src/bsd/jhs/bin/public/statv/ More tools since, but might still be handy. -- Julian Stacey. Munich Computer Consultant, BSD Unix C Linux. http://berklix.com HTML mail unseen. Ihr Rauch=mein allergischer Kopfschmerz. Dump cigs 4 snuff. ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: When inode change time changes?
Well, this is FreeBSD in 2007. :-) All syscalls that change st_{a,m,c,birth}time should be I added birth to mine, Thanks. :-) -- Julian Stacey. Munich Computer Consultant, BSD Unix C Linux. http://berklix.com HTML mail unseen. Ihr Rauch=mein allergischer Kopfschmerz. Dump cigs 4 snuff. ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: When inode change time changes?
Artem Kuchin [EMAIL PROTECTED] 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.' ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: When inode change time changes?
Oliver Fromme wrote: Artem Kuchin [EMAIL PROTECTED] 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. Yes, but that's not real incremental backup because if you restore data you'll get a bunch of files that were deleted along the way. gtar stores full file list and actually deleted the deleted files when restoring. And i have excessively many of such created and deleted files and i need only current ones. So tar is of no use for me. 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, for example, all mail message and databases are backed up every time. And this sucks. So, when backing up these files i need to use file modification time and it is suitable here, since these file are never managed by human, only by daemon and old file eather go away (like in email) or change its mod time (like in mysql). What is still do not understand is what time gtar uses for --newer option. Man page says: --newer dateOnly store files with creation time newer than date. This is simply not true. NOT creation time defenetly. It is either modification time or inode change time. Which one? -- Regards, Artem ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: When inode change time changes?
On Sunday 17 June 2007 00:24, Artem Kuchin wrote: Maybe someone can englighten me when inode change time changes? What must be done with file to change it (except writing to it)? stat(2) would be very enlightening in this context. I tried chmoding - it does not affect inode time. chmod works for me: nik:1:~$ stat -f %c /tmp/test 1182266005 nik:1:~$ chmod -rw /tmp/test nik:1:~$ stat -f %c /tmp/test 1182266014 How do check the timestamps? Do you use stat(1) or something else? Nikos ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to [EMAIL PROTECTED]
When inode change time changes?
I am having tough time with backup system. I use gtar (gtar because it has incremental backups, and tar does not) 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. -- Regards, Artem ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to [EMAIL PROTECTED]