Makin' backups -- questions

David Christensen dpchrist at holgerdanske.com
Fri Jun 12 06:48:27 UTC 2020


On 2020-06-11 17:01, Ronald F. Guilmette wrote:
> I'm re-writing my backup scripts and could use a bit of advice.
<snip>

I have used rsync(1) for backup and restore of data files for many years.


Similarly, I use cvs(1) to manage my system configuration files.


But I very much doubt that an rsync(1) copy of a live system disk is 
going to be correct.  Excluding anything makes me even more incredulous.


AIUI the traditional Unix backup/ restore process is to shutdown the 
machine, boot a live USB stick or move the source drive into another 
computer, mount the source filesystem(s) read-only, and use dump(8) to 
serialize each filesystem to a file.  Restoration consists of preparing 
a target device with a partitioning scheme, boot loader(s), slice(s), 
partition(s), and/or filesystem(s), and then using restore(8) to 
deserialize the files into the target filesystems.  (See Clonezilla [1].)


The simplest, but least efficient, backup method I have found for system 
drives is to copy the device raw sectors to a file with dd(1) ("take an 
image").  Restoration consists of copying an image file to a target 
device (no preparation necessary, but I typically wipe and test the 
target device first).  This works for me because:

1.  dd(1) is a lowest-common-denominator tool, available on most every 
install/ rescue/ live disc.

2.  I use MBR partitioning, to avoid problems with the GPT backup 
partition table when the source and target device sizes differ.

3.  I keep my system images "small" -- boot track (sectors 0-62), free 
space for 1 MiB alignment (sectors 63-2047), and ~14 GiB slice/ 
partitions for boot, swap, and root.  This allows me to use "16 GB" or 
larger USB flash drives, SD card, SSD's, or HDD's for system drives, and 
two dozen images or more can fit into ~200 to ~300 GB.


David

[1] https://clonezilla.org/


More information about the freebsd-questions mailing list