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:25:04 +0100
commit478cf10dbd1382c982b06b4a0c63c98983f8df9f (patch)
treed5f09bc326d7ea46d983c5d7f22f7dc818926140
parentb18aba6cf2c64edd9bbb31ace825ece75bb13998 (diff)
downloadlibguestfs-478cf10dbd1382c982b06b4a0c63c98983f8df9f.tar.gz
libguestfs-478cf10dbd1382c982b06b4a0c63c98983f8df9f.tar.xz
libguestfs-478cf10dbd1382c982b06b4a0c63c98983f8df9f.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 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");
}