Snapshots of System State in Linux?
Anonymous Coward asks: "VMware provides the capability to save the state of a VMware session to a file and to later reload it to resume from where was left off, as if the (virtual) machine never was turned off. Is there a way to do this on a real Linux machine, i.e., capturing the state of the machine (the whole memory space, CPU registers, etc.) to a file and restoring it later (assuming the same hardware)? This is useful for, say, kernel debugging or fast boot (i.e., saving the machine state at some point after the kernel has been initialized and just resuming from that point on in case of reboot)." Most laptops do exactly this when they suspend to disk, however most of that is done via the laptops firmware.
In theory this can be do. It isn't that hard either, just walk through all the data structures in the kernel and write them to disk. For most memory, just tell the swaper to swap that task out and all your tasks have their registers saved automaticly.
Now for the problem: when saving state you need to save more then just the CPU. Getting the simple case to work is probably very easy. However every hardware part needs to be re-initialized to the same state it was in before. Somethings won't care, (keyboard likely) others are easy to work around. (just act like a virtual console switch). Others can be very hard to (think of scsi drivers where some program is reading from a file)
Don't forget that you can't save the state of your disk driver while you are writing that state out, unless you are careful to avoid half written registers.
This is an interesting and doable project. If you want it do it. Remember this is was linux is about: scratching your own itch and then sharing with others. If you get this working great, if not you will have least learned.
Software Suspend for Linux 2.2.x
It will save the state of your machine to the swap space and on bootup recognize the saved state and restore it. No BIOS or fimware junk nessacary
Quando Omni Flunkus Moritati
On my laptop, windows 2000 (and xp) can 'hibernate' to a file and on boot resume where it left off, in theory it can do it in win98 as well, but the suspend/hibernate/resume doesn't seem to work properly in win98
this combined with what happens on the display would lead me to believe that win2k/xp does the hibernation in software, and win98 either uses the firmware, or really crappy software.
you would probably need to have an interface to re-initialize the network cards, because there is a high probability of being on a different network when you resume. this might be a compelling reason to integrate dhcp into the kernel (bootp and arpd are in there allready) or it might not be. you would probably also want to flush everything in the write cache to disk, and drop your read caches into the bit bucket to reduce the size of the memory you actually have to save.
as for exactly how it would work, i'm not exactly sure, but i strongly believe it is possible. somebody suggested using swap space for that, but that wouldn't work if you didn't have enough free space for everything in ram. a dedicated partition at least the size of your physical ram would probably be the best solution considering ease of programming, and typical ratio of memory to diskspace.
if this hasn't been done well by the time i get to senior year in college, this would be a great senior design project for me i think.
Need a Catering Connection
I don't think it can be done without special firmware, or something in the BIOS. VMware is doing exactly what laptops are doing, VMware writes to a file in the host, and newer laptops write to a special partition. It sucks.. but possibly the only thing you can do is to put laptop brains on your desktop/server board... which may or may not be that easy to do, it certainly may be easier to convince one of the smaller board manufacturers to do this.