# Bootable backup of a ZFS mirror system



## boris_net (Jan 26, 2012)

Hi all,

I am running FreeBSD 9.0 on a ZFS mirror called zroot. I followed aisecure.net method to prepare the mirror and also create the ZFS structure.
I have most of my non-system related data on a raidz ZFS pool. 

I am now wondering how I can properly backup the system to an external USB drive to:
- boot from the external drive if anything goes wrong
- restore data from the backup onto the mirror if a directory goes in error on my ZFS mirror (like it happened to me yesterday x() 

I have a Macbook Pro running Lion and I can easily replicate my system harddrive onto a USB external drive to boot and get everything back if needed. Obviously the structure of both hardware storage and file system are simpler but I would be interested in getting views from people here on how I could arrange a restorable backup of a ZFS mirror - I am bit confused by the ZFS structure on the mirror, i.e. can I and do I need to back it up as well...if so how?

Thanks,

Boris


----------



## gkontos (Jan 26, 2012)

You could try cloning and then use incremental snapshots for backups.

However, to do this on an external media you would have to make some adjustments, like:

[CMD=""]# zfs send -R zroot@bck |  zfs receive -Fdv zbackup[/CMD]

would send the initial snapshot and:

[CMD=""]# zfs send -R -i zroot@yesterday zroot@today  | zfs receive -Fdv zbackup [/CMD] 

would perform an incremental backup.

But in order to boot from zbackup, you would have to alter the zbackup/boot/loader.conf and adjust it to:


```
vfs.root.mountfrom="zfs:zbackup"
```

This is me just thinking loudly, I haven't tried it but you gave me a nice idea!


----------



## boris_net (Jan 27, 2012)

Glad I triggered something  

Thanks for your pointers, I will give it a try. Modifying the loader.conf is not a real issue, it can go in a script without any major issue. Let me know if you manage to get something working before I go anywhere on my side. I will update this thread with details of what I get and work vs do not work.

Thanks,

Boris


----------

