# how to restore superblock for raid?

## richis

Hi,

I have messed up with my software raid. After trying to fix some problems I entered such commands:

mdadm --zero-superblock /dev/hdc1

mdadm --zero-superblock /dev/hdb1

Is there any way to restore superblocks? (badly need data from raid)

before problem I used raid-tools and here is config:

/etc/raidtab 

```

raiddev /dev/md0

        raid-level      0

        nr-raid-disks   2

        chunk-size      256

        persistent-superblock 1

        device          /dev/hdb1

        raid-disk       0

        device          /dev/hdc1

        raid-disk       1

```

btw the problem I tried to fix was after mounting md0 I can only read data but cant write (df show 0 bytes free)

thanks

----------

## NeddySeagoon

richis.

A persistant superblock is not required to read the raid.

Since you used raidtools, sitch with it, don't mix and match.

Does 

```
raidstart /dev/md0
```

 work to get your raid up?

----------

## richis

raidstart /dev/md0

/dev/md0: Invalid argument

here is log from dmesg:

```

Aug  8 22:24:58 stone md: invalid raid superblock magic on hdb1

Aug  8 22:24:58 stone md: hdb1 has invalid sb, not importing!

Aug  8 22:24:58 stone md: autostart failed!

```

----------

## NeddySeagoon

richis,

Edit your raidtab, change persistent-superblock 1 to  persistent-superblock 0 and try again.

----------

## richis

already did, still the same

----------

## BlinkEye

does 

```
ls -l /dev/md*
```

list some raid devices?

if not, recreate them with

```
cd /dev && MAKEDEV md
```

and try again.

----------

## richis

/dev/md0 is still there  =)

I think I have done some bigger mistake. In smoe forums I found that I have to recreate partition table on disks.

And I have done fdisk on both disks (removed partitions and created them).

Is this end of my data on disk? =(

----------

## NeddySeagoon

richis,

Provided you only changed the partition table for primary partitions, you can change it as much as you like, as long as you put it back the way it was, you data is still there.

Its more complex with the extended and logical partitions, since every time they are created or destroyed, one sector is written to the disk.

Overwriting what is there, with the same partition information is harmless. Changes will begin to destroy your data.

Get testdisk and scan for partitions - you may be lucky.

----------

## richis

thanks for tool name, but still  problem with testdisk.

here is report. Any other way to recover this "big" partition? 

```

TestDisk 5.9-WIP, Data Recovery Utility, August 2005

Christophe GRENIER <grenier@cgsecurity.org>

http://www.cgsecurity.org

Disk /dev/hdb - CHS 238216 16 63 - 117246 MB

Check the harddisk size: HD jumpers settings, BIOS detection, OS limitation...

The following partition can't be recovered. The harddisk seems too small!

     Partition               Start        End    Size in sectors

D Linux                    0   1  1 397002   3 34  400178176

```

----------

## NeddySeagoon

richis,

If the disk was given over to a single primary partition, using all the space, simply recreate it with fdisk and everything comes back. Even if it wasn't, you can always get the first primary partition back that way, which looks good for /dev/hdc1 etc.

If you do that and there were further partitions, make sure any mounts you attempt are read only.

----------

