summaryrefslogtreecommitdiffstats
path: root/tools/virt-make-fs
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-05-24 12:30:50 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-05-24 12:30:50 +0100
commit975a41db20eff2b5edf510f8a65005c915b21f27 (patch)
tree4d43d4ed12215eefe2436776af6a1904db333f06 /tools/virt-make-fs
parentf904fa822316ff793e71d4d4ff7dc79e608dcb25 (diff)
downloadlibguestfs-975a41db20eff2b5edf510f8a65005c915b21f27.tar.gz
libguestfs-975a41db20eff2b5edf510f8a65005c915b21f27.tar.xz
libguestfs-975a41db20eff2b5edf510f8a65005c915b21f27.zip
virt-make-fs: Provide a clearer error message when mkfs fails (RHBZ#823883).
Diffstat (limited to 'tools/virt-make-fs')
-rwxr-xr-xtools/virt-make-fs14
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/virt-make-fs b/tools/virt-make-fs
index 6efa3cd0..072a517c 100755
--- a/tools/virt-make-fs
+++ b/tools/virt-make-fs
@@ -456,7 +456,19 @@ eval {
# Create the filesystem.
if ($type ne "btrfs") {
- $g->mkfs ($type, $dev);
+ eval {
+ $g->mkfs ($type, $dev);
+ };
+ if ($@) {
+ # Provide more guidance in the error message (RHBZ#823883).
+ print STDERR "'mkfs' (create filesystem) operation failed.\n";
+ if ($type eq "fat") {
+ print STDERR "Instead of 'fat', try 'vfat' (long filenames) or 'msdos' (short filenames).\n";
+ } else {
+ print STDERR "Is '$type' a correct filesystem type?\n";
+ }
+ die
+ }
} else {
$g->mkfs_btrfs ([$dev], datatype => "single", metadata => "single");
}