With the system running, you could do this, which does not create a gigantic image of the entire partition but only copies actual data, which can be copied/synced out again.
Another method would be to use tar
to archive and compress the contents into a single file. Tar takes an --exclude-from
argument exactly like rsync
, so you could use it the same way while the system is running. If the partition is < 50% full (so you can temporarily leave a backup there), make a destination directory for it and exclude that with plain --exclude
(see below, and man tar
).
If you have another linux box, you could also mount the partition there (e.g. /mnt/pi-hd
) and then you do not have to worry about excluding the system partitions because they will not exist when the system isn't running. In this case, again assuming there's enough space for the backup on the partition itself, create a place for it and exclude that directory:
cd /mnt/pi-hd
mkdir backup
tar -cjf backup/pi-hd.tb2 . --exclude='backup/*'
The .
in the middle refers to the current directory. If there isn't space on the partition itself, just use an external path and leave the --exclude
out.
To use this latter, just put it in the right place and unpack it:
tar -xjf pi-hd.tb2
If you want copy that out the partition again, use rsync
. It may help to create a temporary directory, copy a few files in, and practice with that to get the hang of how this works.