LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-04-2008, 01:37 PM   #1
mamadu.bwana
Member
 
Registered: Sep 2007
Posts: 31

Rep: Reputation: 15
I need help with fixing bad blocks


Hi,

My computer has the following partitions:

Code:
root@ubuntu:/home/ubuntu# fdisk -lu

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x01840183

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63    20482874    10241406   83  Linux
/dev/sda2        20482875    20996954      257040   82  Linux swap / Solaris
/dev/sda3        20996955   156296384    67649715   83  Linux

Disk /dev/sdb: 30.7 GB, 30738677760 bytes
255 heads, 63 sectors/track, 3737 cylinders, total 60036480 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x016b35db

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1              63    60034904    30017421   83  Linux
root@ubuntu:/home/ubuntu#
Since I was having I/O problems which froze the computer I did a check on them and I found this:

Code:
root@ubuntu:/home/ubuntu# fsck.reiserfs /dev/sda1
reiserfsck 3.6.19 (2003 www.namesys.com)

*************************************************************
** If you are using the latest reiserfsprogs and  it fails **
** please  email bug reports to reiserfs-list@namesys.com, **
** providing  as  much  information  as  possible --  your **
** hardware,  kernel,  patches,  settings,  all reiserfsck **
** messages  (including version),  the reiserfsck logfile, **
** check  the  syslog file  for  any  related information. **
** If you would like advice on using this program, support **
** is available  for $25 at  www.namesys.com/support.html. **
*************************************************************

Will read-only check consistency of the filesystem on /dev/sda1
Will put log info to 'stdout'

Do you want to run this program?[N/Yes] (note need to type Yes if you do):Yes
###########
reiserfsck --check started at Tue Mar  4 16:20:04 2008
###########
Replaying journal..
Reiserfs journal '/dev/sda1' in blocks [18..8211]: 0 transactions replayed
Checking internal tree..
The problem has occurred looks like a hardware problem. If you have
bad blocks, we advise you to get a new hard drive, because once you
get one bad block  that the disk  drive internals  cannot hide from
your sight,the chances of getting more are generally said to become
much higher  (precise statistics are unknown to us), and  this disk
drive is probably not expensive enough  for you to you to risk your
time and  data on it.  If you don't want to follow that follow that
advice then  if you have just a few bad blocks,  try writing to the
bad blocks  and see if the drive remaps  the bad blocks (that means
it takes a block  it has  in reserve  and allocates  it for use for
of that block number).  If it cannot remap the block,  use badblock
option (-B) with  reiserfs utils to handle this block correctly.

bread: Cannot read the block (1114121): (Input/output error).

Aborted (core dumped)
Then I tried this:

Code:
root@ubuntu:/home/ubuntu# badblocks /dev/sda1
4456448
4456484
4456485
4456486
4456487
4456488
4456489
4456490
4456491
4456492
4456493
4456494
4456495
4456496
4456497
4456498
4456499
4456500
4456501
4456502
4456503
My other partitions did not report any errors.

Interestingly, I also tried a smart tools check which my partition passed:

Quote:
root@ubuntu:/home/ubuntu# sudo smartctl -H /dev/sda1
smartctl version 5.37 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

root@ubuntu:/home/ubuntu# smartctl -i /dev/sda1
smartctl version 5.37 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF INFORMATION SECTION ===
Model Family: Maxtor DiamondMax D540X-4K family
Device Model: MAXTOR 4K080H4
Serial Number: 674120623352
Firmware Version: A08.1500
User Capacity: 80,026,361,856 bytes
Device is: In smartctl database [for details use: -P show]
ATA Version is: 5
ATA Standard is: ATA/ATAPI-5 T13 1321D revision 1
Local Time is: Tue Mar 4 17:42:35 2008 UTC
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
I am currently running my system off a live-CD so I am able to access the web (and this forum).

My questions are:

1) Is there a way to map and isolate the bad blocks and keep on living happily with my hard drive

or

2) what is the safest way to clone my partition to another hard disk (which I rather not do, since I am very short on cash)

Of course, if I have missed anything, please let me know how I could otherwise fix my computer.

Many thanks in advance,

Mamadu

PS:

/dev/sda1 is my / partition with the system on it
/dev/sda2 is my /swap partition
/dev/sda2 is my /home partition with my data on it and this is the one I *really* would like to save, if possible.
/dev/sdb1 is my /usr partition
 
Old 03-04-2008, 05:30 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Linux Mint 17, Linux Mint 18
Posts: 7,809

Rep: Reputation: 294Reputation: 294Reputation: 294
Quote:
Originally Posted by mamadu.bwana View Post


1) Is there a way to map and isolate the bad blocks and keep on living happily with my hard drive
All of your bad blocks seem to be in one fairly small area the hard drive in the /dev/sda1 partition. You could set up a small partition which includes all of the bad blocks and stop using that partition. Don't even try to format the bad partition. I did this a long time ago for a friend and he kept using the two thirds of the hard drive that were still good for at least another two years before I lost contact with him.

Quote:
Originally Posted by mamadu.bwana View Post

2) what is the safest way to clone my partition to another hard disk (which I rather not do, since I am very short on cash)
I recommend that you use cp to clone a file system whether you copy it to another partition on the same hard drive or a partition on another hard drive. i think that your bad blocks are all in /dev/sda1:

boot a live CD

make directories for the from and to partitions:

mkdir /from
mkdir /to

mount your old and new partitions:

mount -t reiserfs /dev/sda1 /from

mount -t reiserfs (wherever you are saving it) /to

cp -ar /from/* /to

Then change /etc/fstab /boot/grub/menu.lst on your /to partition. chroot to /to

chroot /to

Then use grub-install to install the new grub to the MBR.

If cp won't work because of the bad blocks then you may have to make several partial copies to get around the problem.

-------------------
Steve Stites

Last edited by jailbait; 03-04-2008 at 05:32 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 blocks bong.mau Linux - General 1 11-16-2005 02:17 PM
ReiserFS with bad blocks bruce ford Linux - Software 2 07-23-2005 04:15 AM
Fixing a Bad Superblock PionexUser Linux - General 6 11-14-2003 02:52 PM
fixing bad blocks/sectors warheros Linux - Software 3 07-19-2003 10:01 PM
Fixing Bad Blocks PionexUser Linux - Newbie 1 07-19-2003 04:00 AM


All times are GMT -5. The time now is 02:11 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