Other How to backup and restore to spare drive using dump and restore?

I'm in the process of leaving Linux and moving to FBSD. I'm trying to learn how to backup and restore FBSD, so when I screw stuff up, I can easily restore. I am trying to learn the "dump" and "restore" utilities built into FBSD

I have a fresh install of FBSD, with the default ZFS on Root option during install, on /dev/ada0. I have a secondary hard disk for backup purposes only, which is /dev/ada1. I have initially erased all data on /dev/ada1 and formatted it with UFS. I would like to create an initial backup of the entire ada0 drive to practice restoring it.

I have tried this, which did NOT work:

# /sbin/dump -0uan -h 0 -f- /dev/ada1/ | gzip -2 | dd of=/dev/ada1/base-os-backup-$(date +%D_%T).gz bs=64k

dump: Cannot open /dev/ada1/: Not a directory
dd: /dev/ada1/base-os-backup-02/26/26_14:43:19.gz: Not a directory

1.) How do I, initially, backup an entire disk using "dump"?

2.) From that point forward, how do I create an incremental backup(s)?

3.) Finally, how do I restore either the full or incremental backup(s) using "restore"?

Thank you,
Ed
 
dump is for ufs (and it works on filesystems, not disks)
Thank you...I didn't know that!

Is there any good documentation, etc., that you're aware of that might teach me how to backup and restore my primary drive with ZFS to a secondary drive?

Ed
 
There is a book, a bit dated by now, but still useful, by Mike Lucas and only about $10.00 USD. https://www.tiltedwindmillpress.com/product/fmzfs/

If you're not familiar with Mr. Lucas's work, hopefully, as you get deeper into FreeBSD, you'll become so. He's very good at making complex subjects intelligible to stupid people like me. He is also the author of Absolute FreeBSD, considered the best book on FreeBSD by many. https://www.amazon.com/Absolute-FreeBSD-3rd-Complete-Guide/dp/1593278926
Short answer to your question is that the ZFS guide might be the best way to get more knowledgeable about ZFS.
 
There is a book, a bit dated by now, but still useful, by Mike Lucas and only about $10.00 USD. https://www.tiltedwindmillpress.com/product/fmzfs/

If you're not familiar with Mr. Lucas's work, hopefully, as you get deeper into FreeBSD, you'll become so. He's very good at making complex subjects intelligible to stupid people like me. He is also the author of Absolute FreeBSD, considered the best book on FreeBSD by many. https://www.amazon.com/Absolute-FreeBSD-3rd-Complete-Guide/dp/1593278926
Short answer to your question is that the ZFS guide might be the best way to get more knowledgeable about ZFS.
Thank you...I'll check it out!

Ed
 
There are many options to back up your zroot zpool. You may read about zfs send to send a backup to a file to another zpool or zfs dataset but these are only good for off machine or offsite storage.

You can use zfs snapshots. The best approach would be to use snapshot using boot environments plus zfs snapshots of your data. This enables you to easily recover from experimentation where the system is still bootable.

Another approach would be to use a zpool checkpoint. Should the system become unbootable you could use a zpool import --rewind-to-checkpoint.

A better approach might be to attach (zpool attach) a mirror disk. Let it finish then zpool split to detach the disk. Make sure the newly detached disk also has boot blocks. Now if your system becomes unbootable, reattach the new disk and boot from it. You are now back to where you started. You can use this image to try and repair the broken system on the other disk or clone the disk back to the old. Of course any new data written to the other disk after the separated mirror was detatched is unavaialble.

Typically I do something similar to this using UFS -- my systems are a mix of UFS and ZFS. I maintain a couple of USB disks, one for UEFI boot and the other for legacy CSM boot for older systems. They are used to jumpstart a restore process. It's been a few years since I've had to use the disks for restore but I do use the same process to clone my systems from one to another, i.e. old laptops to new laptops to even newer laptops.
 
There are many options to back up your zroot zpool. You may read about zfs send to send a backup to a file to another zpool or zfs dataset but these are only good for off machine or offsite storage.

You can use zfs snapshots. The best approach would be to use snapshot using boot environments plus zfs snapshots of your data. This enables you to easily recover from experimentation where the system is still bootable.

Another approach would be to use a zpool checkpoint. Should the system become unbootable you could use a zpool import --rewind-to-checkpoint.

A better approach might be to attach (zpool attach) a mirror disk. Let it finish then zpool split to detach the disk. Make sure the newly detached disk also has boot blocks. Now if your system becomes unbootable, reattach the new disk and boot from it. You are now back to where you started. You can use this image to try and repair the broken system on the other disk or clone the disk back to the old. Of course any new data written to the other disk after the separated mirror was detatched is unavaialble.

Typically I do something similar to this using UFS -- my systems are a mix of UFS and ZFS. I maintain a couple of USB disks, one for UEFI boot and the other for legacy CSM boot for older systems. They are used to jumpstart a restore process. It's been a few years since I've had to use the disks for restore but I do use the same process to clone my systems from one to another, i.e. old laptops to new laptops to even newer laptops.
Thank you for the detailed reply!

How would you know if your mirrored drive has the necessary boot blocks so you know, with confidence, you could boot from it if you wanted to? Wouldn't it, by default, be a "carbon-copy" in every detail of the other drive that it was/is mirroring?

Ed
 
Thank you for the detailed reply!

How would you know if your mirrored drive has the necessary boot blocks so you know, with confidence, you could boot from it if you wanted to? Wouldn't it, by default, be a "carbon-copy" in every detail of the other drive that it was/is mirroring?

Ed
You need to create them first.
 
Back
Top