HOWTO: Install, backup and restore a reliable FreeBSD 8.2 system
This guide will be my take on how to install, backup and restore a reliable FreeBSD workstation, or server. What does reliable mean in this context?
What are the additional features of this setup?
How did I get to this point? Essentially what happened is that I started with this article, sysutils/zfs-snapshot-mgmt and sysutils/zfs-replicate, and then realized that there was a yawning chasm between what I wanted and what existed at the time. Thus, sysutils/zxfer was born from sysutils/zfs-replicate, and these articles here are the rest of it.
I recommend reading the following two articles as a preface. The first is an explanation of why backups using HDD as the media and ZFS/zxfer as the software can be cheaper, more convenient and have the potential to be just as reliable as tape. The second is a discussion of what sort of hardware to select and what procedures are necessary to bring the reliability to approach the levels found in tape.
1. HDD based backups with ZFS & zxfer – a new paradigm
2. Design considerations for HDD-based backups using ZFS/zxfer
If you find this howto useful, please thank one of these posts.
Some additional notes to readers
I've tested these instructions and accompanying scripts myself a couple weeks ago, going through every instruction and fixing things until they work. I had things roughly working back in FreeBSD 8.0, but I've learned a lot since then. I'm finally in a position where I'm confident enough to release these guides. Over the last two weeks, I've just cleaned the scripts up a bit. Hopefully nothing is broken.
I hope that the path I am showing is sound, or at least sound with some editing. If I sound less than confident it's not because I lack confidence (indeed, I'm confident enough to use them on my own workstation), it's because I think that a cautious attitude in general is the best approach to dealing with system reliability.
That's in part why I'm releasing this here, to get some feedback and end up with a better solution than if I'd just kept everything to myself. If I've done something wrong, please comment. I also urge you to test things thoroughly first on a system that doesn't hold any important data. The BSD disclaimer applies in full to any instructions here.
I will also be posting this guide, now and as it gets modified, on the zxfer wiki. Actually, I'll wait a few days until people comment and the dust settles a bit before doing that.
Do note that while much of what I've done is original work, I've incorporated suggestions from many sources via lots of googling and reading forum posts etc. So thanks to everyone, especially to phoenix for many suggestions such as glabeling drives, recommended rsync options etc, and blazing a path in general. And monkeyboy, for provoking some very valid thoughts about what backups should provide. Constantin Gonzalez provided much help and collaboration with zxfer.
You may also notice that some encryption, particularly on backups will prove useful. It should be easy enough to add instructions for that at a later date.
This guide will be my take on how to install, backup and restore a reliable FreeBSD workstation, or server. What does reliable mean in this context?
- ZFS on everything practical - I want strong hashes on every bit of data so that we can have self-healing, or at the very least know when and where we have an error.
- ZFS rather than UFS on root. Even though your OS and application files are not your data, they operate on your data. If corruption causes an application or OS to make errors, this may be a problem in and of itself. Corruption can also cause bad data to be written onto your data filesystems. Running ZFS will prevent that.
- Redundancy in all pools, to allow self-healing and time to replace faulty drives. This means triple HDD storage mirror, and regular SSD root mirror using reliable and cost effective SSDs.
- Ability to recover from intentional/unintentional file modification. It is my experience that from time to time, many organizations will have a need to access data that is years old and may have been deleted. Thus, we need a snapshot system that can allow recovery of both recently modified files (where the most likely requests for archived data will come from), and also arbitrarily old files, while balancing needs for disk storage etc. Hence we will have a Grandfather Father Son (GFS) snapshot scheme in place on your HDD storage mirror. These snapshots are replicated on all of your backup pools.
- A procedure to make proper offsite and offline backups, along with tested restore procedures, that will allow restoration of your data to any point in time you have snapshots for on the backup. Unless you have backups and tested restores of said backups, what you would otherwise build is (IMHO) frankly just a toy.
- Ability to easily restore your operating system + applications, as well as data. My thoughts are that since it takes so long to get a nice functional OS/application install working, you want to be able to restore that as well as the data. Your customers aren't going to be patient while you install everything from your own personal Howtos and then realize that you have left out certain important but undocumented steps that you will need to figure out under pressure and lack of sleep.
- Backup pools are automatically scrubbed before backup takes place to catch failing drives.
- Assurance of end to end data integrity in transfers. e.g. ZFS hashes enable assurance of data integrity on source. Transfer mechanisms are used in ways that ensure that the data written to the destination is checked (via hash, or checksum+hash) with the data that was read from the source. And ZFS hashes on the destination ensure that the data is verifiably the same as it was when written.
What are the additional features of this setup?
- Fast application and OS speed - most OS and application data is kept on a small SSD mirror.
- Cost effective data storage - user data, system backup data, and large and non-speed critical system directories are kept on HDD triple mirror. This is easily sped up with the purchase of another SSD to use as an L2ARC.
- Ability to restore the SSD mirror from the HDD mirror.
- Backups are easy and fast. All that is required is to connect the backup HDD pool via e-SATA HDD dock and backup with one command. Only the snapshots that have changed since the last backup are transferred.
How did I get to this point? Essentially what happened is that I started with this article, sysutils/zfs-snapshot-mgmt and sysutils/zfs-replicate, and then realized that there was a yawning chasm between what I wanted and what existed at the time. Thus, sysutils/zxfer was born from sysutils/zfs-replicate, and these articles here are the rest of it.
I recommend reading the following two articles as a preface. The first is an explanation of why backups using HDD as the media and ZFS/zxfer as the software can be cheaper, more convenient and have the potential to be just as reliable as tape. The second is a discussion of what sort of hardware to select and what procedures are necessary to bring the reliability to approach the levels found in tape.
1. HDD based backups with ZFS & zxfer – a new paradigm
2. Design considerations for HDD-based backups using ZFS/zxfer
If you find this howto useful, please thank one of these posts.
Some additional notes to readers
I've tested these instructions and accompanying scripts myself a couple weeks ago, going through every instruction and fixing things until they work. I had things roughly working back in FreeBSD 8.0, but I've learned a lot since then. I'm finally in a position where I'm confident enough to release these guides. Over the last two weeks, I've just cleaned the scripts up a bit. Hopefully nothing is broken.
I hope that the path I am showing is sound, or at least sound with some editing. If I sound less than confident it's not because I lack confidence (indeed, I'm confident enough to use them on my own workstation), it's because I think that a cautious attitude in general is the best approach to dealing with system reliability.
That's in part why I'm releasing this here, to get some feedback and end up with a better solution than if I'd just kept everything to myself. If I've done something wrong, please comment. I also urge you to test things thoroughly first on a system that doesn't hold any important data. The BSD disclaimer applies in full to any instructions here.
I will also be posting this guide, now and as it gets modified, on the zxfer wiki. Actually, I'll wait a few days until people comment and the dust settles a bit before doing that.
Do note that while much of what I've done is original work, I've incorporated suggestions from many sources via lots of googling and reading forum posts etc. So thanks to everyone, especially to phoenix for many suggestions such as glabeling drives, recommended rsync options etc, and blazing a path in general. And monkeyboy, for provoking some very valid thoughts about what backups should provide. Constantin Gonzalez provided much help and collaboration with zxfer.
You may also notice that some encryption, particularly on backups will prove useful. It should be easy enough to add instructions for that at a later date.