Skip to content
This repository was archived by the owner on Feb 27, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions recovery/multiimagewritethread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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");
Expand All @@ -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)
{
Expand Down