From: "Richard W.M. Jones" <rjones(a)redhat.com>
If you use virt-make-fs to create a partitionless FAT-formatted disk
image then currently you will get an error:
$ virt-make-fs --type=fat . /tmp/test.img
'mkfs' (create filesystem) operation failed.
Instead of 'fat', try 'vfat' (long filenames) or 'msdos' (short
filenames).
mkfs: fat: /dev/sda: mkfs.fat: Device partition expected, not making filesystem on entire
device '/dev/sda' (use -I to override) at /usr/bin/virt-make-fs line 508,
<PIPE> line 1.
...propagated at /usr/bin/virt-make-fs line 518, <PIPE> line 1.
With this patch, the error goes away and partitionless disks can be
created.
---
daemon/mkfs.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/daemon/mkfs.c b/daemon/mkfs.c
index e753d9a..ee0e9d1 100644
--- a/daemon/mkfs.c
+++ b/daemon/mkfs.c
@@ -96,6 +96,11 @@ do_mkfs (const char *fstype, const char *device, int blocksize,
ADD_ARG (argv, i, "-O");
}
+ /* Force mkfs.fat to create a whole disk filesystem (RHBZ#1039995). */
+ if (STREQ (fstype, "fat") || STREQ (fstype, "vfat") ||
+ STREQ (fstype, "msdos"))
+ ADD_ARG (argv, i, "-I");
+
/* Process blocksize parameter if set. */
if (optargs_bitmask & GUESTFS_MKFS_BLOCKSIZE_BITMASK) {
if (blocksize <= 0 || !is_power_of_2 (blocksize)) {
--
1.8.3.1
Show replies by date