I set up a dual boot before, but I've never thought about how or if putting a laptop to sleep or hibernate will affect grub or the OSes. For example, if I dual boot windows 7 and ubuntu, then use windows and put it to either sleep or hibernate, will something go horribly wrong if I select ubuntu at the grub menu?
Generally speaking, you can hibernate one operating system and boot the other. Each system's state is saved in its own swap space, so you must not share the swap space between the two operating systems.
There's one thing you must pay attention to: while a partition is mounted in a hibernated operating system, you must not access it from other operating systems. With most filesystems, this is likely to destroy your data. (This doesn't apply to network filesystems mounted from another machine, these are designed to be mounted from multiple places at once.) Exception: if the shared partition is NTFS and it's not the Windows boot partition, it's safe to share at the filesystem level (but you'd better not keep a file open in a hibernated application, so it's better to unmount the shared partition before hibernating anyway).
No, the ram state is stored into the swap file or swap partition.
Since you use different swap spaces for ubuntu and windows 7, you should be able to..
- Hibernate on windows
- Boot into linux and then hibernate
- Boot into windows and resume session.. Hibernate again.
- Boot into linux and resume linux session.
Now, if you use two operating systems that are sharing the same swap space.. I have no idea what will happen. I dual boot two linux distros that use the same swap partition, so I have to careful of this. (well, I would be if I ever used hibernate =p)