Re: mke2fs hung

Robert Markula <[email protected]>
Newsgroups gmane.linux.debian.fai
Message-ID <[email protected]>
> I switched to a second console to look at the issue and found that 
> stderr tmpfile for mke2fs contains "Found a dos partition table in 
> /dev/sda2" and stdio tmpfile "prompts" with "Proceed anyway? (n/Y)". 
> Giving a 'y' in the main console lets it proceed, but it shouldn't 
> have stopped.
>
> It seems the wipefs -af /dev/sda* before parted is not enough. Maybe a 
> second wipefs is needed between parted and mkfs [*]?
>
> IIUC it's quite a corner case (new gpt partition overlapping an old 
> dos extended partition), but probably it's better to handle it.
>
In the past I stumbled across that issue as well. So I created a hook 
'mountdisks.DANGEROUS' that includes, among others, the following lines:

<snip>
# Clear any MD arrays:
if [ $(grep md0 /proc/mdstat) ]; then
     mdadm --stop /dev/md0
fi
if [ $(grep md1 /proc/mdstat) ]; then
     mdadm --stop /dev/md1
fi

if [ $(grep md /proc/mdstat) ]; then
     # Clear the whole disks:
     mdadm --zero-superblock --force $DISK_A

     # Clear arrays using a partition (e.g. a swap partition):
     mdadm --zero-superblock --force ${DISK_A_SWAP}
fi


# Clear the partition table:
sgdisk --zap-all $DISK_A
<snip>

Somehow redundant, I know, but I had issues with mdadm before. Never had 
a problem ever since. But be careful - this ensures that the disk gets 
completely wiped and no partition is preserved, even if you have a 
'preserve' statement in your disk_config.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.