Hibernating and booting into another OS: will my filesystems be corrupted?

52

16

IMPORTANT

If you came here looking for an answer to this question, please read all the answers below. There are some testimonials from people who have lost data doing this. If you plan to do this regularly, I highly recommend that you test for yourself.


Original Question

Suppose I have Windows and Linux installed on the same computer. If I hibernate Windows, can I boot into Linux without corrupting the Windows filesystem when I resume Windows? What about the other way around? What if I hibernate one, boot into the other, and mount the hibernated filesystem read/write? Read-only? If this is unsafe, is there any way to detect the hibernated state of the other OS and prevent mounting its filesystem?

Basically, how far can I push this before it breaks, and how dangerous is it near the edge? I think I know the answers to some of the above questions, but for other ones, I have no idea, and for obvious reasons I have not tested this on my own computer. If someone has tested these, please enlighten the rest of us. I'm not necessarily looking for a specific answer to every question; I'll accept any response that answers a reasonable portion.


EDIT

Let me clarify that when I say "hibernate," I mean the process of writing the contents of RAM to the hard disk and completely powering down the computer. In this state, powering the computer back on brings you through the BIOS and bootloader again, and you could theoretically select another operating system on a multi-boot system. Anyway, on with the original question:


My Results

Ok, after everyone's assurances that this would work, I tested it for myself. I set up Ubuntu to remount all ntfs filesystems and external drives read-only before hibernating. There was no need for a similar Windows setup because Windows does not read Linux filesystems. Then, I tried alternately hibernating one operating system and resuming the other, back and forth a few times. I even tried mounting the Windows filesystem from Ubuntu read-write, and creating a few files. Windows didn't complain when I resumed. So, in conclusion, you can more or less freely hibernate in a dual-boot Windows/Linux scenario.

Note that I did not test a dual Linux/Linux co-hibernation situation. If you have two or more Linux installs and you hibernate one of them, you might be able to corrupt the filesystem by mounting it from another.

Ryan C. Thompson

Posted 2009-09-11T08:36:30.893

Reputation: 10 085

@RyanThompson, How would you test this reliably? Sure it may look like it's working, until it doesn't. – Pacerier – 2015-04-26T22:36:28.470

That's why I marked the "Don't do it you will lose data" answer as accepted. – Ryan C. Thompson – 2015-04-27T09:36:51.177

Did all work well for you in the years after asking the question? – Arjan – 2016-10-01T09:56:46.787

I never managed to sleep or hibernate Windows when booted from GRUB. Is this really possible? :D https://superuser.com/questions/487157/windows-wont-sleep-after-booting-from-grub

– inf3rno – 2017-03-23T05:50:22.567

1I'd like to further clarify that I'm looking for someone who has actually tested these questions and similar one empirically. But, failing that, feel free to speculate. If no one has any real test results, I'll accept the most plausible speculation after a while. – Ryan C. Thompson – 2009-09-11T20:13:05.627

Well, I'm going to try to test some of these ideas soon. If I end up with a machine that still boots, I'll come back and accept an answer. ;) – Ryan C. Thompson – 2009-09-13T19:52:33.710

Answers

17

Booting Windows over an hibernated Linux is not a good idea. I just lost 20 GiB of data in a shared NTFS partition...

I hibernated Ubuntu Lucid one day, and the next I fired up my computer. Some update messed up the saved option in Grub, so instead of booting Ubuntu again as it should, it started Windows 7. When I came back with my coffee, I just went on using it without recalling Ubuntu was in bear mode. I probably accessed music, Firefox profile, documents, downloads and games from the shared partition.

The next time I switched to Ubuntu, I saw the "waking up from hibernation" message. Dang. But I expected it to fail at waking, and soft reboot instead, as happened the previous time I "tried" this (in my Karmic times). But no, it woke up alright. Cool. Or not. I quickly realized a directory in the root of the shared partition was now empty. I think the only programs accessing the shared partition on resuming were Quod Libet (music player) and Transmission (bittorrent client).

