tar --newer-mtime

Johan Booysen johan at matrix-data.co.uk
Thu Nov 29 16:48:38 UTC 2007


This seems to work quite well:

Create initial snapshot file, but "throw away" the tar file (which will
contain all files):

# tar --create --listed-incremental tar.snar --to-stdout --preserve
foldername/ > /dev/null

Create an incremental backup of the folder:

# tar --create --listed-incremental tar.snar --preserve --gzip --file
backup.tgz foldername/

Extract the incremental backup (when necessary for a restore):

# tar --extract --incremental --gzip --preserve --file backup.tgz 

Each time an incremental backup is done this way, it modifies the .snar
snapshot file, so that each subsequent backup is incremental.

For my purposes (once-off move of data, really) this will work nicely.

-----Original Message-----
From: redhat-list-bounces at redhat.com
[mailto:redhat-list-bounces at redhat.com] On Behalf Of Herta Van den Eynde
Sent: 26 November 2007 23:51
To: redhat-list at redhat.com
Subject: Re: tar --newer-mtime

On 26/11/2007, Johan Booysen <johan at matrix-data.co.uk> wrote:
> Thanks very much!
>
> In the meantime I've come across this, which apparently is the correct
> way to use tar for incremental "backups":
>
> http://www.gnu.org/software/tar/manual/html_node/tar_88.html#SEC88
>
> Anyt thoughts on what that page indicates?  I just can't afford to
screw
> this one up, so it's very important that I get it right!
>
> Thanks.
>
> -----Original Message-----
> From: redhat-list-bounces at redhat.com
> [mailto:redhat-list-bounces at redhat.com] On Behalf Of Herta Van den
Eynde
> Sent: 25 November 2007 23:45
> To: General Red Hat Linux discussion list
> Subject: Re: tar --newer-mtime
>
> On 25/11/2007, Johan Booysen <johan at matrix-data.co.uk> wrote:
> > Dear all,
> >
> > Apologies if this is a silly question, but it's important enough for
> me
> > to ask as a double-check:
> >
> > I want to do a once-off "incremental backup" of a server, in such a
> way
> > that I create a tar archive of only data files that have been
created
> or
> > have been modified since a defined date.
> >
> > Will this do the trick, for example?
> >
> > tar -cvf incremental.tar --newer-mtime "24 Now 2007" *
> >
> > I.e. only tar up files that have been CREATED or MODIFIED since
> > 24.11.2007...
> >
> > Thanks.
> >
> Linux doesn't record the creation date.  What you can get is:
>
> atime = the last time the file was opened for read
> mtime = the last time the file was closed after it was opened for
write
> ctime = the time the inode information was updated (e.g. as a result
> of a chmod or chown
>
> --newer-mtime will only tar files whose mtime has changed.  Better to
> use --after-date, which will tar both files whose mtime or ctime has
> changed.
>
> Kind regards,
>
> Herta

Hi Johan,

I've never used GNU tar, but the GNU organisation is responsible for
many of the add-ons on which many linux users rely (cf.
http://directory.fsf.org/GNU/), so it looks promising.

If you have a test environment, it shouldn't be too hard to test.
Simply
- install GNU tar
- create a small directory somewhere and populate it with random files.
- take your first backup
- open some files for write (e.g. using vi and making a few changes)
- change the ownership or permissions on a few others,
- take your incremental backup.
(Play with 'date' if that is more convenient.)
- move the original directory aside
- restore your backup.
- compare the restored directory with the original one .  If they are
identical, you're set.

Kind regards,

Herta

-- 

redhat-list mailing list
unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list




More information about the redhat-list mailing list