From 975a41db20eff2b5edf510f8a65005c915b21f27 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 24 May 2012 12:30:50 +0100 Subject: virt-make-fs: Provide a clearer error message when mkfs fails (RHBZ#823883). --- tools/virt-make-fs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'tools/virt-make-fs') 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"); } -- cgit