mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
daemon: mkfs: Use -I option to force mkfs.fat to write a filesystem over a whole device (RHBZ#1039995).
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.
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user