GNU bug report logs - #36853
mklabel does not clear mdraid version 0.90 metadata

Previous Next

Package: parted;

Reported by: Michael Hudson-Doyle <michael.hudson <at> canonical.com>

Date: Tue, 30 Jul 2019 09:37:02 UTC

Severity: normal

Done: "Brian C. Lane" <bcl <at> redhat.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 36853 in the body.
You can then email your comments to 36853 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-parted <at> gnu.org:
bug#36853; Package parted. (Tue, 30 Jul 2019 09:37:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Michael Hudson-Doyle <michael.hudson <at> canonical.com>:
New bug report received and forwarded. Copy sent to bug-parted <at> gnu.org. (Tue, 30 Jul 2019 09:37:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Hudson-Doyle <michael.hudson <at> canonical.com>
To: bug-parted <at> gnu.org
Subject: mklabel does not clear mdraid version 0.90 metadata
Date: Tue, 30 Jul 2019 21:19:49 +1200
[Message part 1 (text/plain, inline)]
Chasing down a bug report
https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/1828558 where
installing over a device previously used in a RAID array, I found that
parted's mklabel does not erase mdraid metadata 0.90 metadata (and only
that version). Here's my test script

#!/bin/bash
set -xeu
parted --version
rm -f image.img
truncate -s 1G image.img
n=$(uuidgen | cut -d- -f1)
dev="$(losetup -Pf --show image.img)"
mdadm --create --metadata 0.90 --force --level 1 -n 1 --assume-clean
/dev/md/$n $dev
mdadm --stop /dev/md/$n
losetup -d $dev
parted --script --align optimal image.img --  mklabel msdos
wipefs image.img

and here's the output on my system:

+ parted --version
parted (GNU parted) 3.2
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by <
http://git.debian.org/?p=parted/parted.git;a=blob_plain;f=AUTHORS>.
+ rm -f image.img
+ truncate -s 1G image.img
++ uuidgen
++ cut -d- -f1
+ n=e0c43267
++ losetup -Pf --show image.img
+ dev=/dev/loop44
+ mdadm --create --metadata 0.90 --force --level 1 -n 1 --assume-clean
/dev/md/e0c43267 /dev/loop44
mdadm: array /dev/md/e0c43267 started.
+ mdadm --stop /dev/md/e0c43267
mdadm: stopped /dev/md/e0c43267
+ losetup -d /dev/loop44
+ parted --script --align optimal image.img -- mklabel msdos
+ wipefs image.img
DEVICE    OFFSET     TYPE              UUID
LABEL
image.img 0x3fff0000 linux_raid_member 6dbbfe69-809c-7a77-14d5-894fb9296617
image.img 0x1fe      dos

Looking at ped_disk_clobber none of this is surprising: the 0.90 metadata
is somewhere between 127 and 64 kiB from the end of the device and this
isn't touched.

If this is indeed deemed a bug it could be pragmatically fixed by wiping
more from the end of the disk or more cleverly by using libblkid to locate
and zap all superblocks.

Cheers,
mwh
[Message part 2 (text/html, inline)]

Reply sent to "Brian C. Lane" <bcl <at> redhat.com>:
You have taken responsibility. (Tue, 30 Jul 2019 17:30:02 GMT) Full text and rfc822 format available.

Notification sent to Michael Hudson-Doyle <michael.hudson <at> canonical.com>:
bug acknowledged by developer. (Tue, 30 Jul 2019 17:30:03 GMT) Full text and rfc822 format available.

Message #10 received at 36853-done <at> debbugs.gnu.org (full text, mbox):

From: "Brian C. Lane" <bcl <at> redhat.com>
To: Michael Hudson-Doyle <michael.hudson <at> canonical.com>
Cc: 36853-done <at> debbugs.gnu.org
Subject: Re: bug#36853: mklabel does not clear mdraid version 0.90 metadata
Date: Tue, 30 Jul 2019 10:29:48 -0700
On Tue, Jul 30, 2019 at 09:19:49PM +1200, Michael Hudson-Doyle wrote:
> Chasing down a bug report
> https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/1828558 where
> installing over a device previously used in a RAID array, I found that
> parted's mklabel does not erase mdraid metadata 0.90 metadata (and only
> that version). Here's my test script

This is working as expected, parted tries not to touch more than it
needs to and this situation will often come up when you re-partition a
disk using the same values as a previous installation. You need to use
something like wipefs on the disk before creating the new partitions.

Thanks,

-- 
Brian C. Lane (PST8PDT) - weldr.io - lorax - parted




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 28 Aug 2019 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 214 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.