Hi all.
I'm looking for a way to save my system and to restore it if any
problem. Like a ghost.
I've found Ghost for Linux (g4l) but seems not to be in debian-amd64
repository.
Does any one can give my a way to backup and restore my system ?
Partitions can be archived with
# dd if=/dev/hda1 | gzip -9 - - > backup.img.gz
or, if the data is not well compressable anymore, simply by
# dd if=/dev/hda1 of=backup.img
If you want to create CD images you can split the output with
# dd if=/dev/hda1 | gzip -9 -c | split -b 600m - /mnt/hdb7/backup.img.gz
To compare backup and original:
# cat /mnt/hdb7/backup.img.gz* | gzip -d | cmp - /dev/hda1
To restore the images:
# cat /mnt/hdb7/backup.img.gz* | gzip -d | dd of=/dev/hda1
The uncmpressed image can be mounted with
# mount -o loop=/dev/loop0 backup.img /mnt
By doing so it is possible to access single files or directories without restoring the whole image.
For imaging a NTFS partition:
# ntfsclone --save-image --output ntfs-backup.img /dev/hda1
If you want to clone an image from one PC to another via the network you can use netcat. The whole command chain would look like:
For the destination PC:
# netcat -l -p 9000 | ntfsclone --restore-image --overwrite /dev/hda1
For the source PC:
# ntfsclone --save-image --output - /dev/hda1 | netcat 192.18.0.11 9000
For a bootable partition the master boot record must be recoverd by install-mbr /dev/hda (or fixmbr fom the Windows recovery console). In addition, for a Windows partition you must run a 'repair installation'.