[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#687160: old LVM data is not erased



This problem is known and documented in the partman-lvm TODO file.

This is easily reproducible with partman-auto-lvm:

1) Install guided LVM
2) Clear partition table, e.g. [1]
3) Install guided LVM again

I have a patch for partman-auto-lvm but I am not sure if this is
reproducible with manual partitioning or not, so no patch for plain
partman-lvm yet.


[1]
# fdisk /dev/vda << EOF
o
w
EOF

-- 
Regards,
Dmitrijs.
From 4ab97469b988f922602fba17417dbdcca79bf858 Mon Sep 17 00:00:00 2001
From: Dmitrijs Ledkovs <dmitrijs.ledkovs@canonical.com>
Date: Mon, 10 Sep 2012 13:02:19 +0100
Subject: [PATCH] After creating partitions, wait for devices to settle and
 wipe left-over LVM from them. (Closes: #542441) (LP:
 #154086)

---
 TODO             |    3 ---
 debian/changelog |    7 +++++++
 lib/auto-lvm.sh  |   14 ++++++++++++++
 3 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/TODO b/TODO
index c067a47..4c7c9bd 100644
--- a/TODO
+++ b/TODO
@@ -2,6 +2,3 @@
   https://bugs.launchpad.net/ubuntu/+source/partman-auto-lvm/+bug/21242
   and has been removed until it can be fixed
 
-- before creating new partitions on the disk, we need to check if there are
-  older lvm stuff on the disk and wipe it away or ask the user if we can wipe it,
-  otherwise the result is "interesting".
diff --git a/debian/changelog b/debian/changelog
index 9fd8357..9dc4957 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+partman-auto-lvm (46) UNRELEASED; urgency=low
+
+  * After creating partitions, wait for devices to settle and wipe
+    left-over LVM from them. (Closes: #542441) (LP: #154086)
+
+ -- Dmitrijs Ledkovs <dmitrijs.ledkovs@canonical.com>  Mon, 10 Sep 2012 11:37:32 +0100
+
 partman-auto-lvm (45) unstable; urgency=low
 
   * Team upload
diff --git a/lib/auto-lvm.sh b/lib/auto-lvm.sh
index 7e357df..2503e61 100644
--- a/lib/auto-lvm.sh
+++ b/lib/auto-lvm.sh
@@ -258,6 +258,20 @@ auto_lvm_prepare() {
 		close_dialog
 		device_cleanup_partitions
 	done
+
+	# Remove zombie LVMs which happed to be left-over on the newly
+	# created partition, because the disk was not zeroed out.
+	# Wait for devices to settle
+	if type update-dev >/dev/null 2>&1; then
+		log-output -t update-dev update-dev --settle
+	fi
+	# Give LVM a kick to rescan devices
+	/sbin/vgdisplay 2>/dev/null
+	# Finally purge LVM remains
+	for dev in $devs; do
+	    device_remove_lvm $dev
+	done
+
 	update_all
 }
 
-- 
1.7.10.4

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: