summaryrefslogtreecommitdiffstats
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-06-01 19:30:29 +0100
commit18c4688fcb3eadf332723de4a6ff996ce12ab1a8 (patch)
treed5eac038c392c2a15a046665de9963720752534f
parent149ba0506cbd77d6a25b57b35efccfa3b03c11eb (diff)
downloadlibguestfs-18c4688fcb3eadf332723de4a6ff996ce12ab1a8.tar.gz
libguestfs-18c4688fcb3eadf332723de4a6ff996ce12ab1a8.tar.xz
libguestfs-18c4688fcb3eadf332723de4a6ff996ce12ab1a8.zip
virt-make-fs: Provide a clearer error message when mkfs fails (RHBZ#823883).
(cherry picked from commit 975a41db20eff2b5edf510f8a65005c915b21f27)
-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 3938e277..f4977672 100755
--- a/tools/virt-make-fs
+++ b/tools/virt-make-fs
@@ -448,7 +448,19 @@ eval {
print STDERR "creating $type filesystem on $dev ...\n" if $debug;
# Create the filesystem.
- $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
+ }
$g->mount ($dev, "/");
# Copy the data in.