pwrusr.com

  • Home
  • Download
  • About
  • Contact

[amatesi@pwrusr.com:~]$->  sudo su

Andrea Matesi

My name is Andrea and I'm a flexible ICT specialist. I use this blog to catalog and organize my various activities, helping me not to forget. English is my favourite language, although everyone is welcome.

View Andrea Matesi's profile on LinkedIn

Support my blog <3

Tweets by @amatesi

feel free to middle-click any of these…

tricks under my sleeve.

ActiveFTP+NAT+iptables add-raid1md2running at 12.45 halt +ctrl+shft+d burnISO-RClick=isorecorder.alexfeinman.com CentOS-Upg debian usb boot dec2bin grub-splashimages h-v-fast-diff-vm-deployment hw-loop-adapter ie:jscript=actve-scrptng ifcfg-eth0=1:etc-syscfg-nw-scripts-ifcfg-eth0 ifcfg-eth0=2:ln etc-syscfg-nw-scripts-ifcfg-eth0 etc-syscfg-nwking-devs ifcfg-eth0=3:ln etc-syscfg-nw-scripts-ifcfg-eth0 etc-syscfg-nwking-profiles-default ipconfig /flushdns Joomla joomla-flsh-intro LANdebian mirror lvm-scan:vgscan | vgchange -a y m6600 ncq ich9 ahci xp nocti120 ntfsclone1:dmpPartTable=sfdisk -d /dev/sdb > /bck/partition-table.dmp nwn2+wine nwn2-motb-wine ospf-easy-topo phpmyadmin-adminer pwdless-putty pwdless-ssh pwdless-sshd+freenx rbt-2210 ubuntu rndc flush rsync -aHvzh --progress SRC DST scancodemap-disblPgUpPgDn ssh-keygen -b 4096 svchost.exe-groups:tasklist /svc svchost.exe-reg:HKLM-SW-MS-WinNT-CurVer-Svchost synology-block-lvl-synch sys-restore-Win2k8r2 ubu-upg sudo do-release-upgrade win-pwd-reset WinDevMgrErrCode31 xhtml xp-clone2nwhdd+sysprep+new-mb xp-ide2sata-clone+hack

Andrea on Google+

Creative Commons License
This work by Andrea Matesi is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

How to perform a data restore from a broken hdd with linux.

April 8th, 2012 by Andrea Matesi 43 Views

Background Story.

Dealing with networks, computers and datacenters, no matter what, the "inevitable" happens.
Even if mini-pcs weren't originally designed for takeoff, someday one of them popped dangerously from the shelves and finally hopped down for 2+ meters (not my fault BTW).

The unattended launch and consequent hard landing brought its (un)expected inconveniences, like a crackling hard disk drive and an unbootable machine (well, this is bad: unbootable even without hdd!).

Who knows if a carpet on the datacenter could've helped lessen the situation? Food for thought!

The flying mini-pc was linux-based, so the recovery process simply implied the "successful" cloning of the data into another hdd AND a brand new mini-pc (fortunately I had a spare one).

Anyway, I was lucky to end up with a semi working hdd; if yours is not recognized by the BIOS, then use the backups and rebuild the hard way (sorry!), or, if you don't have any backups, you are screwed! you have to decide, based on the information value contained on the hdd, if it is worth to perform a professional data recovery from a service firm like ontrack.

I extracted the broken disk from the broken mini pc and inserted it into an usb carry case, I then took another usb box and filled it with a brand-new hdd, both connected to a working, LVM-enabled, linux box.

The FIX Process.

After recognizing the LVM VG ("vgscan | vgchange -a y") and fsck-ing the broken partitions (you know how to fsck, aren't you?), I tried to dd data from one disk to the other:

dd if=/dev/sd-broken of=/dev/sd-new

Unfortunately dd stopped working at first error sight, spitting I/O errors and quitting its job immediately.

I discovered that adding the "conv=noerror,sync" options to the previous command allowed dd to override disk errors and put zeros on their place.

If you desire additional automation (and less details), Mr. Antonio Diaz coded an automated tool capable of restoring the restorable.

This tool is called ddrescue and will, essentially, perform what the previous dd command would, with the additional benefits of a more verbose screen output, a browseable log file and some powerful internal defaults that needn't be tuned.

The only inconvenience to this is that you should be prepared for the extra time (in fact, plenty of extra time, depending from your hard disk drive size and/or the number of bad blocks/broken sectors encountered).

Sources and bibliography:
http://en.wikipedia.org/wiki/Bad_sector
http://www.cgsecurity.org/wiki/Damaged_Hard_Disk
http://www.linuxweblog.com/blogs/sandip/20050211/image-your-hard-drive-using-dd
http://mirror.lihnidos.org/GNU/savannah/ddrescue/

Posted in LINUX, System Administration | No Comments »

Typography++ by Andrea Matesi design by Six Shooter Media Sponsored by Web Hosting Provider