1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-24 15:12:00 +00:00

Add instructions for zerofree

This commit is contained in:
Milkey Mouse 2017-11-09 20:36:39 -08:00
parent 454317dc02
commit f9ed3b3ed7
No known key found for this signature in database
GPG key ID: C6EF5A02F5647987

View file

@ -103,9 +103,30 @@ Restoration is similar to the above process, but done in reverse::
DISK=$(losetup -Pf --show /path/to/disk/image) DISK=$(losetup -Pf --show /path/to/disk/image)
# do backup as shown above # do backup as shown above
sync $DISK
losetup -d $DISK losetup -d $DISK
Using zerofree (ext2, ext3, ext4)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
zerofree works similarly to ntfsclone in that it zeros out unused chunks of the FS, except
that it works in place, zeroing the original partition. This makes the backup process a bit
simpler::
sfdisk -lo Device,Type $DISK | sed -e '1,/Device\s*Type/d' | grep Linux | cut -d' ' -f1 | xargs -n1 zerofree
borg create --read-special repo::hostname-disk $DISK
Because the partitions were zeroed in place, restoration is only one command::
borg extract --stdout repo::hostname-disk | dd of=$DISK
.. note:: The "traditional" way to zero out space on a partition, especially one already
mounted, is to simply ``dd`` from ``/dev/zero`` to a temporary file and delete
it. This is ill-advised for the reasons mentioned in the ``zerofree`` man page:
- it is slow
- it makes the disk image (temporarily) grow to its maximal extent
- it (temporarily) uses all free space on the disk, so other concurrent write actions may fail.
Can I backup from multiple servers into a single repository? Can I backup from multiple servers into a single repository?
------------------------------------------------------------ ------------------------------------------------------------