LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-03-2007, 06:29 AM   #1
yumener
Member
 
Registered: Oct 2005
Posts: 63

Rep: Reputation: 15
What to do with a partion with bad block count?


HI I have a ext3 partition, which show

mke2fs 1.38 (30-Jun-2005)
mkfs.ext2: invalid blocks count - /dev/hdb2

when I try to format it. How can I repair it?
I have already backup the data on this partition.
 
Old 08-03-2007, 07:13 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 16,842

Rep: Reputation: 2508Reputation: 2508Reputation: 2508Reputation: 2508Reputation: 2508Reputation: 2508Reputation: 2508Reputation: 2508Reputation: 2508Reputation: 2508Reputation: 2508
Are you doing it with "-j" (to make it ext3) ???

Last resort:
Code:
dd if=/dev/zero of=/dev/hdb2 count=10
should do it.
Then redo the mkfs. Presumes you really do have it all backed up.
 
Old 08-03-2007, 08:27 AM   #3
yumener
Member
 
Registered: Oct 2005
Posts: 63

Original Poster
Rep: Reputation: 15
Not ext3, I tried to format it as ext2.

OK, I tried dd command you suggested, it shows

10+0 records in
10+0 records out
5120 bytes (5.1 kB) copied, 7.6e-05 seconds, 67.4 MB/s

then I run mkfs


#sudo /sbin/mkfs -c -t ext2 /dev/hdb2

mke2fs 1.38 (30-Jun-2005)
mkfs.ext2: invalid blocks count - /dev/hdb2

So the problem is still there.

Quote:
Originally Posted by syg00
Are you doing it with "-j" (to make it ext3) ???

Last resort:
Code:
dd if=/dev/zero of=/dev/hdb2 count=10
should do it.
Then redo the mkfs. Presumes you really do have it all backed up.

Last edited by yumener; 08-03-2007 at 08:31 AM.
 
Old 08-03-2007, 08:40 AM   #4
monsm
Member
 
Registered: Feb 2005
Location: London, UK
Distribution: Gentoo
Posts: 568

Rep: Reputation: 37
Reformatting is probably not going to help.

I think what you need is the badblocks command. Run that to test the harddrive. If the bad blocks are still there afterwards, you have a physical problem on your drive. If the bad blocks have recently appeared it might be an idea to start looking for a new drive. At least keep taking backups and run the badblocks command again in a few weeks to see if the amount of bad blocks increase or not.

Appearance of bad blocks can be a precursour to a hard drive crash...
 
Old 08-03-2007, 09:25 AM   #5
yumener
Member
 
Registered: Oct 2005
Posts: 63

Original Poster
Rep: Reputation: 15
if the bad block partition is not the system partition,
does it still matter/crash?



Quote:
Originally Posted by monsm
Reformatting is probably not going to help.

I think what you need is the badblocks command. Run that to test the harddrive. If the bad blocks are still there afterwards, you have a physical problem on your drive. If the bad blocks have recently appeared it might be an idea to start looking for a new drive. At least keep taking backups and run the badblocks command again in a few weeks to see if the amount of bad blocks increase or not.

Appearance of bad blocks can be a precursour to a hard drive crash...
 
Old 08-03-2007, 12:28 PM   #6
yumener
Member
 
Registered: Oct 2005
Posts: 63

Original Poster
Rep: Reputation: 15
updated...

I tried badblocks command, it shows nothing,
does this mean nothing is wrong?

when I run mkfs, it tells me that

invalid block count, instead of bad block.

is there any difference?


Quote:
Originally Posted by monsm
Reformatting is probably not going to help.

I think what you need is the badblocks command. Run that to test the harddrive. If the bad blocks are still there afterwards, you have a physical problem on your drive. If the bad blocks have recently appeared it might be an idea to start looking for a new drive. At least keep taking backups and run the badblocks command again in a few weeks to see if the amount of bad blocks increase or not.

Appearance of bad blocks can be a precursour to a hard drive crash...
 
Old 08-04-2007, 12:26 AM   #7
GregLee
Member
 
Registered: Feb 2004
Location: Waimanalo, HI
Distribution: Slackware 10, Fedora 6
Posts: 308