I went back to Windows, where I couldn't even open the directory. Trying to "dir" it in shell produced "file not found". Corrupted. Still, the partition's free space had not increased, so my 20 GiB where probably still there, safe from being overwritten. Maybe. But how to get to them?

A little research provided little help, and made my hopes even more bleak.

I ran Scandisk ("Check for Errors") without auto repair, since I don't wanted to risk it fixing things by further destroying my data. The result was not very informative: "Errors found. Run with auto repair." Unknown to me, seemingly it also marked the partition to be automatically checked on next boot. I powered off and went away, and came back with EasyRecovery later.

The computer started with me not paying attention, as usual, and when I looked, chkdsk was already spewing errors in full swing, which it did for some ten minutes. Oh well, here goes nothing.

Fortunately I did lit a candle for Santa Tecla recently, and after Windows started, my data was back, all of it as far as I can tell, though some files ended up in found.000.

So yes, this had a happy ending. You'll forgive the dramatic suspense, but that's to drive a point across: backup your data! And (in my case) keep the backup up to date! And of course, be extra careful with hibernation and shared partitions...

Chema

Posted 2009-09-11T08:36:30.893

Reputation: 334

2It seems to me that the issue is the OS leaving the partition in an "unclean" state. There is an option in Windows not to cache writes, maybe that helps, Maybe there is a similar option in Linux. Or maybe we can find a way of having the system "clean up" the partition before going to sleep. – Rolf – 2015-05-07T11:51:52.507

5I'm going to mark this as the accepted answer just to err on the side of caution for new users reading this question. – Ryan C. Thompson – 2010-05-02T05:54:51.213

Indeed, to a non-OS expert it would seem to make sense to flush caches before hibernating. – nsandersen – 2019-06-08T10:06:38.530

I have Linux on a completely separate SSD to the Windows C: SSD. I had planned a shared data partition on the rotating platter, but perhaps I should mount/unmount that in RW mode manually for "dual hibernation" to be less risky? – nsandersen – 2019-06-08T10:08:33.407

@nsandersen: To this day I cannot fathom what kind of filesystem logic would corrupt a directory which I didn't move/rename... I only worked with its contents. If you value your data, I would say don't. If you don't mind losing it, you will forget some times, so automatic is better than manual... until updates break your Grub configuration. I bet you will lose data if you try this regularly, and fscking a terabyte and playing CSI in found.000 is not fun. – Chema – 2019-06-09T16:25:52.890

@nsandersen part B: Besides, it's probably pointless. To remount as read-only you probably have to close every open file on it. And even then, this won't be safe until desktop software supports time travel: if you hibernate with a file open in a read only partition, modify it in the other OS (which happens all the time, with metadata) , then wake up from hibernation, bad things are bound to happen, as most programs are not designed to respond to files changing or disappearing magically. The program might crash or corrupt its memory, making you lose any other stuff you had been doing on it. – Chema – 2019-06-09T16:45:05.793

Points taken, thank you. Sounds like safest options are having the data visible/read only under linux or no shared partition at all. For now a moot point as ubuntu will not hibernate at all on this laptop (and would not resume on the old one). Such a pain this rarely works on ubuntu, which is being promoted as an OS for portable computers. – nsandersen – 2019-06-09T16:53:10.297

Updates caused by one OS affecting the other are rather normal and are not actually caused by issues with hibernation. The hibernation state is treated as any other file on the filesystem. Can't quite see why this answer was accepted. – Matt H – 2011-12-06T08:09:12.657

1A whole directory dissapearing into FAT limbo is not an "update caused by one OS," not an intentional one at least. I experienced data corruption in a shared NTFS partition after hibernating Linux, booting Windows, then waking up Linux, simple as that. – Chema – 2012-02-02T22:22:03.793

