Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a problem with my laptop,in which I'd had windows xp. That XP crashed and I couldn't restore it with the Install CD. So, I placed Ubuntu 11.10 install on a Pendrive, searched for some bad blocks(less than 500), hard drive had a entire format and everything looks fine but the progress bar hangs about 20% and the install didn't finish over night? What should I do?

share|improve this question
1  
To me it sounds like more then maybe just bad blocks, the OS should be smart enough itself to know to ignore them when installing... maybe there is something wrong with the read write head, or the bearings on the platters... I don't know you didn't specify if it is SSD or not, so I am assuming it isn't the only way to fix these two problems would be to install a new hard drive... This would make sense why Windows Crashed, and couldn't be recovered though... –  TheX Apr 26 '12 at 23:06
add comment

5 Answers

After writing the digression below, it occurred to me that I should probably also mention why I wrote it.

Any form of sector write or read error on a drive should be viewed as a potential warning. The drive could be failing. Certainly if a drive is reporting as many as 500 bad blocks, I would dig deeper into this before installing anything on the drive.

As I mentioned below, you can use Ubuntu Disk Utility from a Live CD/USB to examine the drive's SMART attributes. If the drive only has few pending reads, you can fill the drive with zeros to force the sectors to be remapped and then do another Ubuntu install.

But watch the drive carefully for further signs of failure and don't save anything critical on it unless it is also backed up. If the drive continues to show sector errors, consider shopping for a replacement drive. Soon.

Just my opinion of course, for whatever it's worth.


These days it is hard to be certain what the phrase bad blocks actually means. In the pre-deluvian days of computing ... say 15 years or more ago ... it could refer to a list the operating system kept of sectors on a hard drive which the drive reported to be, well, bad.

All relatively recent drives now do this sort of tracking internally in their firmware and operating systems no longer need to track such things.

This Wikipedia article on Bad Sectors seems to be a reasonable overview. The key points being:

  1. While the hard drive will automatically attempt to remap a bad sector, it typically only does this when a write fails. Read errors are reported to the OS and logged in the drive's S.M.A.R.T. data, but the sector is not remapped.
  2. The standard way to force the drive to remap all bad sectors is to write to every byte on the drive. Typically one fills all the sectors with 0x00.
  3. If a drive has reported one or more bad sectors, it is possible that the drive may be approaching failure. The drive's S.M.A.R.T. data should be examined, especially the following S.M.A.R.T. attributes
       0x05 Reallocated Sectors Count (How many sectors were remapped)
       0xC5 Current Pending Sector Count (How many sectors waiting to be remapped)

You can use an Ubuntu Live CD or USB to do these things.

After booting the Live CD/USB, open the Disk Utility application either with the GUI by searching for it with Dashor by running the command palimpsest & in a terminal. Select the disk in the left sidebar and then use the SMART Status function to retrieve and view the drive's S.M.A.R.T. attributes.

The dd command command can be used from a terminal window in a Live CD/USB session to fill a drive with zeros. For example, the command below will write 0x00 to every sector on drive /dev/sda

sudo dd if=/dev/zero bs=1M of=/dev/sda

Of course, depending on the size of the drive this could take many hours to complete.

If you are curious, there are many more "tricks" one can use with dd. Have a look at the answers to this question on serverfault. I especially like this trick for periodically displaying the progress of a dd command.

share|improve this answer
    
An anonymous user says: "I've used irrational John's advice and install had finished. Now SMART shows 2 bad blocks less than before. Everything looks fine. If anything bad is hapens I let you know. Thanks a lot." –  jokerdino Apr 27 '12 at 9:34
add comment

BEST ADVICE (rather than solution)

If the hard drive is currently stable, and not deteriorating, then a low-level format will map any "bad sectors" to be unused. The BIOS, HDD controller, and OS should be able to handle any "slow deterioration" after that.

What you are describing could be more serious, and/or a bad controller.

I would strongly suggest getting the laptop checked out, or (at least) getting a test tool that will stress test the drive and show it "stable" or still getting worse ..

share|improve this answer
add comment

You must exclude bad blocks on file system before you begin.

Boot from LiveCD and run this command (assuming that your target partition is sda1):

fsck -M -cc /dev/sda1

This command will check file system on partition /dev/sda1 and will exclude bad blocks from usage. Option -M tells to not check mounted filesystem.

Note: this command will not remap bad blocks on hard drive! It works only for target file system. If you want to remap bad blocks you can do that with Windows chkdsk /f /r command.

After that you may run install but you have to chose manual disk partitioning during setup.

share|improve this answer
add comment

I'm using intensively three hd's with bad blocks since years without any problems. The oldest is over ten years old, the newer ones 5 or 6 years. I think those bad blocks are anoying, if you loose date but david6 thought of low level format seems the best idea for me.

You should install/use that reformated disk and have a regular look at the smart-data of your drive (eg. bad blocks, relocated blocks). Smart-data isnt absolutely reliable but give a good overview of the health status. If you use your reformated disk and you don't see increased bad blocks/relocations, then youre on the lucky side. If you find segnicant more bad blocks or reports a remaining life-time then i would change the drive - its about to die.

BTW: After low-level formating the drive it is NOT necessary to run "badblocks" or such utilities. The drives firmware will handle this without user interaction. When the operating system tries to write to one of those bad blocks, the firmware will silently relocate the bad block.

share|improve this answer
add comment

I did install Ubuntu on a net-top containing bad blocks at the start of the drive so during the partitioning stage I put the '/' partition at the END of the drive (it gives you that option), also the separate '/home' partition at the END also but I shrank it so that It was 30gb smaller than the leftover space to skip the bad sectors.

The install worked fine although if the drive contains bad sectors then it may slowly get worse and is time for a replacement HD...

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.