1

I have a harddisk that is out of raid array. I wanted to create the partition table on sda basesd on the sdb table and I issued this command:

sfdisk -d /dev/sda | sfdisk /dev/sdb --force 

I know that the --force argument is bad here and the command is wrong, the right command was:

sfdisk -d /dev/sdb | sfdisk /dev/sda

Now I have 2 problems, sda is still out of raid array and sdb partion table is empty.

My server looks like this now: http://pastebin.com/uMKvUwbL .

And my question is, how cand I recover sdb (I don't know if the files where deleted after I executed sfdisk -d /dev/sda | sfdisk /dev/sdb --force) and how to add sda back to raid array.

peterh
  • 4,953
  • 13
  • 30
  • 44
AndreiG.
  • 151
  • 1
  • 1
  • 5

1 Answers1

0

My attempt would be:

Rescue sdb

sfdisk -d /dev/sdc | sfdisk /dev/sdb

sdb is still in raid, but currently this wont survive a reboot. Make sure to do this before doing anything else on this box. Actual data on the disc is not touched while writing partition table. After that you'll have a 3 out of 4 member raid 10, that will survive a reboot, so next action is:

add sda back to raid

sfdisk -d /dev/sdc | sfdisk /dev/sda

If sda has been a raid member before: mdadm --zero-superblock /dev/sdaX (X are all partitions)

In your paste I dont see any failed devices for the md's (already removed by you?), so I would continue to add the devices to the corresponding md's with mdadm --manage /dev/mdX --add /dev/sdbX as there seems to be no requirement for replacing a faulty device.

Henrik
  • 698
  • 5
  • 19
  • i have tried sfdisk -d /dev/sdc | sfdisk /dev/sdb adn this is the output Warning: extended partition does not start at a cylinder boundary. DOS and Linux will interpret the contents differently. Checking that no-one is using this disk right now ... BLKRRPART: Device or resource busy This disk is currently in use - repartitioning is probably a bad idea. Umount all file systems, and swapoff all swap partitions on this disk. Use the --no-reread flag to suppress this check. Use the --force flag to overrule all checks. – AndreiG. Apr 26 '15 at 16:26
  • Did you checked that its currently not use? Check /proc/mounts and lsof. If you're sure, go ahead with force. – Henrik Apr 26 '15 at 21:21