# Get data from unmountable reiserfs partition

## qnx

Short story

I have a damagad sector on my hda. The sector occurs to be on hda1, where my / partition is. So I can not mount it. I need to get back the data there anyway!

All other partition works, storage, music and so on. But root is dead! How can I get back the data there without mounting the partition?

A bit longer story

Damaged sector on my IBM Deskstar 60 GPX 41 Gb. Hitachi's (they merged with IBM's harddrive section) tool for checking the disk (DTF) reports that sector 0x00BBC0 is damaged. The disk sounds something like "krrr krrr krrr /pause/ krrr krrr krrr /pause/" and so on. It's surely a phisical error - it occured after only 2 years of usage...but I read on other forums that a lot of people have this problem with 60gpx and 75gpx. 

Well, I know that only ONE sector is damaged! That should let me access the other sectors on the partition. But, unfortunately, it seems like one of the first sectors, needed when mounting, is damaged. I can't even mount it from LiveCD (althougt other partition, as mentioneded above, are mountable).

Some output, this is from mount:

```
hda: dma_inir: status=0x51 { DriveReady SeekComplete Error }

hda: dma_intr: error=0x40 { UncorrectableError }, LBAset=15204415, sector=15204352

end_request: I/O error, dev 03:01 (hda), sector 15204352

sh-2029: reiserfs read_bitmaps: bitmap block (#1900544) reading failed

reiserfs_read_super: unable to read bitmap
```

And this is from fsck.reiserfs (quite similar):

```
Will check consistency of the filesystem on /dev/hda1

and will fix what can be fixed w/o --rebuild-tree

Will put log info to 'stdout'

Do you want to run this program?[N/Yes] (note need to type Yes if you do):###########

reiserfsck --fix-fixable started at Sun Jun  8 12:00:52 2003

###########

The problem has occurred looks like a hardware problem.

Check your hard drive for badblocks.

bread: Cannot read the block (1900544).

```

It seems hopeless, doesn't it?

But since ReiserFS and Linux is so great, there should be a way to access data on unmountable partition, right?

Please, help me! It's *extremly* important. I need to get back my /home/jacob !

Cheers, 

Jacob

P.S. As you noticed I was soooooo stupied and had home on root partition. I'll *never* do it again! But here's something even more stupied (if possible): I acctually had backup on my whole home dir. And guess where I put it? /root/backups ...... No comments.....

----------

## marshall_j

You might be able to copy it using the DD command (man dd to get the useage)

Something like 

```

dd if=/dev/hdx of=/mnt/datalocation bs=1024 count=1024 

```

where count is the size of the data to be copied. good luck  :Smile: 

----------

## qnx

Good, I will try it. But bsize is block size, right?? And if memory servers me correct, I use 4kb blocks, not 1. So should I change 1024 to 4192?

----------

## qnx

And one more thing. You say that "count is size of data to be copied". Does that mean that dd will (in this case) only copy first kilobyte on the /dev/hdX ?

BTW, Thanks a lot for this suggestion =)

----------

## qnx

OK. First of all, of=/dev/hdaX and not /mnt/something cause if you use /mnt dd will say that /mnt/xxx is a directory. 

Secondly, I think that without count=XX it will copy everything, right?

----------

## hhaamu

 *qnx wrote:*   

> OK. First of all, of=/dev/hdaX and not /mnt/something cause if you use /mnt dd will say that /mnt/xxx is a directory.

 

You point dd to a file (even a non-existant will do), not to a directory. In marshall_j's example a file named "datalocation" will be created in the /mnt directory. In that file, you will find the raw data that you may be able to recover.

 *qnx wrote:*   

> Secondly, I think that without count=XX it will copy everything, right?

 

Correct. marshall_j's example copies 1024 1k blocks from /dev/hda, so it will copy a total of 1 meg of data from the start of the hda (no specific partition, just the whole hard disk, including the partition table).

 *qnx wrote:*   

> So should I change 1024 to 4192?

 

No. The blocksize argument doesn't matter very much, just makes it faster when copying.

----------

## BradN

Here's what I would try... boot off a cd and mount one of your other partitions just to get some temporary space.

dd if=/dev/damagedpartition of=/mnt/otherpartition/tempfile bs=1024 count=1024 conv=noerror

this will copy the first meg of the partition to the temp file. At this point, check and make sure that the temp file is exactly 1 meg.  I'm not sure if dd skips bad sectors or fills them in with nulls (if it skips them, this won't work right, so STOP now if it's not 1 meg)

Now, reverse if= and of= to reverse the order, and copy the meg back.

Why, you ask?  because when you overwrite the bad sector, the hard drive will allocate a new sector for it.  After that's done, run reiserfsck on the partition, and hopefully it can be fixed.

Also, just to clarify, we want to copy data from the partition, not the actual drive, so it would be if=/dev/hda1 instead of if=/dev/hda if you decide to try this.

good luck

----------

## caenus

I'm currently in a very similar situation and trying to recover some data from a hosed reiser partition. Someone mentioned you can copy certain parts of the bad partition into a temp file and should be able to recover the data from that. Say for example I copied 100mb off the partition into a test file, how would I then recover? Currently I'm trying that read the bad block area into a test file, then write it back so it will reallocate those bad blocks. After it completes, I'll try reiserfsck. Any other recommendations I should do or try? Thanks.

----------

