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:
- 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