If I know that a hard disk has bad sectors, how can I "mark" them so that Windows 7 doesn't write to them when I copy files and stuff?
According to Microsoft, running a regular (or full) format (as opposed to a "quick" format) on a partition will mark all bad sectors within the partition (emphasis mine):
When you choose to run a regular format on a volume, files are removed from the volume that you are formatting and the hard disk is scanned for bad sectors. The scan for bad sectors is responsible for the majority of the time that it takes to format a volume. source
In Vista and later, this is accomplished by writing zeros to the entire partition.
Running a full format on a disk is as simple as right-clicking on the disk, selecting Format, and unchecking the quick format box:
Note that a full format takes a lot more time than a quick format. The time scales with the size of the disk (i.e. big disks will take more time to format than small ones).
This is done automatically by the OS and NTFS. To check this now, just run CHKDSK. Any bad sectors are marked and are not used. CHKDSK /R will try to recover the bad sector.
One (of several!) ways to get there: open Windows Explorer; right click on the drive and select Properties from the context menu; select Tools tab; select Check Now. This runs on the next reboot because it can't make changes to files that are in use.
Note: You must be logged in on an administrator account to check your disk at this level. You may also get a UAC prompt.
If you want to run CHKDSK directly:
- Click on Windows Start button; type
commain the search box; select
Command Promptfrom the list to open a Command Prompt window (or right click on it; select Run as administrator from the context menu; etc.)
CHKDSK /?to get a list of options (upper or lowercase doesn't matter).
CHKDSK C: /F /Rto check your C: drive for errors and automatically repair them.
- Restart so scan runs.
I assume you're referring to a standard rotating hdd with NTFS format (though FAT isn't really different for this answer). Solid state drives handle this problem internally.
A few bad sectors (typically size of 4k but even 64k if optimized for storing large files) on a 50 GB, 500 GB, or 2 TB disk is not worth worrying about (and if the drive is only a few GB, maybe it is time to replace it).
I suppose if you really want to fiddle, you could partition around the bad tracks that contain the bad sectors (so the read/write heads don't pass so directly over them) but if your time is worth a more than $1/day or you're that worried, consider buying a new disk. I think I've seen some software that semi-automates this but I have a hard time coming up with a scenario where I would want to do this. (I look forward to seeing good stories in the comments though!)
From Command Prompt
chkdsk /? CHKDSK [volume[[path]filename]]] [/F] [/V] [/R] [/X] [/I] [/C] [/L[:size]] [/B] volume Specifies the drive letter (followed by a colon), mount point, or volume name. filename FAT/FAT32 only: Specifies the files to check for fragmentation. /F Fixes errors on the disk. /V On FAT/FAT32: Displays the full path and name of every file on the disk. On NTFS: Displays cleanup messages if any. /R Locates bad sectors and recovers readable information (implies /F). /L:size NTFS only: Changes the log file size to the specified number of kilobytes. If size is not specified, displays current size. /X Forces the volume to dismount first if necessary. All opened handles to the volume would then be invalid (implies /F). /I NTFS only: Performs a less vigorous check of index entries. /C NTFS only: Skips checking of cycles within the folder structure. /B NTFS only: Re-evaluates bad clusters on the volume (implies /R) The /I or /C switch reduces the amount of time required to run Chkdsk by skipping certain checks of the volume.
If you didn't dropped drive and you have just 1-2 have bad sectors:
1) Scan with HDtune then find bad sectors
lba (ex : 10000000)
2) Download HDDreg.iso , write to USB Flash drive (or CD) and boot from it > select your disk > select option 3 ( regenerate all sectors in range ) > write
lba and start operation .
3) Then rescan with HDtune : If didn't fixed , format drive with windows, but don't thick "Quick format" checkbox (When it formats , it will hide sector).
4) If still didn't fixed,try this - install hard disk sentinel > select disk > open surface scan > select "reinitailize disk surface" and start test. It will remap bad sector to spare area . "Reallocated sectors" SMART attiribute will improve