badblocks ... finds errors on a partition boundary. maybe also wipes out grub?

29 views
Skip to first unread message

Ana Johnson

unread,
May 17, 2013, 2:22:17 PM5/17/13
to Reno Linux Users Group
Hi.

I'm not sure how to deal with this problem.  I really want to recover my partition if possible.  any suggestions are welcome.

irrelevant background:  I upgraded my linux partition the other day.  Debian squeeze --> wheezy.  (some day I'll switch to Ubuntu, probably.)  All was well.  everything was working great.  yesterday, when I attempted to reboot however, instead of the standard Grub, I got a "grub rescue> " prompt.  To make a long story short...  I had to get a rescue, live image on a usb stick which allowed me to boot and debug.

It appears that I have some bad blocks on my HD, and those bad-blocks just happen to span a partition boundary... twixt: sda2 and sda3.  my partitions are listed below.  sda2 is my swap partition, so there's nothing to worry about.  I resize it and do a mkswap (or whatever).  The big problem is that sda3 is the partition I boot from and is the partition where I have grub installed.  And, as far as I can tell, it seems that by losing the first 4 (or so) 512-byte blocks on this partition, that I have lost my grub config.  I'm worried also that...  traditionally anyway, there are usually a host of important items located right at the front of a bootable partition.  the kernel, for instance, I think at least used to be located there.  Worst of all, perhaps...  I suspect there may be some critical information about the filesystem itself embedded right at the beginning of a partition that contains an ext3/4 filesystem.  I certainly could be wrong about this, but the "beginning" of a binary thing is a logical place to store a header (a structural meta-information thing, like a TCP/IP packet header, for instance).

I really want to save this filesystem, but I'm not sure how to go about it.  I will continue to research, and I have really only just begun to do that, but I want to get this done quickly if I can.  if anyone has a suggestion please let me know.  Thank you!!

Ana


root@debian:/home/ana# fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 160.0 GB, 160041885696 bytes
214 heads, 54 sectors/track, 27049 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x9358c633

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   151129367    75563660    7  HPFS/NTFS/exFAT
/dev/sda2       151129368   155035295     1952964   82  Linux swap / Solaris
/dev/sda3       155035296   312497351    78731028   83  Linux
/dev/sda4       312497352   312578243       40446   ef  EFI (FAT-12/16/32)

Reggie Darden

unread,
May 17, 2013, 3:29:29 PM5/17/13
to ren...@googlegroups.com
If you can still get to your other data I would say just back it up and
reformat/reinstall the whole drive.
> --
> You received this message because you are subscribed to the Google
> Groups "Reno Linux Users Group" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to renolug+u...@googlegroups.com.
> To post to this group, send email to ren...@googlegroups.com.
> Visit this group at http://groups.google.com/group/renolug?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Johnny Lau

unread,
May 17, 2013, 3:31:35 PM5/17/13
to ren...@googlegroups.com
Try to zipped the hard drive air tight sealed bag and put in the freezer for a day and then try it.

Johnny


Gidatola

unread,
May 17, 2013, 3:34:48 PM5/17/13
to ren...@googlegroups.com
Check out dd-rescue. It will allow you to make a clone of the drive
skipping bad blocks, allowing you to extract the data.

anajilly

unread,
May 17, 2013, 4:15:00 PM5/17/13
to ren...@googlegroups.com
I suppose I did a backup of this little system just before I did the OS upgrade, so it makes sense to resize the partitions and start from scratch.  My windowsxp partition is still intact, thankfully (I forgot to backup that one).  I'm just frustrated...  that only the first 4 (or so) blocks on this partition are bad.  The rest of them can be read without errors, so it stands to reason I ... should be able to reconstruct the missing data and move on without reinstalling anything.  Still, for whatever reason, so far, I am unable to...  find a super block.  (I just don't know enough about this. and, I shouldn't be spending my time on it, honestly.)  Maybe this is my chance to try out Ubuntu.

Thanks Reggie.

Ana

anajilly

unread,
May 17, 2013, 4:15:34 PM5/17/13
to ren...@googlegroups.com
I will definitely try this.  Thanks for the tip.

Ana

anajilly

unread,
May 17, 2013, 4:16:58 PM5/17/13
to ren...@googlegroups.com
I'm pretty gullible.  I can't tell if you're joking or not.  freezer?  sounds like a recipe for a water damage disaster.

Ana

Reggie Darden

unread,
May 17, 2013, 4:25:26 PM5/17/13
to ren...@googlegroups.com
It's been my experience that bad blocks start to increase over time and with mucking with them.  I've lost tons of data because I wanted to try and fix every drive that's just got a few bad spots.  It's not worth the time or energy these days.

Gidatola

unread,
May 17, 2013, 4:41:38 PM5/17/13
to ren...@googlegroups.com
This is why we run RAID in production environments :-)

Grant Kelly

unread,
May 18, 2013, 1:09:16 PM5/18/13
to ren...@googlegroups.com
I have successfully recovered some data from a dying drive using the freezer trick. It took a few iterations of freezing/rsync but was surprisingly successful.

Ronald Webber

unread,
May 18, 2013, 1:34:49 PM5/18/13
to ren...@googlegroups.com
please backup and replace that hard drive as soon as possible, Reggie is correct, once you start getting bad blocks it is only a matter of time before you lose something important.

Joan Leach

unread,
May 19, 2013, 1:43:21 PM5/19/13
to ren...@googlegroups.com
I've read about that freezer trick, but never tried it. However I usually use the Hiren's Boot CD in DOS mode, since it has some hard disk tools for testing and repairing hard disks. I would defrag the WinXP partitition before I cloned the hard drive, make sure the replaced hard disk works, then you can try repairing the old hard disk, if you wish as a spare or back-up drive.

Joan in Reno

Roy Lindauer

unread,
May 19, 2013, 3:51:14 PM5/19/13
to ren...@googlegroups.com
That's great! I am glad that trick worked. 
Reply all
Reply to author
Forward
0 new messages