thEsp wrote:
The one thing that keeps me far from attempting to write a proper operating system is disk management (reading & writing) through a virtual machine, such as QEMU.
You just specify a disk image file on the host and QEMU will show its contents as a disk to the guest.
thEsp wrote:
I have little to no knowledge about file systems and am not sure how disk images work.
Disks contains sectors. When you save all sectors into a file, one after another, that's a disk image. That's all. Some VMs use their own format (VMDK, VDI, etc.) but those are the same with a header. To add such a header you can use
qemu-img (separate package) or "VBoxManage convertfromraw" (part of VirtualBox) commands. But QEMU understands raw disk images too:
Code:
qemu -drive file=(yourimagefile),format=raw
thEsp wrote:
So my question is, how do I manage the files in a virtual disk and read through it, in the most basic way possible?
Under Linux you can create a loopback device as others said. Under Windows you can use some utility like DaemonTools, BenLunt's
fs tool or
FUSE. That latter has a big advantage that you can later reuse ca. 90% of the code in your kernel, and you can also implement your own FS with it (Windows version requires cygwin though).
Cheers,
bzt