Windows 7 - How to repair Bad Sectors reported by Chkdsk.
If you plan installing Windows 7 on a new hard drive or already have installed Windows 7 then read on as you may be in for a big surprise. This article was developed specifically for a laptop user who I’ll call John. However the technique is also valid for all Windows 7 desktop or laptop computers.
John discovered his Windows 7 laptop hard drive has one or more bad sectors when he ran Check Disk (chkdsk /f /r) which was perpetually freezing at stage 5 of 5 when about 45% complete, each and every time he tried. Stage 5 is the scanning of the drives free space.
Since John had upgraded from Vista to Windows 7 there is no way of knowing for certain when his problem with the hard drive first occurred, however when using drive analysis software the S.M.A.R.T. values indicated no problems and neither did a surface scan. John also ran the drive manufacture’s diagnostics software which also showed no drive problems.
Using Windows 7 Disk Management ‘Shrink’ and ‘Expand’ we were able to narrow down the location of the bad sector and created a temporary 40GB partition named ‘Test’ which included that bad sector. John then ran a zero fill operation on the 40GB ‘Test’ partition which may sometimes eliminate ‘soft’ sector errors. In this case it did not, which in essence means the bad sector is a ‘hard’ sector error. It should be noted that a hard sector error may over time result in additional sector errors indicating your drive is failing and should be replaced.
Drive format refresher course: There are two types of formats, ‘Full’ or ‘Quick’ for creating NTFS partitions. The disadvantage of a ‘Quick’ format is that bad sectors are not identified therefore they can not be mapped out. With a ‘Quick’ format only the MFT is created for the partition and it is assumed the partition does not have any sector issues.
The advantage of performing a ‘Full’ format when a drive is being prepared for use is that if a bad sector is detected it is mapped out and a spare sector is mapped in to replace the defective sector or sectors. This remapping information is stored in the NTFS partition’s Master File Table (MFT) so there is no chance of writing a file to the defective sector. Note that all drive manufactures have an area located on the drive which contains spare sectors if they are needed.
Windows 7 only performs a ‘Quick’ format: The Windows 7 installation software however is only capable of performing a ‘Quick’ format when performing a “Custom” install. You have the option to create partitions, however you do not have a choice of ‘Full’ or ‘Quick’, its Quick only. Therefore should the drive contain one or more bad sectors in an area utilized by Windows 7 during the install process you can expect to encounter any number of problems such as error messages, freezing and failing to complete or even crashing.
In fact as I was about to finish this article a friend of mine called to describe his experience with a clean install of Windows 7 using an unused fresh out of the box disk drive. Windows 7 installed without any apparent problems but blue screened on reboot and a repair install failed to return Windows to a bootable state. I explained about the bad sector issue and the use of a “Quick” format. So he ran the manufacture’s hard drive diagnostics which reported numerous bad sectors at the beginning of the hard drive. As you will learn shortly the very first part (100MB partition) of a drive is used by Windows 7 for the BCD store. This explains why the repair install failed as in all likelihood one or more bad sectors are located inside this area of the drive.
Windows XP provides both format options ‘Full’ and ‘Quick’: When performing a “Clean” install, you not only have the option to create partitions sizes and types (NTFS or FAT32), but also the choice of a ‘Full’ or Quick’ format. Take the extra time to perform a full format of the drive as part of the install process, any bad sectors will be mapped out and you just may be spared the agony of a failed or flawed installation of Windows.
We will take advantage of XP’s formatting abilities and the use of Image Backup software to solve John’s bad sector issue. Note that the use of an Image Backup and Image Restore in itself will not solve the problem since the same Master File Table with the bad sector will be restored. To succeed the bad sector must be marked and mapped out before Windows 7 is restored, more on this later.
John deleted the ‘Test’ partition so that all remaining space (including the area that contains the bad sector) is now shown as ‘Unallocated’ in Disk Management. This should leave you with the System, Windows, Unallocated space (which contains the bad sector) and in John’s case a small Backup partition located at the end of his laptop’s hard drive.
For anyone else reading this article you need to locate that bad sector and hope that you can shrink the Windows 7 partition so that the bad sector is now part of and located in the drive’s unallocated space. This may require that you defragment the hard drive using software utilities like ‘MyDefrag’ and ‘PerfectDisk’ which have the ability to move the Windows files up to the front of the partition and also perform a boot time defrag required to move the existing MFT area closer the front of the Windows partition. For the partition shrink operation to have the best results no files should be located near the end of a partition as it will severely limit how much you are able to shrink the partition.
Create a bootable Windows XP CD as follows. How to Build the Ultimate Boot CD for Windows: http://www.ubcd4win.com/howto.htm “UBCD4Win is a bootable recovery CD that contains software used for repairing, restoring, or diagnosing almost any computer problem.” The feature we are interested in is the ability to delete, create and format an NTFS partition using the “Full” format option. It should be pointed out that two other software utilities (freeware) were also tested with unsatisfactory results; therefore UBCD4Win is the only software I can recommend at this time.
Follow the instructions carefully when creating the UBCD4Win bootable CD. Also your original Windows XP CD must be SP1 or later, Windows XP gold will not work for our purposes.
After you create the bootable CD verify that you can boot to Windows using the CD, the initial boot screen will have its own interface and options, however the option we will using is similar to the Windows XP desktop.
Note: You may need to change the BIOS settings so that the CD/DVD drive is listed as the first boot device followed by your hard drive.
In the upper left of the Ultimate Boot CD desktop you should see the 'My Computer' icon. Right click and select 'Disk Management' and verify that you can see the same drive partition information you did when you used Windows 7’s ‘Disk Management’.
Don't do anything at this point just verify you can boot from the CD and that 'Disk Management' displays your hard drive partitions correctly. Then remove the CD from the optical drive and reboot to Windows 7.