Rep: Reputation: 30
I don't understand this invalid block count error you're getting, but if it's due to unreadable blocks on the disk surface, writing zeros to those blocks may fix it. But 10 bytes is not enough. The theory of writing zeros goes like this: the disk firmware keeps a supply of spare blocks it can use to replace blocks that can no longer be read, but it won't do the replacement so long as there is a chance that the original data in the block that seems to be bad might be recovered. But when you write zeros into the problematic part of the disk surface, since those zeros would replace the original data, whatever it was, the firmware program knows that it's okay to forget the original data and "map out" the bad block. The zeros you're writing will be written to a new block that henceforth will replace the block that went bad. Problem solved, hopefully.
 
Old 08-04-2007, 01:13 AM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 16,842

Rep: Reputation: 2508Reputation: 2508Reputation: 2508Reputation: 2508Reputation: 2508Reputation: 2508Reputation: 2508Reputation: 2508Reputation: 2508Reputation: 2508Reputation: 2508
@GregLee, that was 10 sectors, not 10 bytes.
I was hoping scrubbing the start of the filesystem would solve the problem.

I wonder if the partition table is invalid - say overlapping partitions or some-such.
@yumener - can we see the output of "sudo fdisk -l".
 
Old 08-04-2007, 12:38 PM   #9
monsm
Member
 
Registered: Feb 2005
Location: London, UK
Distribution: Gentoo
Posts: 568

Rep: Reputation: 37
Hmm, maybe it is just the file system itself that has come out of step. Maybe all it need is fsck?

You might have to get a livecd to boot from in order to run it properly to fix any faults it finds. I'm not sure though, I haven't had to fix any Linux file systems yet.
 
Old 08-05-2007, 07:03 AM   #10
yumener
Member
 
Registered: Oct 2005
Posts: 63

Original Poster
Rep: Reputation: 15
Disk /dev/hdb: 82.3 GB, 82348277760 bytes
255 heads, 63 sectors/track, 10011 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdb1 1 25 200781 83 Linux
/dev/hdb2 26 5252 41985877+ 83 Linux
/dev/hdb3 * 5253 6654 11261565 83 Linux
/dev/hdb4 6655 10011 26965102+ f W95 Ext'd (LBA)
/dev/hdb5 6655 6794 1124518+ 82 Linux swap / Solaris
/dev/hdb6 6795 10011 25840521 83 Linux


By the way, this "invalid block count" error show up
just recently. I guess it is related to the use of "Ext2 Installable File System for Windows" (http://www.fs-driver.org/).

I have Windows XP installation on hda,
it crashed recently, meaning I cannot
boot the Windows anymore.

I can boot Linux, but it always takes
several minutes in mounting hdb2.



Quote:
Originally Posted by syg00
@GregLee, that was 10 sectors, not 10 bytes.
I was hoping scrubbing the start of the filesystem would solve the problem.

I wonder if the partition table is invalid - say overlapping partitions or some-such.
@yumener - can we see the output of "sudo fdisk -l".

Last edited by yumener; 08-05-2007 at 07:12 AM.
 
Old 11-10-2008, 02:02 AM   #11
jetdog
LQ Newbie
 
Registered: Nov 2008
Posts: 1

Rep: Reputation: 0
Cool Solved

Quote:
Originally Posted by yumener View Post
#sudo /sbin/mkfs -c -t ext2 /dev/hdb2

mke2fs 1.38 (30-Jun-2005)
mkfs.ext2: invalid blocks count - /dev/hdb2

So the problem is still there.
Hello! WOW!!! you fixed my problem!!!

I was using mke2fs for a looooong time trying to format 0x07 with ntfs, only to find that mke2fs is just for ext!!!

You're my hero!!!

Last edited by jetdog; 11-10-2008 at 01:22 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bad block relocation bond_e Linux - Newbie 1 04-30-2006 05:25 PM
mk2efs ext3 block count differs on same partition size tkmbe Linux - General 1 06-29-2005 09:23 AM
Slackware ISO Block count incorrect? wh33t Slackware 5 02-01-2005 07:09 PM
bad block in reiserfs ngoddard SUSE / openSUSE 4 12-01-2004 02:58 AM
bad block check fizazz88 Fedora - Installation 3 03-21-2004 11:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration