diff --git a/docs/storage.html.in b/docs/storage.html.in
index f920dae00f..b9b503de82 100644
--- a/docs/storage.html.in
+++ b/docs/storage.html.in
@@ -346,6 +346,7 @@
on the size and placement of volumes. The 'free extents'
information will detail the regions which are available for creating
new volumes. A volume cannot span across 2 different free extents.
+ It will default to using msdos
as the pool source format.
Example pool input
diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index 3309a936c4..ba928d84e7 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -468,13 +468,20 @@ virStorageBackendDiskBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED,
}
if (ok_to_mklabel) {
- /* eg parted /dev/sda mklabel msdos */
+ /* eg parted /dev/sda mklabel --script msdos */
+ int format = pool->def->source.format;
+ const char *fmt;
+ if (format == VIR_STORAGE_POOL_DISK_UNKNOWN ||
+ format == VIR_STORAGE_POOL_DISK_DOS)
+ fmt = "msdos";
+ else
+ fmt = virStoragePoolFormatDiskTypeToString(format);
+
cmd = virCommandNewArgList(PARTED,
pool->def->source.devices[0].path,
"mklabel",
"--script",
- ((pool->def->source.format == VIR_STORAGE_POOL_DISK_DOS) ? "msdos" :
- virStoragePoolFormatDiskTypeToString(pool->def->source.format)),
+ fmt,
NULL);
ret = virCommandRun(cmd, NULL);
}