Difference between revisions of "Backing up disk image via SSH"

From PrgmrWiki
(link to description of getting into the rescue image)
(Redirected page to Backup)
Line 1: Line 1:
backing up new system to another server ...
#REDIRECT [[Backup]]
my current procedure to grab compressed disk image:
* boot to Centos rescue image (described on the [[Password Reset]] page)
* mkdir /tmp/xvda1
* mount /dev/xvda1 /tmp/xvda1
* dd if=/dev/zero of=/tmp/xvda1/big_blank_file
* rm /tmp/xvda1/big_blank_file
* umount /tmp/xvda1
* bzip2 < /dev/xvda1 | ssh me@my.other.server.tld "cat > xvda1_backup.bz2"
(The "big_blank_file" finagling for compressability may be not particularly necessary on a fresh image ...)  With the zero-pad prep, a fresh Debian Lenny image (about 500 MB installed on a 12 GB disk) compresses down to less than 185 MB.  After installing Apache2 and some user data, the disk image compressed from about 750 MB down to about 250 MB - without repeating the zero-pad prep.
Alternatively, you might do something like this:
* boot to Centos rescue image
* e2fsck -f /dev/xvda1
* resize2fs -M /dev/xvda1
* bzip2 < /dev/xvda1 | ssh me@my.other.server.tld "cat > xvda1_backup.bz2"
Which has the added benefit of downsizing the partition to its smallest possible size (i.e., completely full), so if you are restoring to a smaller device, you will not fill up the device with unused space.
(see [[Backup]] for more on backups in general, and [[Restore]] to restore this image)
{{c|Getting Started}}
{{c|User Questions}}

Latest revision as of 19:03, 28 June 2017

Redirect to: