This question is similar to the one about resuming from hibernate in a dual boot PC, but i do not assume here that the two systems share the swap. Even though answers to these questions would probably be very similar, I think my question is a bit different.

As follow from this answer to my other question, and according to this document on kernel.org, between a hibernation and the subsequent resume of a system, no mounted partition should be modified.

This looks to me like a rather strict requirement for a dual boot configuration: if I want to have a partition writable by both systems (for example, for /home), I should probably disable hibernation...

Has anybody found any workaround yet? For example, allowing the machine to only boot into the hibernated system after hibernation would be a perfect solution IMO.

  • 1
    You can mount -o remount,ro your /home before hibernation, and remount,rw after I believe. This requires that no processes will actually have any files open for writing on it though.
    – user140866
    Jun 5 '16 at 13:06
  • 1
    How can I make the OSes treat the partition like a removable device?
    – Rolf
    Jul 25 '20 at 12:33

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.