Recovering from disk failures

Data recovery
Data recovery

As you might know, disk drives, specially in high usage areas like hosting enviroments, have a tendency of crashing from time to time.

Most crashes you will encounter are related to bad blocks on your hard drive which in some cases will stop your operating system from booting, leaving your server at a stop. There are several utilities which can help you detect and fix the bad blocks at a software level, like the FSCK(file system check) available for Linux, or CHKDSK and SCANDISK for Windows, however there are situations when the bad block can’t be fixed, most of the cases due to a critical error.

While this doesn’t happen constantly or too often, it would be nice to think that there might be ways to recover data that might be business critical, and here is how:

DDRescue is recovery tool that will help you create an image of your hard drive, skip the bad blocks, and restore it on another hard disk! It copies data from one file or block device (hard disc, cdrom, etc) to another, trying hard to rescue data in case of read errors. While this utility mostly runs on unix systems, it can deal with any type of disk drive data, whether it’s a linux system, windows, mac osx or something else.

We found this article to be fairly instructive giving all the restore procedures to handle a hard disk failure recovery.

If you are lucky, and the bad blocks were not containing some important booting data, your new cloned hard drive could be popped inside the server and ready to boot from it, resuming your server activity! If not, well you are still lucky 🙂 you just need to do some more work to get the server up and booting again, fairly a system administrator job.

There are also hardware failures, when your hard disk might become unaccessible at a hardware level, in which case the best way to do is ship it back to the manufacturer company and let them replace the faulty parts, your important data might still get saved.

Best and always, make sure you always keep proper backups of your important data. Good luck!

DDRescue help: ddrescue -h

GNU ddrescue - Data recovery tool.
Copies data from one file or block device to another,
trying hard to rescue data in case of read errors.

Usage: ddrescue [options] infile outfile [logfile]
You should use a logfile unless you know what you are doing.

Options:
  -h, --help                    display this help and exit
  -V, --version                 output version information and exit
  -b, --block-size=      sector size of input device [default 512]
  -B, --binary-prefixes         show binary multipliers in numbers [SI]
  -c, --cluster-size=  sectors to copy at a time [128]
  -C, --complete-only           do not read new data beyond logfile limits
  -d, --direct                  use direct disc access for input file
  -D, --synchronous             use synchronous writes for output file
  -e, --max-errors=          maximum number of error areas allowed
  -F, --fill=            fill given type blocks with infile data (?*/-+)
  -g, --generate-logfile        generate approximate logfile from partial copy
  -i, --input-position=
    starting position in input file [0]
  -m, --domain-logfile=   restrict domain to finished blocks in file
  -n, --no-split                do not try to split or retry failed blocks
  -o, --output-position=
   starting position in output file [ipos]
  -q, --quiet                   suppress all messages
  -r, --max-retries=         exit after given retries (-1=infinity) [0]
  -R, --retrim                  mark all failed blocks as non-trimmed
  -s, --max-size=        maximum size of input data to be copied
  -S, --sparse                  use sparse writes for output file
  -t, --truncate                truncate output file to zero size
  -T, --try-again               mark non-split, non-trimmed blocks as non-tried
  -v, --verbose                 verbose operation
Numbers may be followed by a multiplier: b = blocks, k = kB = 10^3 = 1000,
Ki = KiB = 2^10 = 1024, M = 10^6, Mi = 2^20, G = 10^9, Gi = 2^30, etc...

Leave a Reply

Your email address will not be published. Required fields are marked *