Become A System Rescue Guru With Linux, Part 1 - page 3
SystemRescue CD, the Ultimate Rescue Power ToolIf your hard drive is in its death throes, the fastest and most reliable method of rescuing your data is to connect a second hard drive and copy everything to it. If you don't want to open the case and hassle with connecting an internal drive, you have several good external drive options. You can get a standalone USB/Firewire drive. There are external enclosures for single SATA/PATA drives. You can get a USB-to-PATA/SATA adapter, with a power connector. These are nice for rescue operations because some models will take both 2.5" and 3.5" drives, and both SATA and PATA drives, so you can use whatever hard disk you grab first. The external drive must have a filesystem on it, which you can create from SystemRescueCD with GParted.
When the extra drive is ready, create a directory to mount it in, then mount it and copy your files. In this example the sick hard disk is /dev/sda, and the external drive is /dev/sdb. We're going to save /etc/ and /home:
% mkdir /mnt/sickly % mkdir /mnt/rescue % mount /dev/sda1 /mnt/sickly % mount /dev/sdb1 /mnt/rescue % cd /mnt/sickly % cp -r home/ etc/ /mnt/rescueDo not mount anything in mnt or bad things will happen; always create a new mountpoint.
ddrescue has a lot of command options, but this simple invocation does the job just fine:
% ddrescue -r3 /dev/sda1 /dev/sdb1 rescue-logfileThat tells it to run three times, and to copy whatever it can from /dev/sda1 to /dev/sdb1. The partition you're copying to should be half again as large as the source partition so you have a safe margin to operate in. The logfile can be named whatever you want. Using a logfile requires more disk space, but it's your insurance against interruptions and crashes.
Then run the appropriate version of fsck for your filesystem on the copy, not on the original. For extra insurance, make a copy of your copy first. Then mount it read-only and see what you were able to save. This example is for Ext3:
% e2fsck -v -f /dev/sdb1 % mkdir /mnt/ddrescued % mount -o ro /dev/sdb1 /mnt/ddrescuedYou'll probably want to install ddrescue on another system so you can read the dommed info pages, which are much more detailed than the man page. (Yes, we hates info pages and crippled man pages.) SystemRescueCD doesn't include an info reader.
Come back next week to learn how to perform rescue operations over the network.
- DataRecovery; an excellent Ubuntu help page on using advanced tools to recover data from damaged files
- Skip Ahead
- 1. SystemRescue CD, the Ultimate Rescue Power Tool
- 2. SystemRescue CD, the Ultimate Rescue Power Tool
- 3. SystemRescue CD, the Ultimate Rescue Power Tool
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: GNOME 3.12 and New Betas for Ubuntu 14.04 and OpenMandriva Lx 2014.0
- 2Linux Top 3: Linus Lashes out, Linux 3.14 Gets PIE and Ubuntu One is Done.
- 3Linux Top 3: Ubuntu 14.04, Debian Gives Squeeze More Life and Red Hat Goes Atomic
- 4Linux Top 3: CoreOS, Oracle Enterprise Linux 7 and Ubuntu 14.10
- 5Linux Top 3: Debian Dumps SPARC, Ubuntu Takes Over Linux 3.13 and the Core Infrastructure Initiative