2Hibernating one OS and mounting the same partition in another is effectively having two operating systems access the disk at the same time. They don't know about changes the other one has made so corruption will result. – psusi – 2013-09-29T03:02:31.937

Agreed. Except it's not at the same time. I would think it technically possible to perform a lazy-then-forced umount on hibernation (on shared drives), and then synchronize filesystems/flush journaling buffers/xpark the drive/whatever they call it today, hence leaving it in a clean state. This would probably require some fancy new dance moves in every program, like "finish up quickly, then prepare to resume where you left off... if you can"; mobile OSes and programs seem to do this. Wait a minute... /me goes off to hibernate and reboot to Windows 8 – Chema – 2014-05-17T09:55:05.440

23

I always hibernate Windows before booting in anything else, Windows is just too slow to start from scratch. But it is dangerous to write to the partition of hibernated OS, because some of the FS tables are still in memory (well, in hibernation file but not in the FS), applications still have handles to some files and generally file system state is kind of unstable.

But you can mount that partition read-only, this way it will stay exactly the same as before hibernation and Windows won't notice a thing.

As for a suggestion about mounting it normally and just stay away from system files, it is not a good idea. Relocation of a file content might happen, MFT might be changed, access time attributes will be changed, all those things might seriously corrupt a file system. It is not so dangerous with FAT but it is really really dangerous with NTFS, as it is far more complicated and have far more state in the memory.

vava

Posted 2009-09-11T08:36:30.893

Reputation: 5 238

since Windows 8 and up Windows boot is lightning fast. When I was using windows 7 it loads slowly so until I can get the browser to start the network is already available. Then I upgraded to windows 8 and since then when I came home, turn on the router then turn on the laptop and browsers I have to wait for a long time before I can access the internet. Since windows 10 it's even faster, press power then a few seconds you'll be ready – phuclv – 2017-01-21T05:13:35.563

1Are you sure that mounting read only is ok? My understanding is that with journaling filesystems, even a read-only mount will replay the journal and thus cause a change to the filesystem.

On the other hand, the only Linux filesystem you can access from windows is ext2, which is non-jornaling, as is FAT, and Linux probably does a true read-only mount of NTFS, for historical reasons. So maybe it is safe. I any case, I'd like it if someone had concrete test results. – Ryan C. Thompson – 2009-09-11T20:09:43.870

2No, when FS is mounted read-only nothing got changed on it at all. This is why it is called read-only :) There's no need for a journal as it ensures that state of FS alway correct but when state does not change, it is not necessary, so journal is not used. And it works for me for quite a while now, so there's your testing results :) – vava – 2009-09-12T02:18:31.447

1"windows is too slow to start from scratch" Are you serious?

I must be doing something wrong then, cause when my laptop hibernates, it adds around 2 minutes or more to my boot up time. – thepaulpage – 2009-11-11T20:19:23.030

1I was talking about XP and yes, it is slow as hell considering how much it time it takes from boot to working applications. Ubuntu 9.04 was running circles around it. Ubuntu 9.10 is much slower for some reason. – vava – 2009-11-12T03:31:14.887

9

I regularly hibernate my Windows XP and boot over USB into Ubuntu.
Works flawlessly.

There is a difference between 'Standby' mode and 'Hibernate' mode.
The OS state is completely flushed to the disk and your hardware is powered off.
If you power up the machine and boot into some other OS, it has no impact on the hibernated OS.
You can keep as many OS'es hibernated as you want.

As an example,
You could have multiple Ubuntu installations (say, one per USB flash drive),
And, hibernate each, unplug the drive, and boot into another one.
There is no edge here because there is no stacking/chaining effect.
The hibernated USB sticks in this examples are all independent of each other
(across a power-cycled machine).

One small downside of a hibernated "C:\" drive and booting into another OS is,
you would not be able to mount the hibernated boot partition in the new OS.
The partition is locked with hibernation.
It will be corrupted if edited in that state.

