Adventure with dd

I was about to do a big experiment with with lappi (laptop) which included blanking its HD. Naturally i would have liked to have my current state preserved and restored after the experiment was complete. So the first thing that came to my mind was doing a dd image of whole HD and saving it on a USB Drive. I started looking for alternates, found many cloning softwares like partimage (rejected, only works on partitions, i need something for whole disk), clonezilla, filezilla, PING and etc.

I ended up rejecting almost all of them for one reason or they other(you may call it as a matter of choice or bitchy attitude). Options left with me were dd and gzip. Now the data was around 320G and it included Movies, ISOs, documents and etc (you know what etc means, i am backing up whole hard disk so etc= all linux stuff and non-linux stuff). I dropped gzip because it would have taken more time, and now i am left with dd.  But now i am struck with another dilemma.; dd has no progress bar so how do know the ETA. i found pv and with help of this article it all ends up great (and being totally offtopic, i would like to tell that there are two things that i found heavily and greatly documented on site and in books e.g. FreeBSD and Django and i love both). So i make dd image of whole harddisk and another (cute) little image of my MBR for situations where you say “what if”, “just in case” “why didn’t i” and some “beeped” words.

I went a bit ahead with making backup with dd, as lazy as i am i added a small wav file called complete in usb as well, so now i add “&& aplay /media/usb/complete.wav” to my backup command and set system volume (using alsamixer as i was using single user mode from liveCD) to maximum, unplug my headphones and enjoy playing games on mobile. After about 3 hours its done. Phew! What next?

Start the experiment by formatting the harddisk? Nope, You made a Boo-Boo. Atleast check if the dd images are working. So i reboot, try to mount the dd image and it doesn’t get mount as expected because its a whole disk image containing a lot of filesystems (5 to be exact) and mount can mount one filesystem. So i freak out, but the things good guy “erUSL”, if i am not misspelling his nick, on #ubuntu tells me about losetup, i google it combined with “mount multi filesystem OR partition dd image” and found some great links. I use losetup with kaprtx and everything works out fine (in 40 minutes). While i was at it i found that mdconfig in freebsd does almost same thing as losetup.

So now i reboot, try my experiment, after 48 hours i want my old system state back. Use a live cd, go to single user mode, and start copy dd back to my hd. Reboot and system won’t boot, what? Go again single user mode in live cd, restore MBR and still it won’t boot. *beep* *beep* *beep*? Again boot via live CD, mount the drives, try to chroot and what? No chroot from 32bit to 64bit? what next? i don’t chroot, i open menu.lst and start comparing UUIDs as i had issues in the past where UUIDs changed and system didn’t boot. but UUIDs are all okay. I reboot again, still its not booting, just shows a blinking cursor. Hey, wait! Its not even going to grub, is it even going to harddisk for boot? Damn! its trying to boot from NTFS USB drive which i didn’t disconnect every single time when i rebooted. I remove USB, fix in BIOS (so i won’t worry over this stupid mistake again) and reboot, so here i am all good as before…

In this long story, i learned a lot due to my very basic mistake and from this i yet again learn the lesson that “Start from basics”. You system isn’t working? Is it powered on?

Tags: , , , , , , , , , , , , , , , , , ,

One Comment

  1. Hisham Najam says:

    Th last mistake is the great thing u learned :D Sometimes u just thing wtf! that Simple! LOL :D

Leave a Comment to Hisham Najam