From d3fbf4d4efc79e9e0a1713f66be67168ca7fd1e0 Mon Sep 17 00:00:00 2001 From: procount Date: Thu, 23 Nov 2017 22:46:06 +0000 Subject: [PATCH] Clear partition names better & for USB --- recovery/multiimagewritethread.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/recovery/multiimagewritethread.cpp b/recovery/multiimagewritethread.cpp index 889df21f..79f212f1 100644 --- a/recovery/multiimagewritethread.cpp +++ b/recovery/multiimagewritethread.cpp @@ -275,6 +275,14 @@ void MultiImageWriteThread::run() if (!writePartitionTable(_drive, partitionMap)) return; + /* Zero out first sector of partitions, to make sure to get rid of previous file system (label) */ + emit statusUpdate(tr("Zero'ing start of each partition")); + foreach (PartitionInfo *p, partitionMap.values()) + { + if (p->partitionSizeSectors()) + QProcess::execute("/bin/dd count=3 bs=512 if=/dev/zero of="+p->partitionDevice()); + } + /* Write partition table to boot drive (if using multiple drives) */ if (_multiDrives) { @@ -283,6 +291,14 @@ void MultiImageWriteThread::run() if (!writePartitionTable(_bootdrive, bootPartitionMap)) return; + /* Zero out first sector of partitions, to make sure to get rid of previous file system (label) */ + emit statusUpdate(tr("Zero'ing start of each partition")); + foreach (PartitionInfo *p, bootPartitionMap.values()) + { + if (p->partitionSizeSectors()) + QProcess::execute("/bin/dd count=3 bs=512 if=/dev/zero of="+p->partitionDevice()); + } + if (QProcess::execute("mount -t ext4 "+partdev(_bootdrive, SETTINGS_PARTNR)+" /mnt2") == 0) { QFile f("/mnt2/installed_os.json"); @@ -293,14 +309,6 @@ void MultiImageWriteThread::run() } } - /* Zero out first sector of partitions, to make sure to get rid of previous file system (label) */ - emit statusUpdate(tr("Zero'ing start of each partition")); - foreach (PartitionInfo *p, partitionMap.values()) - { - if (p->partitionSizeSectors()) - QProcess::execute("/bin/dd count=1 bs=512 if=/dev/zero of="+p->partitionDevice()); - } - /* Install each operating system */ foreach (OsInfo *image, _images) {