How do I preserve changes I make to files when running an operating system that is booted - using GRUB2 - from a file that contains a file system.

I managed to get GRUB2 to boot an image file that resides on a HDD. So far so good, very useful for booting into FreeDOS for various non-Linux utilites. What I wish is that if I create a file - or change it - in this running OS, that it is written back to the image file, so that the next time I boot this image file, I can pick up where I left off, instead of starting over again with the same image that was booted the first time.


1 Answer 1


Memdisk (that's what you're using, right?) works by replacing the BIOS disk driver by its own code which changes the in-memory copy instead of reaching down to the disk. The bootloader (Syslinux, Grub or whatever else you're using) does the work of loading the image from disk, and it does not remain in memory once Memdisk has started.

In order to get the changes back onto the disk, you would need to add disk and filesystem support to Memdisk. That's not impossible in principle, but it's a significant development effort, and I'm not aware of anyone working on it.

What you can do is make a small FAT partition on your disk, copy your disk image onto it before rebooting, and copy the disk image back afterwards if you want it to persist.

  • Interesting suggestion about copying memory content to the disk. Would you know how to achieve this in practice? I have some ideas about how this could be accomplished if the live OS running is Linux, but how to write the in-memory file system to a file on the disk using Windows, I have no clue how to achieve.
    – runeks
    Nov 14, 2011 at 13:05
  • @runeks As I said, it's a significant development effort. Memdisk is not running under Linux or Windows, it's running directly on the machine — it's its own special-purpose operating system. Nov 14, 2011 at 16:24
  • I see. I was thinking of doing it from the OS though. For example in Linux, mounting a hard drive partition, creating a new file system in a file on this partition, mounting this file system, and copying the content of the root file system of the running OS to this file. Then booting from this file the next time. It could be automated in some script to be done on shut down. I guess I just need to try it out to see if it works, would be interesting if the same could be done for Windows somehow.
    – runeks
    Nov 16, 2011 at 11:28

You must log in to answer this question.

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