A snapshot of your computer with dd, pv and gzip - Part 1
allgood38.github.io
allgood38.github.io
I normally run it off a live CD/USB of Parted Magic [2], another tool I can wholeheartedly recommend.
http://www.sysresccd.org/System-tools
I've used the imaging tools on the boot cd a few times to clone/restore hosts a few times without any issues. Very handy.
If you want a bit-for-bit dump of an online filesystem, use Linux LVM to create a snapshot, then make an image of that (100% known crash-consistent) copy.
dd if=/dev/da0 | ssh user@rsync.net "dd of=backup.dd"
or maybe:
pg_dump -U postgres db | ssh user@rsync.net "dd of=db_dump"
pv /dev/da0 | ssh user@rsync.net "dd of=backup.dd"
(1) Defrag - built-in / maybe SysInternals contig http://technet.microsoft.com/en-us/sysinternals/bb897428
(2) Defrag the page file - SysInternals PageDefrag http://technet.microsoft.com/en-us/sysinternals/bb897426
(3) Zero unused space - SysInternals SDelete http://technet.microsoft.com/en-us/sysinternals/bb897443.asp...
(4) Shrink volume (if backup is filesystem-aware, and disk is one large volume) - http://technet.microsoft.com/en-us/magazine/gg309169.aspx
(5) After transfer, expand volume to fit target disk
Pretty much any utility automating these steps is acquired by the various virtualization vendors, or heads directly to the enterprise market (kind of like how inexpensive screencast creation software always disappears!).
Actually with the current RAM prices you don't need one at all.
This reminds be of doing a tar archive of all your files--if the archive is corrupted during that process, what then?
Then I use rsync to copy all my 'stuff' back off a large external hard drive to the 'clean' installation. I try not to change OS to often :-)
Subsequently I use rsync with --delete set to sync the home drive only to an external drive of similar capacity to the computer drive for daily changes. This drive is ex4 and preserves ownership and permissions, and includes dotfiles.
Once a week there is rsync without --delete to a large external hard drive as 2nd backup. This drive is NTFS and does not preserve permissions and excludes dotfiles.
I have a free dropbox account for really crucial 'working' files. That gets rsync'd to a FAT32 stick each day using the 'time window' command so it does not write everything each time.
Basically the clonzilla whole drive backup is just to save time/bandwidth with re-installing and setting up. The rsync backup to the large drive is file readable on work PCs that use Windows should disaster strike. The 'sync' to the small hard drive is readable at file level on anything I can boot from a live CD.
Now, a bootable whole disc image would be of interest now and again.
On the restore side, you can just use pv like cat, and don't have to provide a size param:
pv my.img.gz | pigz -d | dd (or hopefully tar xf - instead)...
In an ideal world a tool like pv could just look at /proc/fd/fdinfo/ instead of shuffling all the data through itself but I haven't found a tool that clever yet.I use rsync to back up certain folders. I'm OK with re-installing Linux if my hard drive crashes.
I've actually been able to restore to a drive, and when it boots its as though nothing ever happened. Plus its fast.
Its eerie to turn the computer on after knowing you formatted the drive for whatever reason, and your desktop pops up again.
They then suggest you can mitigate this by writing zeros to a file before rm'ing it. However, this is slow in the general case, and doesn't help if you've already rm'd the file.
As an alternative, the 'sfree' utility, available in the debian package 'secure-delete', can be used to fill the unallocated portions of a disk with zeroes (or random data).
sfree -llz <disk device>
will write zeroes to the free areas of a disk. -ll limits it to only one pass over the disk, and -z makes that pass write zeroes, instead of random data.
man page: http://manpages.ubuntu.com/manpages/lucid/man1/sfill.1.html
I'll update the article.
I've done something completely silly. I originally wrote this site on github, but then moved it over to a new host on its own domain and totally forgot about the old one.
If you like this article, please check it out here at:
http://allgood38.io/a-snapshot-of-your-computer-with-dd-pv-a...
I just use BackInTime though, like TimeMachine I guess. It's really, really useful.