md5sum repeatedly gives different checksum for same file on same machine

11,523

Solution 1

It may be worth running fsck (or the equivalent for whatever filesystem you're using) to fix disk errors. But, it could be the last thing this drive does if it's on its last leg.

Solution 2

The only likely reasons are bad disk or bad RAM, and as the disk is old and you are not experiencing other issues it is less likely to be the RAM.

It could be a dodgey connector/controller: I once had an IDE->USB adaptor go bad resulting in corrupted transfers even thought the drive was perfectly fine.

Solution 3

To be on the safe side I suggest you run memtest86+ over night to make sure that it finds no memory errors.

Solution 4

The root cause is that somehow your RAM is getting corrupted. It is probably a bad stick, but sometimes the devices like the video card can corrupt main memory.

Do not fsck until you verify that the memory is safe. Otherwise fsck is likely to corrupt everything.

Pull out drives, put in a known good system, and FSCK there while you fix this system.

Solution 5

I once had this same problem as well. It turned out to be the hard drive controller on the motherboard.

However, in this case it definitely sounds like a dud hard drive. Hard drives tend to hang onto life by marking sectors bad, transparently, in the background. When sectors finally start to go bad at an OS level the drive ends up expiring very quickly.

Share:
11,523

Related videos on Youtube

Lucian Serban
Author by

Lucian Serban

Updated on September 17, 2022

Comments

  • Lucian Serban
    Lucian Serban almost 2 years

    I have a very small and quite old hard drive disk, about 32G.
    On to this disk I have copied a largish tar file, about 5G.

    When I run md5sum to generate a checksum on this file I repeatedly get different results (on the same machine and the same file). This obviously should not happen.

    If I repeat the experiment with a much smaller file, as expected the checksum is the same each time. I can only assume that because the large file is spanning most of the disk, and it is an old drive, I am experiencing a lot of read errors on the hard drive - and it needs replacing? Could there be any other good reason for this? Something I can do to fix the problem other than buying a new disk?

    Update: sha1sum also produces inconsistent results.

    • Admin
      Admin almost 15 years
      This file isn't /dev/random, right? :D
    • Admin
      Admin almost 15 years
      No! BTW - this is on a linux (debian) machine.
    • Admin
      Admin almost 15 years
      Are there any interesting messages in the logs ?
    • Admin
      Admin almost 15 years
      DO NOT HESITATE. Replace this drive immediately!
    • Admin
      Admin almost 15 years
      Browsing thru the questions this morning and coming upon this gave me a chuckle. The title reads something like "Smoke is pouring out of the windows of my house. Do you think I should do something?" I hate to make light of someone else's misfortune, but it just struck me as funny. I'm sick, I guess.
    • Admin
      Admin almost 15 years
      Yes, it's a crappy machine. I think it was stored outside for a while too. I can see rust on it. Infact - I'm always a little scared to touch it incase I get an electric shock.
  • Lucian Serban
    Lucian Serban almost 15 years
    Running on Linux - Debian.
  • Lucian Serban
    Lucian Serban almost 15 years
    going for it - running fsck....
  • Lucian Serban
    Lucian Serban almost 15 years
    actually seems to have fixed it!
  • SilentW
    SilentW almost 15 years
    You should still replace the drive ASAP.
  • spoulson
    spoulson almost 15 years
    He did say it was an small, old drive. But, if it were worth keeping you can check out Spinrite to do an analysis and repair. It can tell you how damaged the drive is.
  • Magellan
    Magellan about 12 years
    This is a VERY late answer. Please keep an eye towards the date of the question when providing an answer, and do not rehash areas already covered by others. In this case. the question was posed nearly 3 years ago. I'm sure the problem has resolved itself in one fashion or another long since.