ZFS and backups

Hi,

Until now I do my backups with rsync. But I want to switch to ZFS snapshots. What I currently know is: I can create snapshots and transfer them with send/receive to an external medium. But since those snapshots just contain changes, the first snapshot is empty and transferring this won't help a bit when I Iose data/the disks crash. But since my system is already pretty large (2 TB of data), I want to create something like an initial (complete) backup of my data first and then incrementally "merge" the snapshots in. I haven't found anything about that. Or maybe I don't understand the whole ZFS snapshot/backup thing?

What would be the best approach here?

Cheers,
Stefan
 
You can send either snapshots (full stream) with zfs send zroot@snap or "diffs" only by using the zfs send -i zroot@previous_snap zroot@snap command. See the zfs(8) manpage, the send section for details.
 
A snapshot contains everything of the dataset at that moment. It doesn't take up space on the original because there haven't been changes, it still references all the data from the moment of the snapshot.
 
Okay,

My zpool is named "storage". I create a snapshot like this: root@magrathea:~ # zfs snapshot storage@test. Afterwards I have this:
Code:
root@magrathea:~ # zfs list -t snapshot
NAME           USED  AVAIL  REFER  MOUNTPOINT
storage@test      0      -  53.9K  -

Which is the first snapshot I have taken. Now I do for example this: root@magrathea:~ # zfs send storage@test | zfs recv backup/storage, which takes like two seconds. Then I have this:
Code:
root@magrathea:~ # zfs list -t snapshot
NAME                  USED  AVAIL  REFER  MOUNTPOINT
backup/storage@test      0      -   192K  -
storage@test             0      -  53.9K  -

So either I'm completely wrong or there is nothing transferred really? My expectation is that send/recv takes a while and then I have 2 TB on my backup disk.

So what am I doing wrong here?
 
Oh, I think I have found my error :r

I did a zfs snapshot -r storage@intital and it actually worked. So I have to create a snapshot for each filesystem. NOT for the zpool. Then I can do a zfs send -R storage@initial | zfs recv backup/storage to transfer the thing. Then, with each consecutive snapshot I can do something like this: zfs send -i zroot@initial zroot@new | zfs recv backup/storage. But the argument for -i has to be replaced with the previous snapshot I sent? Like here it must be storage@new the next time?

Cheers.
 
Back
Top