NTFS Disk Recovery
|
Submitted by SkipFrizzell (Contact Author) (Forums) on Wed, 2010-02-10 18:04. :: Backup | Storage | Other
NTFS Disk RecoveryVersion 1.0
1 SituationMary, the daughter of a friend is in college: her Windows XP laptop constantly reboots and, we suspect, has a bad hard drive. The system will boot a live CD (Ubuntu 9.10 Karmic Koala Desktop), and data on the hard drive can be read. During boot, the live CD identifies disk errors and tries unsuccessfully to repair them.
2 BackupSecuring the information on the hard disk is priority #1. We don't know what's wrong with the disk, so we need to make a backup disk image before we attempt a repair. From a command prompt a directory is created at /media/server on the laptop's live cd environment to mount a drive share to back up the laptop hard disk. The server has previously been configured with an NFS share, but the live CD doesn't have the NFS client installed. Fortunately the Ubuntu live CD can download and install programs from the apt repository. LiveCD$ sudo apt-get install portmap nfs-common Now that the nfs client is installed we can mount the share and have a place to put the disk image LiveCD$ sudo mount server:/storage/share /media/server Now the share on server looks like a local partition mounted at /media/server we can create our disk image. LiveCD$ sudo fdisk -l Disk /dev/sda: 250.0 GB, 250000000000 bytes fdisk -l shows us the hard disk is /dev/sda and that there is one NTFS partition. Now we can use dd to create a disk image. Caution: dd allows you to read from and write to a device directly. A careless command here can destroy your data. Measure twice and cut once. LiveCD$ dd if=/dev/sda of=/media/server/laptop_disk.img Normally, dd takes a while to make a disk image but we get a disk error almost immediatly and dd aborts. Fortunately there is ddrescue, actually there are two ddrescue programs, we are using the GNU ddrescue program. ddrescue works almost exactly like dd, except that it is intended to work on faulty drives and can compensate for disk errors. ddrescue does not come on the live CD and is not available in the APT repository, but we can download it from the web, place it in the already mounted nfs share and install it from there. LiveCD$ sudo dpkg -i gddrescue_1.11-1_i386.deb ddrescue successfully images the disk. The next task is to make a copy of the disk image so that, in the event that an attempt to fix the disk image goes bad we can, at least, get back to this point with a minimum of effort. We will do all our work on the image (mary_inspiron_6000.img), and keep the original (mary_inspiron_6000.img.orig) untouched as an archive and reference. LiveCD$ cp -p mary_inspiron_6000.img mary_inspiron_6000.img.orig Now comes the fun part, looking to see what we can save.
3 RecoveryRecovery goes surprisingly well, with one exception that I'll detail later. I mount the working image (mary_inspiron_6000.img) as the d drive on a virtual Windows XP machine I have set up for disk recovery and run a variety of tools against it. diskpart gives information on the disks and their partitions on Windows XP C:\Documents and Settings\sfrizzell>diskpart DISKPART> list disk Disk ### Status Size Free Dyn Gpt DISKPART> select disk 1 Disk 1 is now the selected disk. DISKPART> detail disk QEMU HARDDISK The first tool I use is chkdsk.exe, "Chkdsk.exe is a command-line tool that verifies the logical integrity of a file system on a Windows XP Professional volume." C:\Documents and Settings\sfrizzell>chkdsk /r d: The type of the file system is NTFS. Chkdsk repairs the volume, now we reverse the backup procedure and use dd across the nfs share to copy the repaired image back to a new hard drive. Now it is time to test the repaired partition and see if it will boot. SUCCESS! the disk boots and we now have a repaired system. Now that we have the system repaired, it's time to discuss that problem I mentioned that we would get to later. The image has been placed on a new hard disk that is much larger than the image we have 93 GB of free space we would like to be able to access. Although Windows reports the paritition as healthy the Linux tools I used to try and extend the partition all reported an error that prevented them from extending the partition. Fortunately, Microsoft provides a tool for extending a disk partition. diskpart will extend an existing partition into free disk space, but does not extend system partitions. No problem, using a USB to Hard Drive cable the disk can be attached to an existing system. While attached to that system it is not the system drive and can be extended easily and surprisingly quickly. DISKPART> list volume Volume ### Ltr Label Fs Type Size Status Info DISKPART> select volume 2 DISKPART> extend DISKPART> list volume Volume ### Ltr Label Fs Type Size Status Info After the disk is placed back in the laptop it boots and works without a problem.
4 ConclusionLinux provides an extremely versitile toolbox for repairing problems. It accomplishes this, in many cases, by bypassing the structure of an operating system and addressing the hardware directly. It's neworking allows information to be passed between machines quickly and efficiently and the virtualization makes it possible to present as other operating systems and environments. With all of Linux's strengths, in some situations bypassing the operating system is not the best solution and a Windows system command is the proper tool for the job. While all this is exciting and enjoyable from a technical standpoint, the important thing is that Mary's laptop is working again and she can go back to school and be successful.
5 Links
6 FAQQ: Why do you didn't use System Rescue CD?
|



Recent comments
1 day 8 hours ago
1 day 11 hours ago
1 day 13 hours ago
1 day 14 hours ago
1 day 16 hours ago
1 day 17 hours ago
1 day 18 hours ago
2 days 10 hours ago
2 days 11 hours ago
2 days 15 hours ago