[Fai-commit] r4627 - people/michael/features/setup_harddisks_2/implementation
andreas at alioth.debian.org
andreas at alioth.debian.org
Thu Oct 18 10:00:13 UTC 2007
Author: andreas
Date: 2007-10-18 10:00:12 +0000 (Thu, 18 Oct 2007)
New Revision: 4627
Modified:
people/michael/features/setup_harddisks_2/implementation/Makefile
people/michael/features/setup_harddisks_2/implementation/shdd2-commands
Log:
erase lvm signature
Modified: people/michael/features/setup_harddisks_2/implementation/Makefile
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/Makefile 2007-10-17 09:08:57 UTC (rev 4626)
+++ people/michael/features/setup_harddisks_2/implementation/Makefile 2007-10-18 10:00:12 UTC (rev 4627)
@@ -26,5 +26,25 @@
# TODO (bessere) fehlermeldungen wenn parted oder mdadm oder lvm tools streiken
+# 23:10 <MT> bzw. man müsste mal sehen, was man tun muss, damit vgdisplay die sehen kann
+# 23:10 <MT> ich muss jetzt offline gehen, aber vielleicht kannst Du mal versuchen, das zu debuggen
+# 23:10 <stockholm> ich werde es versuche.
+# 23:10 <MT> oder eben die dd/hdparm sachen einfach reinbauen
+# 23:10 <stockholm> ja, das werde ich erst machen
+# 23:11 <stockholm> damit ich weiter komme
+# 23:11 <MT> klar
+# 23:11 <MT> falls Du dann Zeit zum debuggen hast, solltest vielleicht eher noch in shdd2-volumes reinschauen
+# 23:12 <MT> get_current_lvm
+# 23:12 <MT> _da_ sollte er eigentlich die alten Sachen finden
+#!/bin/sh
+#clean drives, BAD BAD HAX wipe the drive before lvm is loaded.
+#dd if=/dev/zero of=/dev/sda2 bs=1k count=1
+#dd if=/dev/zero of=/dev/sda1 bs=1k count=1
+#dd if=/dev/zero of=/dev/sda bs=1k count=1
+#hdparm -z /dev/sda
+#modprobe dm_mod
+
+
+
Modified: people/michael/features/setup_harddisks_2/implementation/shdd2-commands
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/shdd2-commands 2007-10-17 09:08:57 UTC (rev 4626)
+++ people/michael/features/setup_harddisks_2/implementation/shdd2-commands 2007-10-18 10:00:12 UTC (rev 4627)
@@ -151,6 +151,28 @@
################################################################################
#
+# @brief Erase the LVM signature from a list of devices that should be prestine
+# in order to avoid confusion of the lvm tools
+#
+# The list is @FAI::commands
+#
+################################################################################
+sub erase_lvm_signature
+{
+ my( $devices_aref ) = @_;
+ # first remove the dm_mod module to prevent ghost lvm volumes
+ # from existing
+ push @FAI::commands, "modprobe -r dm_mod";
+ # zero out (broken?) lvm signatures
+ push @FAI::commands, "dd if=/dev/zero of=$_ bs=1 count=1"
+ foreach ( @{$devices_aref} );
+ # reload module
+ push @FAI::commands, "modprobe dm_mod";
+
+}
+
+################################################################################
+#
# @brief Using the configurations from %FAI::configs, a list of commands is
# built to setup the LVM
#
@@ -215,11 +237,11 @@
if ( !defined( $FAI::current_lvm_config{$vg} ) )
{
- # create all the devices, unless they already exist (then, pvdisplay will
- # succeed)
- push @FAI::commands, "pvdisplay $_ || pvcreate $_"
- foreach ( keys %{ $FAI::configs{$config}{"devices"} } );
-
+ # create all the devices
+ my @devices = keys %{ $FAI::configs{$config}{"devices"} };
+ &FAI::erase_lvm_signature(\@devices);
+ push @FAI::commands, "pvcreate $_"
+ foreach ( @devices );
# create the volume group
push @FAI::commands, "vgcreate $vg "
. join( " ", keys %{ $FAI::configs{$config}{"devices"} } );
@@ -235,12 +257,15 @@
# create an undefined entry for each new device
@new_devs{ keys %{ $FAI::configs{$config}{"devices"} } } = ();
+
+ my @new_devices = keys %new_devs;
+
+ erase_lvm_signature( \keys %new_devices );
+
+ # create all the devices
+ push @FAI::commands, "pvcreate $_"
+ foreach ( @new_devices );
- # create all the devices, unless they already exist (then, pvdisplay will
- # succeed)
- push @FAI::commands, "pvdisplay $_ || pvcreate $_"
- foreach ( keys %new_devs );
-
# extend the volume group by the new devices (includes the current ones)
push @FAI::commands, "vgextend $vg " . join( " ", keys %new_devs );
More information about the Fai-commit
mailing list