xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: ian.jackson@eu.citrix.com, xen-devel@lists.xen.org
Cc: Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH OSSTEST 2/3] Debian: erase-other-disks: erase partitions first
Date: Wed, 20 Jan 2016 15:06:20 +0000	[thread overview]
Message-ID: <1453302381-28692-2-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1453302359.26343.133.camel@citrix.com>

It seems that when sdX is zeroed there is some chance that sdX[0-9]
will disappear before we get to them.

When partman comes along and recreates the partitions it is likely
that they will occupy the same disk space as before (since d-i's
autopartition is deterministic), meaning that LVM will find the old
PV headers again.

This is in particular problematic on multi disk systems where we end
up with an LV spanning sda5 and sdb. sdb is successfully erased here
but sda5 is not, however LVM will still find the LV with missing PV,
which is sufficient to trigger partman-lvm's checks for erasing
devices which weren't explicitly listed, resulting in:

    !! ERROR: Unable to automatically remove LVM data

    Because the volume group(s) on the selected device also consist of physical
    volumes on other devices, it is not considered safe to remove its LVM data
    automatically. If you wish to use this device for partitioning, please remove
    its LVM data first.

which cannot be preseeded around.

If the autopartitioning is not deterministic (as might be the case
when installing a different version of Debian to last time) then
going from layout A -> B -> A' risks B (by chance) not destroying the
headers created by A, meaning that A' will find them and suffer again
from the problem above. This is handled via the use of
ts-host-install-twice which will cause A' to run twice, i.e. A -> B
-> (A' -> A''). In this case A' will fail as above, but A'' will
startup seeing the partition layout put in place by A' (which matches
A) and erase those partitions, leading to success later on.

Also erase partitions for all sd/hd? not just sda+hda.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest/Debian.pm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm
index cf3486b..20f3de7 100644
--- a/Osstest/Debian.pm
+++ b/Osstest/Debian.pm
@@ -1057,12 +1057,13 @@ udevadm settle
 for sd in sd hd; do
     log "\${sd} devices present before: `echo /dev/\${sd}*`"
     for b in a b c d e f; do
+        for dev in /dev/\${sd}\${b}[0-9]; do
+            zero
+        done
+
         dev=/dev/\${sd}\${b}
         zero
     done
-    for dev in /dev/\${sd}a[0-9]; do
-        zero
-    done
     udevadm settle
     log "\${sd} devices present after: `echo /dev/\${sd}*`"
 done
-- 
2.6.1

  parent reply	other threads:[~2016-01-20 15:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-20 15:05 [PATCH OSSTEST 0/3] fixes to erase-other-disks d-i hook Ian Campbell
2016-01-20 15:06 ` [PATCH OSSTEST 1/3] Debian: erase-other-disks: add a log() helper Ian Campbell
2016-01-20 16:10   ` Ian Jackson
2016-01-20 15:06 ` Ian Campbell [this message]
2016-01-20 16:11   ` [PATCH OSSTEST 2/3] Debian: erase-other-disks: erase partitions first Ian Jackson
2016-01-20 15:06 ` [PATCH OSSTEST 3/3] Debian: erase-other-disks: rescan partition tables after erasing whole disk Ian Campbell
2016-01-20 16:11   ` Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1453302381-28692-2-git-send-email-ian.campbell@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).