News, tips, advice, support for Windows, Office, PCs & more. Tech help. No bull. We're community supported by donations from our Plus Members, and proud of it
Home icon Home icon Home icon Email icon RSS icon
  • Fred Langa: “My 500 GB hard drive has one bad sector; what does that really mean?”

    Home Forums AskWoody blog Fred Langa: “My 500 GB hard drive has one bad sector; what does that really mean?”

    This topic contains 5 replies, has 5 voices, and was last updated by

     Paul T 3 months ago.

    • Author
      Posts
    • #338843 Reply

      woody
      Da Boss

      Short answer: Not a heckuvalot. Yet another insightful piece from the master. On Langa.com.
      [See the full post at: Fred Langa: “My 500 GB hard drive has one bad sector; what does that really mean?”]

      1 user thanked author for this post.
    • #339216 Reply

      GoneToPlaid
      AskWoody Plus

      I’m not sure what Fred means by one bad sector. Is he saying that his HD has reallocated one bad sector to a spare sector? Or is he saying that all spare sectors for remapping bad sectors have been used up, and that his HD now has one bad (uncorrectable) sector? If his answer is yes to the first question, then obviously that is no big deal. If his answer is yes to the second question, that is a really big deal.

      1 user thanked author for this post.
    • #339235 Reply

      OscarCP
      AskWoody Plus

      GTP, Just out pure curiosity: what happens when the HD has one bad sector that cannot be remapped to a spare one? Does the system insist on writing files on the bad sector? Or does something much more spectacular happen? And how would the system know to write to where the contents of the bad sector have been remapped? If the sector has been remapped, does this mean that the table of file locations has been changed and the files that were entirely inside the bad sector, moved to new places now appearing in this table? And what happens to the ones that were only partly in the bad sector? Or what really happens is something totally different — and what is it then?

      • #339270 Reply

        Ascaris
        AskWoody_MVP

        I’m not GTP, but I can help with these questions.

        I’m not sure what would be the issue GTP refers to if the drive is out of sectors to map in, unless he considers the loss of a slight bit of drive capacity to be a big problem.  Back in the day, there were no spare sectors of which to speak, and hard drives always came from the factory with bad sectors as detected by testing during the manufacturing process, printed out on an error sheet or on a label on the back of the drive for easy reference.  The person installing the drive would enter the bad sector data at the time that the low level format was being done, which would permanently mark these sectors as unusable (unless another low-level was done, which would mean the bad sectors would need to be entered once again).  There was no logical block addressing on those early drives, so one had to enter the actual cylinders, heads, sectors per track, write precomp, etc. manually, just like the locations of the bad sectors.  Then the interleaving would be chosen, and the low-level format would be performed.  Next we’d “fdisk” it, named for the MS-DOS utility for setting up of the partition table, then perform the high level/file system level format of each partition.

        When IDE drives first hit the scene, they made things considerably easier.  They used logical block addressing (LBA), so they didn’t require manual entry of the drive geometry parameters or the error maps.  It wasn’t necessary or advisable to perform a low-level format on them, something that was mandatory for non-LBA drives.  As long as the system knew the capacity of the drive, all was okay.  The actual cylinder-head-sector address of any given sector was handled by the drive electronics rather than the inflexible system BIOS or the firmware on the hard drive controller itself, which performed the same function.  Modern drives use LBA too, which is what allows sector remapping in the first place.  New hard drives do have initial defect lists just like the older drives did, but they come with them already marked and removed from service, so that the user need not be aware of them.

        GTP, Just out pure curiosity: what happens when the HD has one bad sector that cannot be remapped to a spare one?

        If it cannot be remapped to a spare sector, it means there must not be any more spare sectors, since there would be no other reason why it can’t do it.  In that case, the drive capacity is reduced by one sector.  If the drive has used up all the reserve sectors, it might be a really good idea to make sure everything’s backed up… sudden increases in numbers of bad sectors is a really bad sign.  A single sector marked as potentially bad or “pending” that is eventually marked bad isn’t a reason to panic just yet, but if there are more and more as time passes, I’d definitely raise the alarm at that point.

        And how would the system know to write to where the contents of the bad sector have been remapped?

        The operating system doesn’t know it even happens.  The drive electronics take care of it.  It’s physically in another place, but that doesn’t mean anything to the OS.  It’s not even aware of the change.

        If the sector has been remapped, does this mean that the table of file locations has been changed and the files that were entirely inside the bad sector, moved to new places now appearing in this table?

        From the perspective of the OS– no.  It’s still at the same logical address that it was before.  The actual physical location of that logical block changes on the disk, but the translation is handled by the drive electronics, making it transparent to the OS.

        From the perspective of the hard drive electronics– yes, although it’s not really “files” at that point.  It’s data that forms files at the OS level, but is just data as far as the drive electronics are concerned.

        And what happens to the ones that were only partly in the bad sector? Or what really happens is something totally different — and what is it then?

        Only the bad sector itself is relocated.  The rest of the file remains where it was.  It’s not a problem if it’s not contiguous– at the file system level, files tend to become non-contiguous anyway.  It’s why defragmentation is necessary from time to time (on Windows, at least… some say that Linux EXT4 doesn’t need defragging, but the real story is probably that it needs it less).  A small amount of fragmentation is not a concern, but larger amounts of fragmentation mean many more head seeks, which slows throughput significantly.  Each seek on a hard drive adds 12 or so milliseconds to the read or write.  That’s trivial, but hundreds of 12 millisecond seeks adds up to more than a second of time where the drive is at zero throughput.

         

         

        Group "L" (KDE Neon User Edition 5.16 & Kubuntu 18.04).

        3 users thanked author for this post.
    • #339485 Reply

      OscarCP
      AskWoody Plus

      Ascaris: ” Only the bad sector itself is relocated.  The rest of the file remains where it was.  It’s not a problem if it’s not contiguous– at the file system level, files tend to become non-contiguous anyway.  ”

      Does this mean that if a piece of the segmented file, or a completely no-segmented one, is inside the bad sector, the file can still be read correctly even so?

    • #341459 Reply

      Paul T
      AskWoody MVP

      If the sector becomes bad after the file is written the data may be recoverable from the CRC information. If not you need to go to your backup – which you run daily, don’t you!

      cheers, Paul

      1 user thanked author for this post.

    Please follow the -Lounge Rules- no personal attacks, no swearing, and politics/religion are relegated to the Rants forum.

    Reply To: Fred Langa: “My 500 GB hard drive has one bad sector; what does that really mean?”

    You can use BBCodes to format your content.
    Your account can't use Advanced BBCodes, they will be stripped before saving.