ZFS "Reinstalling"/Restoring FreeBSD from a ZFS snapshot

i-bsd

Member

Thanks: 6
Messages: 52

#1
I apologize if this question has already been asked before.

Is it possible to save a ZFS snapshot as a single file or directory somewhere for backup, and I ever need to "reinstall" FreeBSD, instantly restore my entire system using the install USB and ZFS?

I've made a lot of customizations and looking for a way to snapshot the entire filesystem to quickly restore if I ever lose anything.
 
OP
OP
i-bsd

i-bsd

Member

Thanks: 6
Messages: 52

#3
I guess the main part of my question is whether or not you can completely restore a system from an install USB (if the hard drive has been erased).

Can you create the zpool from the install usb and restore the snapshot, then reboot straight into the system?
 

ShelLuser

Son of Beastie

Thanks: 1,377
Messages: 2,935

#4
I guess the main part of my question is whether or not you can completely restore a system from an install USB (if the hard drive has been erased).
It depends on the utilities provided on that flashdrive, something I'm not familiar with from mind. But if a flash doesn't do it then a rescue CD definitely will.

Can you create the zpool from the install usb and restore the snapshot, then reboot straight into the system?
You'd need gpart, zpool, zfs and optionally ssh (to stream the image from a remote location) and then you have all the tools required to restore your setup.
 
OP
OP
i-bsd

i-bsd

Member

Thanks: 6
Messages: 52

#5
So it may actually be faster and more efficient to just rsync backup the entire drive and restore that way?

Sounds like a lot of work for a quick backup/restore.
 

ShelLuser

Son of Beastie

Thanks: 1,377
Messages: 2,935

#6
So it may actually be faster and more efficient to just rsync backup the entire drive and restore that way?
Depends, probably not also depending on your setup.

Sounds like a lot of work for a quick backup/restore.
So just because I mentioned several commands makes you conclude that it is also a lot of work? ;)

Don't forget that there is no one "good" way to do this, there are dozens of options available to set this up. I'm simply reflecting on the way I'd do it.

For my setups this would boil down to:
  • (re)partition disk.
  • Create zroot pool.
  • 'zfs receive' all the backup data.
  • Done.
Your mileage may vary.

PS: The reason why I think rsync wouldn't be more efficient is because you'd have to create all your filesystems first before you can actually perform the restore.
 
Top