Re: Backup with mtree and rsync?

2013-01-08 Thread schultz

No (not directly, except overwriting directories with content),
but cpdup can; see "man cpdup" for details and inspiration.


True, but cpdup is not part of the base system.


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: Backup with mtree and rsync?

2013-01-08 Thread schultz

I apparently reinvented the wheel. :-)
Thanks for the link, it is indeed very inspiring.

Quoting Ciprian Dorin Craciun :


On Sat, Jan 5, 2013 at 8:12 PM,   wrote:

I have been wondering whether it is possible to create a backup system
using mtree and rsync. Essentially, the user would create a mtree
specification of the source directory and copy it over to the destination
directory with rsync. Any changes in the destination could then be
detected before restoring with the mtree specification, which should
contain strong hashes of the files and should not contain the nlink
keyword.



A little bit off-topic, but there is a small tool that does
something similar to your suggested `mtree` usage, but specifically
tailored for backups, `rdup`:

  http://miek.nl/projects/rdup

Although I've not used it myself (I use `rdiff-backup` and on
Linux), the idea is pretty similar with what you want to achieve:
* you run `rdup` with an old "descriptor file" plus a target path,
and in turn it generates:
  * a new "descriptor file";
  * a list of files that should be backed up;
* you then decide what you do with the list of files to be
backed-up (i.e. put them in a `tar`, `rysnc` them to a server, etc.);

Hope it helps,
Ciprian.




 
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: Backup with mtree and rsync?

2013-01-08 Thread Ciprian Dorin Craciun
On Sat, Jan 5, 2013 at 8:12 PM,   wrote:
> I have been wondering whether it is possible to create a backup system
> using mtree and rsync. Essentially, the user would create a mtree
> specification of the source directory and copy it over to the destination
> directory with rsync. Any changes in the destination could then be
> detected before restoring with the mtree specification, which should
> contain strong hashes of the files and should not contain the nlink
> keyword.


A little bit off-topic, but there is a small tool that does
something similar to your suggested `mtree` usage, but specifically
tailored for backups, `rdup`:

  http://miek.nl/projects/rdup

Although I've not used it myself (I use `rdiff-backup` and on
Linux), the idea is pretty similar with what you want to achieve:
* you run `rdup` with an old "descriptor file" plus a target path,
and in turn it generates:
  * a new "descriptor file";
  * a list of files that should be backed up;
* you then decide what you do with the list of files to be
backed-up (i.e. put them in a `tar`, `rysnc` them to a server, etc.);

Hope it helps,
Ciprian.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: Backup with mtree and rsync?

2013-01-08 Thread Polytropon
On Tue, 08 Jan 2013 15:57:39 -0200, schu...@ime.usp.br wrote:
> > It's possible that the mtree support in tar(8) might be able to do it,
> > but it would probably be a lot slower.
> 
> Wait, can tar be used to remove files?

No (not directly, except overwriting directories with content),
but cpdup can; see "man cpdup" for details and inspiration.




-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: Backup with mtree and rsync?

2013-01-08 Thread schultz

I don't see any way to do this directly. What you probably want to do is
use find(1) to pick out the new files to check, and then merge the
changes into the old mtree(8) spec. Not trivial, but the spec syntax is
intended to be easy to parse, so it shouldn't be that hard either.


What I am currently doing somewhat fits your description. I feed find
output into a C program that merges the old description with the
directory state to produce a new description. However, I use a format
different than mtree. I was seeking a shorter, more elegant, solution.


It's possible that the mtree support in tar(8) might be able to do it,
but it would probably be a lot slower.


Wait, can tar be used to remove files?


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: Backup with mtree and rsync?

2013-01-08 Thread Lowell Gilbert
schu...@ime.usp.br writes:

> I have been wondering whether it is possible to create a backup system
> using mtree and rsync. Essentially, the user would create a mtree
> specification of the source directory and copy it over to the destination
> directory with rsync. Any changes in the destination could then be
> detected before restoring with the mtree specification, which should
> contain strong hashes of the files and should not contain the nlink
> keyword.
>
> The problem is that mtree would be too slow. It would recompute the
> hashes of big files even when they did not change from the last backup.
> Therefore, I would like to ask if there is an easy way to accomplish
> the following.
>
> Let a mtree specification of a directory from a certain point in the
> past be given. Also, assume that a (regular) file below that directory
> has not changed if its current modification time (mtime) equals
> its modification time in the past specification.
> Produce as output the new mtree specification for the directory without
> reading these files.
>
> This is somewhat like rsync does to perform incremental backups.

Except that you have a spec for mtree to be sure the backup copy hasn't
been corrupted. 

I don't see any way to do this directly. What you probably want to do is
use find(1) to pick out the new files to check, and then merge the
changes into the old mtree(8) spec. Not trivial, but the spec syntax is
intended to be easy to parse, so it shouldn't be that hard either.

> P.S.: As an aside, is there an utility in the base system that can
> reproduce the behavior of `rsync --delete -a dir0/ dir1/`?

It's possible that the mtree support in tar(8) might be able to do it,
but it would probably be a lot slower.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Backup with mtree and rsync?

2013-01-05 Thread schultz

I have been wondering whether it is possible to create a backup system
using mtree and rsync. Essentially, the user would create a mtree
specification of the source directory and copy it over to the destination
directory with rsync. Any changes in the destination could then be
detected before restoring with the mtree specification, which should
contain strong hashes of the files and should not contain the nlink
keyword.

The problem is that mtree would be too slow. It would recompute the
hashes of big files even when they did not change from the last backup.
Therefore, I would like to ask if there is an easy way to accomplish
the following.

Let a mtree specification of a directory from a certain point in the
past be given. Also, assume that a (regular) file below that directory
has not changed if its current modification time (mtime) equals
its modification time in the past specification.
Produce as output the new mtree specification for the directory without
reading these files.

This is somewhat like rsync does to perform incremental backups.

P.S.: As an aside, is there an utility in the base system that can
reproduce the behavior of `rsync --delete -a dir0/ dir1/`?


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"