If you hibernate a dual-boot machine, unmount all shared partitions. Make sure that the hibernation fails if any of the shared partitions can't be unmounted.
You can relax this a little and set one of the OSes as the “owner” of a shared partition, under the following conditions:
- Only the owner ever mounts the partition read-write. Other OSes only mount it read-only.
- When hibernating the owner, remount the partition read-only.
Do not mount a filesystem read-write if it's currently mounted in a hibernated system, even if the hibernated system has it mounted read-only! That would lead to massive data corruption in the hibernated system since the inode cache would get out of synch with the actual data.
Note: beware of mounting a partition that is used by a hibernating system, even if you're mounting read-only. For example, doing a read-only mount of an ext4 filesystem that wasn't cleanly unmounted (which is the case if it's in use by a hibernated system) replays the journal and writes to the disk, which breaks the hibernated system. Call
mount -o ro,noload to mount an ext4 filesystem that's mounted read-write in a hibernated system.
If you don't want to boot other OSes while one of them is hibernated, that's possible: arrange for your hibernation scripts to modify your bootloader settings. Exactly how to do that depends on what OSes you run and your bootloader configuration. For Grub, it's enough to rewrite the
grub.cfg file: when you hibernate system S, generate a
grub.cfg with only one menu entry to resume system S; when S comes out of hibernation, restore the
grub.cfg with multiple choices.