nik

Posted 2009-09-11T08:36:30.893

Reputation: 50 788

IMHO the corruption people talk about is most likely related to the Linux NTFS driver being not fully compatible with all NTFS features. It's best to mount Read Only. – Matt H – 2011-12-13T01:28:42.297

Ok, you would also want to read Is NTFS on Ubuntu stable?

– nik – 2011-12-13T14:16:32.783

Actually you're wrong, in a good way! I tried hibernating Windows and booting into Ubuntu and mounting the windows filesystem, and it works, with no corruption when you resume Windows from hibernation! It surprised me. – Ryan C. Thompson – 2009-09-14T07:48:41.020

nik is right -- do not mount the partition from the other OS, it is still mounted in the hibernated OS. You wouldn't mount the same partition in two virtual machines (using direct partition access) running at the same time, would you? – Ben Voigt – 2012-06-25T14:59:20.940

8

I can confirm the loss of data issue with a shared NTFS partition. I dual-boot between Lucid Lynx Ubuntu and Windows 7. After hibernating Windows 7 and booting into Ubuntu, I proceeded to build three VirtualBox virtual machines (over the course of 7 days) and installed a variety of software packages into those machines. Upon restarting into Windows 7, the files disappeared. Gone. ntfsundelete and foremost were not able to find them.

So, I ran a series of tests to see if this was in fact what caused the loss of data. When shutting Windows 7 down, starting Ubuntu, writing some files, restarting back into Windows 7, the files are always retained. When hibernating Windows 7, restarting in Ubuntu, writing some files, restarting into Windows 7, the new files are gone.

I don't know about CHANGES written to a file, whether they are retained or lost, but new files and folders added to a shared NTFS partition are most likely going to be lost in this situation.

CtC

Posted 2009-09-11T08:36:30.893

Reputation: 81

4

Just ran into an issue on a shared physical drive (FAT32) between Windows XP and Windows 7. I hibernated Windows XP, booted into Windows 7 for a few days, then went back to XP. Now I have a corrupt file system on the shared drive. Disk Checker is running, and it looks pretty bad. Mostly cross linked files though, but thousands of them.

Daniel

Posted 2009-09-11T08:36:30.893

Reputation: 41

3In other words... If you do hibernate to disk, DON'T use a shared drive. (or, if you use Linux, umount that drive before hibernating) – Denilson Sá Maia – 2011-02-05T02:40:37.683

4

There is nothing wrong with what you mentioned. Even if you mounted the hibernated filesystem, the contents of the hibernation are saved to a large file on the disc - as long as you don't touch this file, or any important system files (obviously), then nothing will happen.

If you change the contents of a partition from another OS after you turn the system off, the original partition will still boot with no problems. It's the same thing in hibernation.

Just be sure that when mounting/unmounting the partition, you don't damage any system files or drive header information (e.g. MBR, file journals) - although this point has nothing to do with hibernation, and more just a common warning we all need to know.

Breakthrough

Posted 2009-09-11T08:36:30.893

Reputation: 32 927

