System Administration

Re: old LVM config detected during rebuilt

 
Dave Falloon
Trusted Contributor

old LVM config detected during rebuilt

I am building a backup server using spare parts. I have 3 250 GB SATA disks ( Seagate ) and two 200 GB PATA disks ( also seagate ). These disks have been in other machines in various setups using raid and LVM.

Distro: Debian 3.1r0a
Kernel: 2.6.8-2
Chipset: Nvidia NForce chipset/SATA controllers

I installed the disks like so:
PATA primary master: 200 G Seagate
PATA primary slave ( temporary ): DVD rom drive
PATA secondary master: 200G Seagate
SATA 1: 250 G Seagate
SATA 2: 250 G Seagate
SATA 3: 250 G Seagate
SATA 4: Removable hard drive caddy ( empty for now )

When I run through the Debian 3.1 r0a install, I get to the disk partitioning and see that the PATA disks used to part of a raid array, and so were the SATA disks. I remake the partitions like so ( yes I am aware that a mixed array with PATA and SATA will not perform well ):

PATA PM:
-partition 1: 128M RAID ( raid 1 with PATA SM partition 1 for /boot )
-partition 2: 180 G RAID ( raid 5 large array )
PATA SM:
-partition 1: 128M RAID ( raid 1 with PATA PM partition 1 for /boot )
-partition 2: 180 G RAID ( raid 5 large array )
SATA 1:
-partition 1: 180 G RAID ( raid 5 large array )
-partition 2: 70 G RAID ( raid 5 smaller array )
SATA 2:
-partition 1: 180 G RAID ( raid 5 large array )
-partition 2: 70 G RAID ( raid 5 smaller array )
SATA 3:
-partition 1: 180 G RAID ( raid 5 large array )
-partition 2: 70 G RAID ( raid 5 smaller array )

I write the partition tables and start the raid tools, making the following arrays:

MD0:
128 M RAID 1 mirror for /boot formated ext3

MD1:
720 G RAID 5 stripe for storage. Marked as LVM with pvcreate /dev/md/1

MD2:
140 G RAID 5 stripe for storage. Marked as LVM volume with pvcreate /dev/md/2

Next I run:
vgcreate -s 32M -n vg0 /dev/md/1 /dev/md/2

Which succeeds. So I make my logical volume like so:

lvcreate -L 500G -n backup vg0

This fails with the error incorrect metadata in volume group vg0. So I ran a pv/vg/lvscan and I see the left overs from other LVM setups. there is another volume group with logical volumes that is being picked up.

So my question is what do I need to do to wipe all traces of LVM off these disks. I want to make the disks as if they had been brand new from the store. I recall a method something like this:

dd if=/dev/zero of= bs=2048

I can't remember if that will just wipe the disk or if it will irreparably damage it. Is the above command going to over write all the information with zero's including the LVM information? Is the LVM information contained in the MBR? Will that command remove the MBR?

Thanks,

Dave
Clothes make the man, Naked people have little to no effect on society
5 REPLIES 5
Rick Garland
Honored Contributor

Re: old LVM config detected during rebuilt

I do not see any pvcreate commands in your post.

man pvcreate
Dave Falloon
Trusted Contributor

Re: old LVM config detected during rebuilt

They are under the MD section sorry I should have made that clearer.

I pvcreate /dev/md/1 and /dev/md/0

Dave
Clothes make the man, Naked people have little to no effect on society
Dave Falloon
Trusted Contributor

Re: old LVM config detected during rebuilt

I got impatient:

for i in `ls /dev/*/host*/*/*/*/disc`
do
echo "wiping disk $i"
dd if=/dev/zero of=$i bs=1024K
sync
echo "$i wiped"
done

disks are wiping as we speak. What I lack in elegance I make up for in with brute force and ignorance :)

Dave
Clothes make the man, Naked people have little to no effect on society
dirk dierickx
Honored Contributor

Re: old LVM config detected during rebuilt

did you try 'pvremove'?
Dave Falloon
Trusted Contributor

Re: old LVM config detected during rebuilt

I zero'd the disks with the for loop and everything is working properly again.

pvremove failed without the -ff switch because they were part of volume groups. But even after the pvremove, upon reboot the previous lvm configs were picked up. Overwriting everything with zero's did the trick.

--Dave
Clothes make the man, Naked people have little to no effect on society