0

I have three HDDs that I pulled from an old server. Couldn't remember what was on it or how it was configured until I stuck it into my new server to use for RAID5. I dd'ed all three hard drives and tried to mdadm --create a new RAID array and got the following error:

mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sdb /dev/sdc /dev/sdd
mdadm: super1.x cannot open /dev/sdc: Device or resource busy
mdadm: /dev/sdc is not suitable for this array.
mdadm: create aborted

Looking into the problem I found out that /dev/sdc2 still contains a logical volume.

# lsblk /dev/sdc
NAME                    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sdc                       8:32   0 931.5G  0 disk 
|-sdc1                    8:33   0   102M  0 part 
`-sdc2                    8:34   0 931.4G  0 part 
  |-VolGroup00-LogVol00 253:2    0   926G  0 lvm  
  `-VolGroup00-LogVol01 253:3    0   5.4G  0 lvm  
# lsblk /dev/sdd
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sdd      8:48   0 931.5G  0 disk 
|-sdd1   8:49   0     2G  0 part 
`-sdd2   8:50   0 929.5G  0 part 
# lsblk /dev/sdb
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sdb      8:16   0 931.5G  0 disk 
|-sdb1   8:17   0     2G  0 part 
`-sdb2   8:18   0 929.5G  0 part 

I tried lvremove pvremove and vgremove but all return with the same error: Incorrect metadata area header checksum on /dev/sdc2 at offset 4096

I am unfamiliar with LVM and tried to look online on what to do. Did a recovery but did not work not to my surprise since the vg file archive I used was generated on my new server.

My guess is that because I dd'ed the HDDs I somehow messed up the header metadata. What can I do to wipe all this so that I can create my RAID5? Any help would be much appreciated.

Thanks in advance!

EDIT

To clarify what I mean by dd'ed:

dd if=/dev/zero | pv | dd of=/dev/sdx

EDIT 2

Just to clarify what helped and give credit to both answers. Both answers below with regards to dd work. In my case, since the RAID was built on a different box, and I orphaned one of the drives, my new box was complaining about the volume group and such. When I used dd initially to wipe the data I must not have touch the headers for the RAID/LVM.

Kenneth P. Hough
  • 577
  • 2
  • 8
  • 25

2 Answers2

2

As long as you don't care what's on the drive at /dev/sdc, try this:

dd if=/dev/zero of=/dev/sdc bs=1m count=10

That will zero out the first 10 MB of the disk, including any LVM or RAID headers. Then reboot; the system should see that the disk is no longer a part of any LVM group.

If you need more inspiration check out this Linux Journal article I wrote on recovering RAID & LVM volumes:

http://www.linuxjournal.com/article/8874

1

Here is a great link - please take a look, if you're not familiar with it:

In your case, please try this:

https://forums.opensuse.org/showthread.php/489778-How-do-I-delete-a-RAID-volume-that-was-created-with-mdadm

  1. find the md and it's components (sda, sdb, etc.)

    fdisk -l mdadm --detail /dev/md0 or md1 or mdX

  2. unmount the md (might be good to use the -l flag for lazy unmount

    umount -l /dev/md0

  3. stop the array

    mdadm --stop /dev/md0

  4. zero the superblock of each device from the md array

    mdadm --zero-superblock /dev/sda mdadm --zero-superblock /dev/sdX ... etc.

Substitute your actual drive names as needed.

I'm not sure what you mean by "dd'ed all drives", but you should be able to initialize them with either "mdadm" (per above) or "dd": EXAMPLE: dd if=/dev/zero of=/dev/sdc2 bs=1024K count=100.

See also this link for more hints:

FoggyDay
  • 11,962
  • 4
  • 34
  • 48
  • Thanks for the great link! With regards to deleting the RAID, this didn't work because the original RAID was built on a different box under freeBSD. I tried mdadm to zero the superblock but that gave me: `mdadm: Unrecognised md component device - /dev/sdc` Also /dev/md0 doesn't exist since that was on the old freeBSD box. I think I was using dd incorrectly. I Tried `dd if=/dev/zero of=/dev/sdc bs=1m count=10` and rebooted as Richard Bullington-McGui suggested and that did the trick. My guess is your `dd if=/dev/zero of=/dev/sdc2 bs=1024K count=100` would've worked too. Thanks for your help! – Kenneth P. Hough Feb 10 '15 at 01:31