Skip to content
This repository was archived by the owner on Feb 27, 2023. It is now read-only.

Commit d8a9752

Browse files
procountXECDesign
authored andcommitted
Clear partition names better & for USB (#461)
Fixes #456
1 parent a585c86 commit d8a9752

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

recovery/multiimagewritethread.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,14 @@ void MultiImageWriteThread::run()
275275
if (!writePartitionTable(_drive, partitionMap))
276276
return;
277277

278+
/* Zero out first sector of partitions, to make sure to get rid of previous file system (label) */
279+
emit statusUpdate(tr("Zero'ing start of each partition"));
280+
foreach (PartitionInfo *p, partitionMap.values())
281+
{
282+
if (p->partitionSizeSectors())
283+
QProcess::execute("/bin/dd count=3 bs=512 if=/dev/zero of="+p->partitionDevice());
284+
}
285+
278286
/* Write partition table to boot drive (if using multiple drives) */
279287
if (_multiDrives)
280288
{
@@ -283,6 +291,14 @@ void MultiImageWriteThread::run()
283291
if (!writePartitionTable(_bootdrive, bootPartitionMap))
284292
return;
285293

294+
/* Zero out first sector of partitions, to make sure to get rid of previous file system (label) */
295+
emit statusUpdate(tr("Zero'ing start of each partition"));
296+
foreach (PartitionInfo *p, bootPartitionMap.values())
297+
{
298+
if (p->partitionSizeSectors())
299+
QProcess::execute("/bin/dd count=3 bs=512 if=/dev/zero of="+p->partitionDevice());
300+
}
301+
286302
if (QProcess::execute("mount -t ext4 "+partdev(_bootdrive, SETTINGS_PARTNR)+" /mnt2") == 0)
287303
{
288304
QFile f("/mnt2/installed_os.json");
@@ -293,14 +309,6 @@ void MultiImageWriteThread::run()
293309
}
294310
}
295311

296-
/* Zero out first sector of partitions, to make sure to get rid of previous file system (label) */
297-
emit statusUpdate(tr("Zero'ing start of each partition"));
298-
foreach (PartitionInfo *p, partitionMap.values())
299-
{
300-
if (p->partitionSizeSectors())
301-
QProcess::execute("/bin/dd count=1 bs=512 if=/dev/zero of="+p->partitionDevice());
302-
}
303-
304312
/* Install each operating system */
305313
foreach (OsInfo *image, _images)
306314
{

0 commit comments

Comments
 (0)