1

I have linux installed on this laptop. It has 320G HD. I want to experiment something and for that i will have to format my hard disk. I have got a spare 500G USB External Drive. Can someone suggest me a backup method with which i could take a complete backup of current state of the system and later restore it without any issues?

I myself have two options in mind:

  • dd
  • clonezilla

Here is my fstab

Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sda7     ext3     19G   12G  6.0G  67% /
/dev/sda6     ext2    2.3G  261M  2.0G  12% /tmp
/dev/sda2     ext2     89M   45M   40M  54% /boot
/dev/sda5 reiserfs    4.9G  614M  4.3G  13% /var
/dev/sda8     ext4    264G  133G  132G  51% /home
2

Why is dd or similar not an option?

If it is because it will take too much space to store the pure image, then you can pass the image through gzip with something like pv /dev/sda | gzip -c > /path/to/destination/image.gz (assuming sda is the drive you want to image for later restoration). Obviously this need to be run while everything on that drive is mounted readonly or completely unmounted (i.e. the copy is done from a live-CD, a USB based live distro, or a Linux install on another drive if you multi-boot).

To maximise the compression you get, zero the free-space on each filesystem first with pv /dev/zero > /mountpoint/zero.file; rm /mountpoint/zero.file.

[pv mentioned above is pipe viewer, available in most standard repositories I assume (it is present in recent Debian repos, certainly) - you can replace it with cat or standard redirection if you wish, but the progress display that pv gives is useful for potentially long operations like this]

13
  • could you explain this method in detail? or point me to some links? Plus what should a take a dumb image of? i mean its not alright to take image of /proc or /sys or is it in this scenario? – Shoaibi Nov 8 '09 at 20:19
  • Furthermore i have pastebin.com/m5db89a7f , if i do what you suggest, won't i have to recreate partitions in the exact same size for restoration process? – Shoaibi Nov 8 '09 at 20:42
  • 1
    If you backup the block device /dev/sda using the above technique, you will backup the entire of that drive (i.e. all the filesystems listed in that fstab file). Backing up the block device in this way is completely filesystem agnostic - it is just backing up the bits on the disk not caring what they represent the same way copying with dd does. – David Spillett Nov 8 '09 at 21:21
  • 2
    You'd only have to recreate partitions if you use dd to take images of the partitions. By imaging the whole disk (/dev/sda, not /dev/sda1), you get the partition table and MBR as well. – Dentrasi Nov 8 '09 at 21:21
  • 1
    ps. you shoudl add pertinant information to your question, or in a comment, directly insted of using external services like PasteBin. Nothing wrong with pastbin per say, but it is better to keep the entire question/answer flow in the one site. – David Spillett Nov 8 '09 at 21:23
1

I would recommend Clonezilla. I've used it quite a few times and had good results. However, a backup is only as good as it's ability to be restored, so you'll need to test the restore. Clonezilla can be a little daunting to a first time user, so either read the manuals really well and trust that your restore will work, or try it on a test system if you can.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.