- wipefs -a <device>
- mkfs.btrfs -L <label> <device>
- UUID=… /local/mount/path btrfs compress,noauto 0 2
The next step we want to cover is how to set up ssh for passwordless connections to the remote computer. For my setup, serverpc is the computer that will host every backup. When I need to change disks, I can quickly shut down serverpc and then bring it back up again (the disks are supposed to hotswap but they seem to fail quite quickly so I have been given to coldswapping).
This means serverpc needs the openssh-client package installed and each target computer (mainpc and mediapc) needs openssh-server installed.
My current backup scheme assigns a pair of 2 TB disks to backup mainpc and a combination of a 2 TB disk and two 1 TB disks to backup mediapc and serverpc so there are two sets of disks for each. And that’s without making use of rdiff’s differential backup capability for multiple generations per disk.
Using the instructions from my previous post I need to follow these steps after installing the respective packages on each computer.
- On serverpc create the key pair for SSH:
- ssh-keygen -t rsa
- The file will be saved in .ssh/id_rsa
- Press enter to put in an empty passphrase when prompted (twice)
- Use serverpc to ssh into the target (mainpc in this example) and create the directory there for the key to be copied to.
- ssh user@a.b.c.d mkdir -p ssh
- Enter yes when asked to continue connecting
- Enter the password for that user on the remote system when prompted
- Copy the public key from serverpc to target
- cat .ssh/id_rsa.pub | ssh user@a.b.c.d ‘cat >> .ssh/authorized_keys’
- Enter the password for the user on the remote system when prompted
- Ensure the correct permissions are set on the remote filesystem
- ssh user@a.b.c.d “chmod 700 .ssh; chmod 640 .ssh/authorized_keys”
- Enter the password for the user on the remote system when prompted
- Test the login to see that no password is needed
- ssh user@a.b.c.d
Finally I can do my backups with rdiff-backup. All computers need to have the rdiff-backup package installed and the same versions preferably.
Usually what I do is mount the disk and then change into the directory I want the backup to go into. Then I can use these types of commands to do the backup:
- To backup one of the remote systems using SSH to connect to that system
- rdiff-backup -v5 user@a.b.c.d::/path/to/files .
- This is telling rdiff-backup to use verbosity level 5, and the files will be backed up to the current directory, assuming I changed to that directory as mentioned above.
- To backup serverpc’s local files:
- rdiff-backup -v5 /path/to/files .
- Again we assume the current directory is the backup path.
As a precaution, when I reinstalled Debian, I set up a separate partition for /mnt on the backup host computer, with a size of 100 MB.