I've seen posted here snippets of regularly running zfs send/recv and 
here's one below:

>So for example, each night you could do:
># zfs snapshot -r tank/[EMAIL PROTECTED]
># zfs send -R tank/[EMAIL PROTECTED]  | ssh <otherhost> zfs recv -d backuptank
># zfs destroy -r tank/[EMAIL PROTECTED]
># zfs rename -r tank/[EMAIL PROTECTED] tank/[EMAIL PROTECTED]

But when I tried this myself, I found out fairly quickly that it 
doesn't quite work.

The very first go around this will appear to work, but on the first 
subsequent runs, it breaks down. In my examples, I'm using a pool 
called zfs-pool and zfs-pool/[EMAIL PROTECTED] for the most recently 
created source snapshot.

First, the line zfs send -R zfs-pool/[EMAIL PROTECTED] | ssh targetssystem 
zfs recv -d zfs-pool complains with the error:

cannot receive new filesystem stream: destination 'zfs-pool/home' exists
must specify -F to overwrite it

So then I tried zfs send -R zfs-pool/[EMAIL PROTECTED] | ssh targetssystem 
zfs recv -dF zfs-pool, and now it complains with the error:

cannot receive new filesystem stream: destination has snapshots (eg. 
zfs-pool/[EMAIL PROTECTED]) must destroy them to overwrite it.

But doing that causes the send/recv pair to write out the whole 
filesystem from scratch.

I then learned about incrementally updating the prior source 
snapshot, which I have will have renamed to 
zfs-pool/[EMAIL PROTECTED]

zfs send -R -i zfs-pool/[EMAIL PROTECTED] zfs-pool/[EMAIL PROTECTED] | 
ssh targetssystem zfs recv -d zfs-pool

This command must be substituted for the command without the "-i" on 
that command's second and subsequent runs.

However, each time it runs, it will create a cryptically named 
snapshot, such as @recv-3173-1, on the target system. What I learned 
is that this snapshot becomes the "current" snapshot of the target 
system and that trying to send another snapshot after deleting it 
outright results in the error:

cannot receive incremental stream: destination zfs-pool/home has been 
modified since most recent snapshot.

So to prevent a buildup of these snapshots, they can be renamed just 
as the current snapshot of the source system and then that renamed 
snapshot can be deleted after another snapshot from the source is 
sent over. Incidentally, the target system also gets copies of the 
two snapshots maintained on the source system.
-- 

Maurice Volaski, [EMAIL PROTECTED]
Computing Support, Rose F. Kennedy Center
Albert Einstein College of Medicine of Yeshiva University
_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to