I'm working on a huge complex application. You connect a disk, press a button, and it partitions and formats the disk, mounts it, and copies some files onto it.
To test this application, we have a test system which loop-mounts a disk image and runs through the same process. Except we changed the application logic, and now the test system doesn't work. If you give the program a real disk, everything works fine. But if you give it a loop device, it fails.
Specifically, the application partitions the disk, formats it, and then whines that it can't mount the partition. The exact command is
mount /dev/vda /mnt --rw -o offset=111149056,sizelimit=314572800
/dev/vda is merely a symlink to
/dev/loop0. It makes no difference if I refer to
If I run the command by hand, I get this:
root# mount /dev/vda /mnt --rw -o offset=111149056,sizelimit=314572800 FUSE exfat 1.0.1 ERROR: exFAT file system is not found. root# echo $? 1
I can run this command over and over again, and it just doesn't work. No reason, it just doesn't.
Here is the terrifying part: If I run
cfdisk /dev/vda and then immediately quit without changing anything, now it mounts!!
What the hell does
cfdisk do to the disk that makes it suddenly start working? And how can I remove the need to call this program?
(I tried in vain to call
sfdisk -R /dev/vda; it just complains about "invalid parameter" or something.)
I can kludge the application to call
cfdisk -Ps /dev/vda or something, but I would really, really rather not do that. I want to find out why any of this is even necessary. Before we changed the application, everything worked fine...