3Thought experiment: what if you have a document or file open in an app in Windows (eg you're editing a Word doc) then you hibernate and boot to the other OS. There's no active file lock any more so as far as Linux knows it can safely do anything with the file, so if you decide it's mis-filed and move it to a different directory Linux will let you. When you boot back to Windows what does Word do if its file has suddenly disappeared? Now think what would happen if this file was more vital than a Word doc? Read Only mounting is going to be an awful lot safer. – GAThrawn – 2009-09-11T14:27:56.010

1This turns out to be the most accurate answer. You can, in fact mount and make modifications to the Windows C drive while Windows is hibernated, and it won't complain. I haven't tested this with Linux, but I suspect that it won't work. – Ryan C. Thompson – 2009-09-14T08:21:07.823

@Ryan, you can but it is not 100% safe. NTFS might be broken far too easily. Another issue is that Linux and WIndows use NTFS slightly different so what is working with Windows might not work with Linux. These differences might end up in FS corruption, especially in such an edge case state of FS. – vava – 2009-09-14T08:51:39.043

@GAThrawn - What does Word do? Try forcably editing a Word document under Windows and see what happens. Programs exist to remove file locks.

@vava - As long as you are using a program/operating system which complies with the NTFS MFT and the Journal, it should be fine. – Breakthrough – 2009-09-14T11:33:55.283

I know that it's not 100% safe, but the point is that if I accidentally mount the windows filesystem in linux after hibernating windows, the result is not instant and irrecoverable corruption. In other words, I would actually have to put in some effort if I wanted to shoot myself in the foot. – Ryan C. Thompson – 2009-09-14T19:13:29.180

4

This is kinda old, but being a critical issue, another testimonial is worth it.

I have an external NTFS USB hard drive that I'm using for data (no OS-related files) with 2 different PCs. I used to get constant data loss on it until I isolated the problem. One of the PCs is rather old and slow (Windows XP) so I was using hibernate for faster restart times, disconnecting the hard drive while in that state and writing data with the other PC (Windows 7). Data loss was not occurring every time but it was definitely caused by this scenario. Since I stopped doing it, it never happened again.

user3671607

Posted 2009-09-11T08:36:30.893

Reputation: 143

The most scary thing for me: this seems to be about a data disk, right? So it's not even the state of the OS itself that is hibernated onto that USB disk, but just data? In that case I'd kind of expect software to properly write things to disk when they get the signal that the OS is about to hibernate. But apparently not... – Arjan – 2014-07-31T11:17:17.673

1Exactly. It's a data disk. No OS-related files on it. Sorry for not emphasizing that. Actually, that's why I felt I needed to add my contribution. When I first diagnosed this I was told that it's common sense not to do, but although I'm an it professional this doesn't look obvious at all and it's a scenario so likely to occur with external drives. I guess the reason it's not commonly discussed is that few people actually go to lengths to analyse and diagnose it. Let alone report. – user3671607 – 2014-07-31T11:35:35.753

Perhaps a silly question: did you safely remove the drive (i.e file manager, right-click on the device, and eject) before hibernating, or did you just pull the drive? – gamen – 2017-01-04T09:47:12.533

Yes, it's a silly comment: how do you safely remove a drive while the computer is in hibernate? – user3671607 – 2017-01-05T11:40:00.213

3

I had the following highly destructive experience with dual-booting Windows (Vista) and Ubuntu (9, 10, 11). I am not a technical user, though I have long experience using and configuring Windows and DOS. I installed Ubuntu via a live CD on a Win Vista machine. This proceded flawlessly and I had the dual boot up and running in no time. Seeing as there were no warnings attached to the Ubuntu installation, I (naively) assumed that I could hibernate (saving to disk, not suspending) both systems and switch freely between them. This had the following results:

1) I made the mistake of editing a text-file in Ubuntu that I had forgotten was open in Windows. Afterwards the file was inaccessible to either operating system. It could not even be deleted. Chkdsk finally deleted it, but my data were lost.

2) I also tried two other file operations from Ubuntu directly into the Win partition: Generating a pdf-file from OpenOffice, and creating a directory/folder on the Win desktop. Both were inaccessible from Windows (though they could be seen in Win explorer). Luckily they could be deleted from Ubuntu, though chkdsk had to be run afterward to delte then completely from Windows.

3) A large OpenOffice Writer file (saved as *.doc), which was edited first in one, then in the other operating system several times (it was not open in the other system when I edited it), suddenly ballooned in size from about 2 MB to 7 MB, making it nearly impossible to load and save. When I saved the file as an *.odt document its size was greatly reduced but save/load times were no faster. When I unzipped the file, its "contents" section turned out to be more than 22 MB. When I accessed this with a text editor, it turned out that every single word and space in the document was separately formatted in and out of the same style! I finally resolved the problem by comparing the giant version with an earlier version of the same file, using the old version as the basis for the comparison, and then accepting all changes and saving.

