Understanding Block Device Behaviour

From: Gunter Ohrner
Date: Sat Feb 16 2008 - 12:36:59 EST


Hi!

Maybe someone on this list can shed some light on my following observations.
I have a machine running Linux (2.6.23 / 2.6.24) as its main OS, a Windows
XP test installation on a physical primary partition and one logical drive
formatted as VFAT32 for exchanging data (/dev/sda11 / "d:").

I'm running the Windows inside QEMU/KVM, using "-hda /dev/sda" to provide my
physical disk to the VM. Of course, sda11 is never mounted if I start the
VM.

My expectation was that it should work fine to mount sda11, copy files to
it, umount sda11, start the VM, and access the files from there.

Short story: To my surprise this doesn't work, and I'd like to know the
reason, just out of curiosity.

Symptoms are that the freshly copied files do not show up in Windows in the
VM and chkdsk (sometimes) reports data corruption. (Reminder: sda11 had
been unmounted before starting the VM.)
If I shut down the VM and mount sda11 in Linux again, the files are gone
from there as well.

If I mount sda11 again immediately after copying and umounting and without
starting the VM in between, the files show up just fine. If I really shut
of Linux and boot my Windows test installation natively, the files are also
visible and working ok.

I've both tried to format sda11 using mkdosfs and within Windows itself, and
made sure to run chkdsk regularily to avoid suprious follow-up filesystem
errors during my tests.

Why doesn't it work as I expected?

Greetings,

Gunter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/