MD devices are not wiped if LVM exists
tt-fai at kky.ttu.ee
tt-fai at kky.ttu.ee
Wed Jul 3 16:15:04 CEST 2019
Hello,
I have, for a long time, had a separate FAI action around, which I call “cleandisks”. This makes re-installing a lvm- and/or raid-equipped host a two stage process:
1) Boot into FAI_ACTION=cleandisks. Let the script wipe the disks.
2) Reboot into install. During this boot, the kernel should find clean disks and not make any assumptions about earlier states of the disks.
The functionality of the script is similar to that of Andrew's WIPEDISKS, but let me copy it here (with some sanitation) for reference:
case `hostname` in
some_sample_host)
# This needs to be set up for each host, by looking at its configuration prior to reinstall.
# Non-existent disks, partitions, etc, will not hurt in most cases, so better err in the direction of too many.
LV_LIST="lv1"
MD_LIST="md0 md1 md126 md127"
DISK_LIST="sda sdb"
PART_LIST="sda1 sdb1 sda3 sdb3"
;;
[…]
esac
lvdisplay
# Repeat all this twice!
for round in 1 2 ; do
for LV in $LV_LIST
do
vgremove -f $LV
done
for MD in $MD_LIST
do
mdadm --remove /dev/$MD
mdadm --stop /dev/$MD
done
for PART in $PART_LIST
do
mdadm --zero-superblock /dev/$PART
mdadm --zero-superblock /dev/$PART
done
for DISK in $DISK_LIST
do
dd if=/dev/zero of=/dev/$DISK bs=10240 count=100000
done
done
lvdisplay
This is a lot of overkill, and some of the commands fail, especially on the second round, but this way I have always got rid of all the old data on the disks and booted into a problem-free reinstall.
Hoping this helps,
Toomas
From: linux-fai <linux-fai-bounces at uni-koeln.de> On Behalf Of Jerry Steele
Sent: teisipäev, 2. juuli 2019 15:08
To: fully automatic installation for Linux <linux-fai at uni-koeln.de>
Subject: Re: MD devices are not wiped if LVM exists
Moving away from Andrew's WIPEDISKS script for a second, I have made a simple script containing just
vgdisplay
The output from this is null, suggesting that FAI does not see any LVM stuff at this stage, however after it has completed these bits of the disk_config,
Executing: wipefs -af /dev/sdb1
Executing: wipefs -af /dev/sda1
Executing: wipefs -af /dev/sdd1
Executing: wipefs -af /dev/sdc1
Executing: mdadm --stop --scan
Executing: mdadm --assemble --scan --config=/tmp/fai/mdadm-from-examine.conf
Executing: mdadm -W --stop /dev/md0
Executing: mdadm -W --stop /dev/md2
... the LVM volumes are visible again (I can't grab the ouput of "vgdisplay", but it shows the volume groups). I'm guessing that this shows that the LVM metadata is immune to the wipefs stuff.
I have to stop looking at this for the moment, but I'll see if I can pick it up later and report back (unless anyone else has come across this and can report back, of course)
Thanks for your help so far guys..
--
---
Jerry Steele
Telephone: +44 (0)7492 910225
GPG: 43A3A8C6
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.uni-koeln.de/pipermail/linux-fai/attachments/20190703/9e4f8cc3/attachment.html>
More information about the linux-fai
mailing list