4) At this point I upgraded from Ubuntu 10 to Ubuntu 11 and discovered that the 11 system used the new Unity interface exclusively, which was completely unacceptable for my purposes. When I figured out how to install Gnome on Ubuntu 11, it turned out Gnome 3 was far inferior to Gnome 2. I therefore decided to uninstall Ubuntu completely and make a fresh installation of Karmic Koala, which uses Gnome 2 without any trace of the new Unity system. This turned out to be complicated, but after finding the exact same instructions repeated in several manuals online, I proceded. Everything went fine until I ran EasyBCD 2.1.2 (from windows), which would allow me to reboot directly to Windows after Ubuntu's Grub booter had been removed. On rebooting, I found that my MBR was fatally damaged and the machine did not recognize any bootable hard drives. I needed to pay a technician to restore the MBR.

5) Now I could boot to Vista again and I was getting ready to reinstall Ubuntu, when I discovered that a number of files started disappearing from my system at random. Obviously the file system was still corrupted. Only a complete reinstall of Windows solved the problem, and I am now considering very carefully what I should do to avoid similar problems in the future, before installing Karmic Koala. I hope my problems are related to the hibernation issue, but to be sure, I am considering creating a separate "transfer" NTFS partition, where I can put files from one operating system before accessing them from the other. Impractical, but it ought to be safe. I hope.

Finn

Posted 2009-09-11T08:36:30.893

Reputation: 31

3

I ran into problems with hibernate and multi-booting. Situation: Ubuntu and WinxP Multboot but the data partition visible for both OS. I did some testing... back and forth... So I was editing a Wordfile with Word... Saved the file and closed Word. Hibernated... started Ubuntu... edited the same file with OpenOffice... hibernated.

Rebbooted to the hibernated WinXP. Word did NOT 'see' the changes... It simply loooked like another file...

I also did this testing the other way around... Second time file was corrupted... I could not open the file or delete the file Chkdsk 'solved' the problem but the file was lost... In another test Ubuntu did not even see the edited file.

SO when using hibernation and the same partitions (does NOT need to be the partition where the OS boots from...) ist is very dangerous... Files can and will corrupt in my tests and I can repeat it... BTW: In my tests I ALWAYS saved the file and closed the application (Word and OpenOffice) befre going into hibernate...!! I thought mounting the partition was the culprit but now I think the problem must be something about file-caching or whatever... Anyhow: Be careful with multi-OS-hibernation...!! Regards, ArnoR

ArnoR

Posted 2009-09-11T08:36:30.893

Reputation:

2

Don't do it (again!)

I hibernated my Vista/NTFS and booted up Lucid, worked 3 days on the shared ntfs partition, and started having files and directories disappearing or locked with nasty error messages (within lucid). When I booted back to windows it was a true mess, desktop gone havoc etc.. Hopefully chkdsk was able to fix most of it and I fished out from found.000 about 98% of what I had before.
So it's definitely not a good thing to do.
I sort of remember that this was not possible before: 'hibernated' ntfs partitions were not mountable in linux for some (apparently good) reason. I'd like to come back to this old behavior

user36993

Posted 2009-09-11T08:36:30.893

Reputation:

2

DANGER! I can also confirm this is a dire issue for both FAT32 and NTFS volumes & only when Windows (I have windows 7) is hibernated. I think this is tied to caching and have considered setting the drive up for quick removal. That may fix it, but I haven't tried it yet because I really only want to set one partition up this way which Windows does not seem to support. Even my OSX ntfs driver supports per partition cache control, but not windows. Also, my OSX ntfs driver seems to recognize that the drive should not be mounted. Seems to be tied to this issue. Hope that helps.

user37071

Posted 2009-09-11T08:36:30.893

Reputation:

1Yes, it's related to caching, and no, "optimize for quick removal" won't help. That makes Windows write changes out immediately, but Windows will still assume (dangerously) that its read cache is 100% valid, and won't see changes other OSes have made to the disk. – Ben Voigt – 2012-06-25T15:02:34.820

1

Here is my experience. I am using a dual boot system with Windows and Kubuntu (11.04). Most of my files are on a Windows NTFS partition and I use primarily it from Linux. It's mounted using FUSE.

This is what happened:

  1. Hibernated Windows
  2. On the next boot, booted to Linux and used it for couple of weeks - without booting to Windows
  3. Booted back to Windows (because an online test only worked in Internet Explorer and nothing else, somehow ie4linux wasn't sufficient)

When Windows resumed, I noticed that all the files created in those two weeks were missing. I rebooted back to Linux to verify only to find files missing there too. I am guessing Windows restored the NTFS filesystem to the state when it was hibernated and restored it back to that point in time.

I tried tools like ntfsundelete and testdisk. Those missing files are not listed. Also, Linux mounts that drive in RW mode even when Windows had hibernated and not shutdown. I guess Linux warns or just mounts the drive in read-only mode, but that didn't happen here.

spa

Posted 2009-09-11T08:36:30.893

Reputation: 111

2There is a marking on the filesystem metadata whether it's unmounted properly or not... I also would think the correct behavior is for the Linux NTFS driver to check that flag. – Ben Voigt – 2012-06-25T15:04:08.203

1

I can also confirm that share some non-system partition between two different O/S in hibernate state makes file system corruption and loose of data.

Scenario: I have 3 partitions NTFS: 1. Windows XP 2. Windows 7 3. Data ( I have to still use XP for old apps which don't work well in compatbility mode).

Example: Boot from partition 1 (XP) and run Thunderbird which store files on 3. Then hibernate (OS dump RAM to hibernate file and shutdown PC). Boot from partition 2 (7) and run Thunderbird which store files on 3. Here the problem begins with access files etc. sometimes with or without chkdsk. Back to boot from partition 1 and files fixed by OS_2_7 are again corrupted, even worst some open files before hibernation (ex. Firefox) are corrupted now.

So yes. Hibernate two O/S no matter they use system/non-system partition will make data corruption. Why ? I suppose the root cause is file LOCK and MFT. After wake up from hibernation O/S doesn't refresh MFT so still suppose to find files in old sectors, so any file which changed his size/place will be corrupted.

Varso

Posted 2009-09-11T08:36:30.893

Reputation: 11

Well, what files became corrupted? Just those belonging to Thunderbird or several unrelated files? It can make (some) sense that if Thunderbird is run from the same location in partition 3 then there are two different data sets in two different systems. One will try to force the other. – Doktoro Reichard – 2013-09-29T00:25:18.763

0

I used to do exactly this. I never mounted the system drive of the hibernating machine to avoid accidents, and each OS have their own separate swap partition. However I had a dedicated data partition, which I would use to transfer data between the two hibernating OS. I even put my Firefox and Thunderbird profile there, so I don't need to keep two separate profiles. Just make sure to close the Firefox on one machine before hibernating it.

I don't recall ever having any issues with the setup, and I used it for quite a long time as well.

Lie Ryan

Posted 2009-09-11T08:36:30.893

Reputation: 4 101

What FS do you use on the shared partition? I am starting to think that maybe NTFS has something to do with it, everybody complains that their shared NTFS paritition is getting corrupted. – Rolf – 2015-05-07T11:59:03.773

@Rolf: NTFS with ntfs-3g driver on Linux. Also, this was purely data partition, except for applications like Firefox/Thunderbird, which I know has warnings for unclean shutdown, and which I would always close before switching OS. – Lie Ryan – 2015-05-09T01:06:00.143

Maybe FAT would do? NTFS is better but in this case it does not seem to work well, to say the least. Also, if we can get the system to flush all buffer to disk before hibernating, maybe it'll help. But I guess it would be best to experiment with different filesystems (EXT or others might also be options) for the shared partition. If anyone is willing to do that :) Maybe in a virtual machine? BTW I encountered the same problem by using a VM, saving the state, then using the same VM (same file) but under another OS. The VM host was not aware of the saved state. – Rolf – 2015-05-16T18:24:21.977

1So what your'e saying is that if we remember to close all file handles to the shared partition before hibernating, then it should be OK. – Rolf – 2015-05-16T18:26:14.427

0

The answer is that, with NTFS, apparently, yes (see other answers). You could try with older, simpler filesystems such as FAT. But that would be a stab in the dark.

I just want to add that the problem can be reproduced with virtual machines. I use VirtualBox on a dual boot machine. I've installed the VirtualBox host software in both the Windows and Linux partitions, and save the image files on a shared NTFS partition. The aim was to be able to use the same VM in both Windows and Linux.

Out of habit, I used the "save machine" state command in VirtualBox when shutting down the VM. I used this command (which saves RAM state for the VM somewhere), rebooted my laptop into the other OS, and used that same VM again. There was no restore option in VirtualBox, so apparently VirtualBox is not aware of saved state of a VM if the state was saved using another installation of VirtualBox. I read that VMware might be smarter about that, but I haven't tried it.

Eventually all my VMs got corrupted. I was able to fix most of the damage using fsck, though.

This is just to say that you don't need to spend hours partitioning and installing an OS to reproduce this problem.

My solution? Disabled hibernation on Windows. It is disabled by default in Ubuntu. Also never use save machine state for a VM if you plan to launch that VM in a different context (different OS, different host install, etc).

Until someone comes up with a filesystem (or OS, or whatever) that is not vulnerable to this problem.

Also, closing all open handles on the shared partition (and presumably flushing to disk) before hibernating (or, I guess unmounting the partition - there must be a way to do that in Windows as well) if has been reported to avoid corruption (see Lie Ryan's answer). I would prefer to be safe and not use hibernate at all in this situation, though.

Rolf

Posted 2009-09-11T08:36:30.893

Reputation: 235

Virtual Box save state is totally different from hibernation. Save state is a virtual machine feature, not an OS feature. The OS is totally unaware when a save state is happening. The save state isn't stored in the virtual disk image, but in another file. Virtual Box actually can restore saved state to a different machine, it's called teleporting. – Lie Ryan – 2015-05-16T23:54:57.850

-3

I just don't think this is possible.

When you hibernate, the computer is 'locked in' (for lack of a better term) to that OS. You aren't hibernating the OS, you are hibernating the whole computer. When to resume from hibernation, you don't go through the BIOS and the POST time again.

Josh Hunt

Posted 2009-09-11T08:36:30.893

Reputation: 20 095

If it didn't go through the BIOS and POST then it would not be possible to choose the OS at startup and do messups such as the ones described here. Hibernate is not suspend to ram. – Rolf – 2015-05-07T12:01:13.030

No, it will cause problems with filesystem consistency. See my post above. – Nathan Osman – 2010-05-02T03:52:19.777

I'm not talking about suspend to RAM, I mean hibernation to disk. I'll edit the question to be more specific. – Ryan C. Thompson – 2009-09-11T08:48:45.733

7Seems wrong to me. When you're hibernating, the computer is shut down. When you start it on again, it goes through the BIOS and POST. It's only when the OS loader sees that it has been hibernating that it will load the file containing the memory state (hiberfil.sys for Windows) and restore the OS. – Snark – 2009-09-11T08:48:57.950

@George: There will be problems with filesystem consistency, if you share any filesystems between both OSes. But you certainly can run a different OS that has its own set of partitions, contrary to this answer. – Ben Voigt – 2012-06-25T15:05:26.377