I’ve installed Arch Linux Arm on 1GB flash drive. I want to maintain a backup of the root filesystem in case something goes wrong with the flash, so that I can restore the root filesystem to a new drive/flash and boot my system.
I’ve used rsync utility to maintain a mirror copy of the root filesystem (excluding some directories) on the external hard drive I’m attaching to pogoplug. The advantage of using rsync is that each time you run the backup command, it will just copy what has changed. it’s a sort of incremental backup.
Here is a simple command to perform backup:
(must by run as root)
# rsync -av --delete-excluded --exclude-from=backup.lst / <backup_destination>
- <backup_destination>: is the directory where we want to keep the backup (e.g. /media/storage/backup)
- backup.lst: is file containing list of files/directories to exclude/include. here is a starting list:
# Include + /dev/console + /dev/initctl + /dev/null + /dev/zero # Exclude - /dev/* - /run/* - /proc/* - /sys/* - /tmp/* - lost+found/ - /media/* - /mnt/*
You may add a crontab entry to have the backup run on certain schedule (e.g. daily)
If something goes wrong with the boot flash and you can’t boot into ALARM, you can restore the backup to a new flash using the following steps:
(you need a PC running Linux, or a Linux virtual machine running on any OS)
- Mount the drive that contains the backup (e.g. /mnt/backup)
- Format a new flash drive as if you are going to have fresh ALARM installation, and mount it (e.g. /mnt/new)
- Copy the backup to the new flash drive:
# cp -a /mnt/backup/* /mnt/new
Add a label for the new flash root partition if you are using one:
# e2label <new_flash_root_device> <label>
Finally, boot Pogoplug using the new restored flash.