I am trying to make a virtual disk with two partitions. First a 100M FAT (type 0xC) and second a 2G Linux partition (type 83). I have a process that does this correctly with a real USB device. But I wanted to make the images virtual, so I do not need to use the USB device. I found a very similar question as linked at the bottom; but the answer (or problem) was the file existed on a shared drive with the host. (That was my understanding.) I am creating the virtual disk on the VM's disk; so I had hoped to avoid that issue.

I can create single partition virtual disks; format them and write files to them. I can create both type of partitions, in individual files, without problems. It is just when I try to create a two partitions in a single virtual disk that the mount fails.

I desire to have a single image file so a USB drive can be created with the same information; also, I need to place the image into the company's production system.

The message from 'mount' is:

mount: wrong fs type, bad option, bad superblock on /dev/loop1p1, missing codepage or helper program, or other error

Looking a dmesg these messages appear:

[79703.646945] FAT-fs (loop1p1): bogus number of reserved sectors

[79703.646949] FAT-fs (loop1p1): Can't find a valid FAT filesystem

fdisk shows what I expect to see:

sudo fdisk -lu

  • /dev/loop1 Disk /dev/loop1: 2.2 GiB, 2306867200 bytes, 4505600 sectors

  • Units: sectors of 1 * 512 = 512 bytes

  • Sector size (logical/physical): 512 bytes / 512 bytes

  • I/O size (minimum/optimal):512 bytes / 512 bytes

  • Disklabel type: dos

  • Disk identifier: 0xbe0f04f4

  • Device Boot Start End Sectors Size Id Type

  • /dev/loop1p1 2048 206847 204800 100M c W95 FAT32 (LBA)

  • /dev/loop1p2 206848 4401151 4194304 2G 83 Linux

I am running:

uname -a

  • Linux xxxxxxxxx 4.15.0-142-generic #146~16.04.1-Ubuntu SMP Tue Apr 13 09:27:15 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Similar question asked here.

1 Answer 1


It seems that I missed the mkfs.* step. After the losetup command and the /dev/loop0p1 and /dev/loop0p2 are available, then I needed to format the partitions.

sudo mkfs.vfat -F 32 -n "BOOT" /dev/loop0p1 
sudo mkfs.vfat -L -n "rootfs" /dev/loop0p2

In most of the examples, it appears that the disk image was already formatted; so the mkfs.* step was not mentioned.

Hope this helps in the future.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .