FAQ SearchLogin
Tuxera Home
View unanswered posts | View active topics It is currently Thu May 13, 2021 20:44



Post new topic Reply to topic  [ 7 posts ] 
Data loss in Win7 when writing to NTFS partition from Linux 
Author Message

Joined: Mon Sep 27, 2010 10:34
Posts: 2
Post Data loss in Win7 when writing to NTFS partition from Linux
Hi to everyone on the forum.
As subject, I'm encountering the problem of data loss when writing to a mounted NTFS partition from my linux Mint (Isadora 64bit).
Every modification is there as long as I'm on mint, but when I log into windows (7) data are like frozen in the previous state (before any change made through Mint).
So, on the next reboot in windows:
- if I modify any data, modifications disappear;
- if I write new data, they don't exist any more.

As far as I understand this is how it works:
I leave Win7 hibernated, most of the times. And that's it.
Writing files in Mint and opening win7 previously hibernated results in an apparent data-loss.
If I reboot in win7, the files are there.
I double checked: files written in Mint are there if I open Win7 previously shut-down.

Can anyone please confirm?

Thanks in advance,
Samuele.


Mon Sep 27, 2010 10:49
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Data loss in Win7 when writing to NTFS partition from Linux
Hi,

Quote:
As far as I understand this is how it works:
I leave Win7 hibernated, most of the times. And that's it.
Writing files in Mint and opening win7 previously hibernated results in an apparent data-loss.

When leaving Win7 hibernated, the file system data which was held in cache is not written to its normal location, but it is written within the system image into some special file. When Win7 is awakened, the cache is restored to its state before it was hibernated, and if the file system was changed in the meantime, the cache is not consistent with actual data.
So never mount as read+write a file system which was active when Windows was hibernated.

Regards

Jean-Pierre


Tue Sep 28, 2010 10:37
Profile

Joined: Mon Sep 27, 2010 10:34
Posts: 2
Post Re: Data loss in Win7 when writing to NTFS partition from Linux
thanks for the reply.


Tue Sep 28, 2010 17:36
Profile

Joined: Wed Oct 24, 2007 18:55
Posts: 30
Post Re: Data loss in Win7 when writing to NTFS partition from Linux
Doesn't Windows mark the partition that it has mounted?
Or at least in case of hibernating?
So ntfs-3g could at least give some warning if such a partition is mounted in Linux (or MacOS...) ?


Tue Nov 02, 2010 16:13
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Data loss in Win7 when writing to NTFS partition from Linux
Hi,

Quote:
Doesn't Windows mark the partition that it has mounted?

It does.
Quote:
Or at least in case of hibernating?

This is a different thing. When hibernating Windows creates a special file on the system partition, so ntfs-3g is not aware of hibernation when mounting another partition (whose updates may be temporarily stored on the system partition during the hibernation).
Quote:
So ntfs-3g could at least give some warning if such a partition is mounted in Linux (or MacOS...) ?

Yes it can, this is controlled by the mount options recover/norecover. Now the default is recover. By the way I see this is not mentioned in the manual, I will add it for the next release.

Regards

Jean-Pierre


Tue Nov 02, 2010 17:47
Profile

Joined: Mon Aug 15, 2011 20:54
Posts: 1
Post Re: Data loss in Win7 when writing to NTFS partition from Linux
dentex wrote:
As far as I understand this is how it works:
I leave Win7 hibernated, most of the times. And that's it.
Writing files in Mint and opening win7 previously hibernated results in an apparent data-loss.

Can anyone please confirm?

I am afraid this has happened to me, too. I have Win7/64-bit and Debian Squeeze installed on my PC. While Win7 was hibernated I used Debian for quite a while (read: several weeks) and wrote quite a lot of data on the NTFS partition. I was quite impressed how well writing to NTFS works now.

Completely unaware of potential issues I went back to Win7 only to discover that all my recent data had disappeared.

Is there anything I could do to recover the files? I tried running chkdsk /f on my ntfs partitions and it recovered something but not nearly all.

It would be nice to get a warning when mounting a mounted-by-windows partition, and the mount should then be read-only by default.


Mon Aug 15, 2011 21:15
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Data loss in Win7 when writing to NTFS partition from Linux
Hi,

Quote:
It would be nice to get a warning when mounting a mounted-by-windows partition, and the mount should then be read-only by default.

I agree that this would be nice, but I am not sure Windows provides usable information.

Anyway, ntfs-3g is supposed to refuse to mount a Windows system partition on which Windows was hibernated. When you lost data, can you confirm this was not on a Windows *system* partition ?

On a non-system partition, I suppose Win 7 leaves the partition in the mounted state when being hibernated. If so, you should be able to avoid mounting on Linux by using the option norecover.

With Windows hibernated and no Windows partition mounted on Linux, can you post the outputs of :
Code:
# replace device by a non-system device mounted by Windows, e.g. /dev/sda1
ntfsinfo -fv -F hiberfil.sys device | grep attributes
# replace device by a non-system device mounted by Windows, e.g. /dev/sda2
ntfsinfo -fvi 3 device | grep Flags


Regards

Jean-Pierre


Wed Aug 17, 2011 11:47
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Original forum style by Vjacheslav Trushkin.