NTFS Corruption: Files created in Linux corrupted when Windows Boots
I'm getting some file loss and corruption on my Win7/Ubuntu 12.04 dual boot setup. I have a large shared NTFS partition. I have my Windows Docs/Music/etc. directories on that file and have the comparable directors in Linux setup as a sym. link. I'm using ntfs-3g on the linux side of things to manage the ntfs partition. The shared partition is on a logical partition along with my Linux /home / and /swap partitions. The ntfs partition is mounted at boot time via fstab with the following options:
ntfs-3g users,nls=utf8,locale=en_US.UTF-8,exec,rw
The problem seems to be confined to newly created and recently edited files. I have not see data loss or corruption when creating/editing files in Windows and then moving over to Ubuntu. I've been using the sync command aggressively in Ubuntu to try to ensure everything is getting written to the HDD. I do not use hibernate in Windows so I know it's not the usual missing files due to Hibernation problem. I'm not seeing any mount related issues on dmesg. Most recently I had a set of files related to a LaTeX document go bad. Some of them show up in Ubuntu but I am unable to delete them. In the GUI file browser they are given thumbnails associated with files I created on my last boot of Windows. To be more specific: I created a few png files in Windows. The files corrupted by that Windows boot are associated with running PdfLatex on a file and are not image files. However, two of the corrupted files show up with the thumbnail image of one of the previously mentioned png files. The png files are not in the same directory as the latex files but they are both win the Document Folder tree.
I've had sucess with using NTFS for shared data in the past and am hoping there's some quirk here I'm missing and it's not just bad luck. On one hand this appears to be some kind of Windows problem as data loss occurs when I boot to Windows after having worked in Ubuntu for a while. However, I'm assuming it's more on the Ubuntu end as it requires the special NTFS drivers.
Edit for more info: This is a Lenovo Thinkpad L430. Purchased new in the last month. So it's a fairly fresh install. Many of the files on the shared partition were copied over from a previous NTFS formatted shared partition on another HDD.
As requested: here's a sample chkdsk log. Some of the files its mentioning were files that got deleted off the partition while in Ubuntu. Others were created/edited but not deleted.
Checking file system on D:
Volume dismounted. All opened handles to this volume are now invalid.
Volume label is Files.
CHKDSK is verifying files (stage 1 of 3)...
Attribute record of type 0x80 and instance tag 0x2 is cross linked
starting at 0x789f47 for possibly 0x21 clusters.
Some clusters occupied by attribute of type 0x80 and instance tag 0x2
in file 0x42 is already in use.
Deleting corrupt attribute record (128, "")
from file record segment 66.
86496 file records processed.
File verification completed.
385 large file records processed.
0 bad file records processed.
0 EA records processed.
0 reparse records processed.
CHKDSK is verifying indexes (stage 2 of 3)...
Deleted invalid filename Screenshot from 2012-09-09 09:51:27.png (72) in directory 46.
The NTFS file name attribute in file 0x48 is incorrect.
53 00 63 00 72 00 65 00 65 00 6e 00 73 00 68 00 S.c.r.e.e.n.s.h.
6f 00 74 00 20 00 66 00 72 00 6f 00 6d 00 20 00 o.t. .f.r.o.m. .
32 00 30 00 31 00 32 00 2d 00 30 00 39 00 2d 00 2.0.1.2.-.0.9.-.
30 00 39 00 20 00 30 00 39 00 3a 00 35 00 31 00 0.9. .0.9.:.5.1.
3a 00 32 00 37 00 2e 00 70 00 6e 00 67 00 0d 00 :.2.7...p.n.g...
00 00 00 00 00 00 90 94 49 1f 5e 00 00 80 d4 00 ......I.^....
File 72 has been orphaned since all its filenames were invalid
Windows will recover the file in the orphan recovery phase.
Correcting minor file name errors in file 72.
Index entry found.000 of index $I30 in file 0x5 points to unused file 0x11.
Deleting index entry found.000 in index $I30 of file 5.
Index entry found.001 of index $I30 in file 0x5 points to unused file 0x16.
Deleting index entry found.001 in index $I30 of file 5.
Index entry found.002 of index $I30 in file 0x5 points to unused file 0x15.
Deleting index entry found.002 in index $I30 of file 5.
Index entry DOWNLO~1 of index $I30 in file 0x28 points to unused file 0x2b6.
Deleting index entry DOWNLO~1 in index $I30 of file 40.
Unable to locate the file name attribute of index entry Screenshot from 2012-09-09 09:51:27.png
of index $I30 with parent 0x2e in file 0x48.
Deleting index entry Screenshot from 2012-09-09 09:51:27.png in index $I30 of file 46.
An index entry of index $I30 in file 0x32 points to file 0x151e8
which is beyond the MFT.
Deleting index entry latexsheet.tex in index $I30 of file 50.
An index entry of index $I30 in file 0x58bc points to file 0x151eb
which is beyond the MFT.
Deleting index entry D8CZ82PK in index $I30 of file 22716.
An index entry of index $I30 in file 0x58bc points to file 0x151f7
which is beyond the MFT.
Deleting index entry EGA4QEAX in index $I30 of file 22716.
An index entry of index $I30 in file 0x58bc points to file 0x151e9
which is beyond the MFT.
Deleting index entry NGTB469M in index $I30 of file 22716.
An index entry of index $I30 in file 0x58bc points to file 0x151fb
which is beyond the MFT.
Deleting index entry WU5RKXAB in index $I30 of file 22716.
Index entry comp220-lab3.synctex.gz of index $I30 in file 0xda69 points to unused file 0xd098.
Deleting index entry comp220-lab3.synctex.gz in index $I30 of file 55913.
Unable to locate the file name attribute of index entry comp220-numberGrammars.aux
of index $I30 with parent 0xda69 in file 0xa276.
Deleting index entry comp220-numberGrammars.aux in index $I30 of file 55913.
The file reference 0x500000000cd43 of index entry comp220-numberGrammars.out of index $I30
with parent 0xda69 is not the same as 0x600000000cd43.
Deleting index entry comp220-numberGrammars.out in index $I30 of file 55913.
The file reference 0x500000000cd45 of index entry comp220-numberGrammars.pdf of index $I30
with parent 0xda69 is not the same as 0xc00000000cd45.
Deleting index entry comp220-numberGrammars.pdf in index $I30 of file 55913.
An index entry of index $I30 in file 0xda69 points to file 0x15290
which is beyond the MFT.
Deleting index entry gram.aux in index $I30 of file 55913.
An index entry of index $I30 in file 0xda69 points to file 0x15291
which is beyond the MFT.
Deleting index entry gram.out in index $I30 of file 55913.
An index entry of index $I30 in file 0xda69 points to file 0x15292
which is beyond the MFT.
Deleting index entry gram.pdf in index $I30 of file 55913.
Unable to locate the file name attribute of index entry comp230-quiz1.synctex.gz
of index $I30 with parent 0xda6f in file 0xd183.
Deleting index entry comp230-quiz1.synctex.gz in index $I30 of file 55919.
An index entry of index $I30 in file 0xf3cc points to file 0x15283
which is beyond the MFT.
Deleting index entry require-transform.rkt in index $I30 of file 62412.
An index entry of index $I30 in file 0xf3cc points to file 0x15284
which is beyond the MFT.
Deleting index entry set.rkt in index $I30 of file 62412.
An index entry of index $I30 in file 0xf497 points to file 0x15280
which is beyond the MFT.
Deleting index entry logger.rkt in index $I30 of file 62615.
An index entry of index $I30 in file 0xf497 points to file 0x15281
which is beyond the MFT.
Deleting index entry misc.rkt in index $I30 of file 62615.
An index entry of index $I30 in file 0xf497 points to file 0x15282
which is beyond the MFT.
Deleting index entry more-scheme.rkt in index $I30 of file 62615.
An index entry of index $I30 in file 0xf5bf points to file 0x15285
which is beyond the MFT.
Deleting index entry core-layout.rkt in index $I30 of file 62911.
An index entry of index $I30 in file 0xf5e0 points to file 0x15286
which is beyond the MFT.
Deleting index entry ref.scrbl in index $I30 of file 62944.
An index entry of index $I30 in file 0xf6f0 points to file 0x15287
which is beyond the MFT.
Deleting index entry base-render.rkt in index $I30 of file 63216.
An index entry of index $I30 in file 0xf6f0 points to file 0x15288
which is beyond the MFT.
Deleting index entry html-properties.rkt in index $I30 of file 63216.
An index entry of index $I30 in file 0xf6f0 points to file 0x15289
which is beyond the MFT.
Deleting index entry html-render.rkt in index $I30 of file 63216.
An index entry of index $I30 in file 0xf6f0 points to file 0x1528b
which is beyond the MFT.
Deleting index entry latex-prefix.rkt in index $I30 of file 63216.
An index entry of index $I30 in file 0xf6f0 points to file 0x1528c
which is beyond the MFT.
Deleting index entry latex-render.rkt in index $I30 of file 63216.
An index entry of index $I30 in file 0xf6f0 points to file 0x1528e
which is beyond the MFT.
Deleting index entry scribble.tex in index $I30 of file 63216.
An index entry of index $I30 in file 0xf717 points to file 0x1528a
which is beyond the MFT.
Deleting index entry lang.rkt in index $I30 of file 63255.
An index entry of index $I30 in file 0xf721 points to file 0x1528d
which is beyond the MFT.
Deleting index entry lang.rkt in index $I30 of file 63265.
An index entry of index $I30 in file 0xf764 points to file 0x1528f
which is beyond the MFT.
Deleting index entry lang.rkt in index $I30 of file 63332.
An index entry of index $I30 in file 0x14261 points to file 0x15270
which is beyond the MFT.
Deleting index entry fddff3ae9ae2221207f144821d475c08ec3d05 in index $I30 of file 82529.
An index entry of index $I30 in file 0x14621 points to file 0x15268
which is beyond the MFT.
Deleting index entry FETCH_HEAD in index $I30 of file 83489.
An index entry of index $I30 in file 0x14650 points to file 0x15272
which is beyond the MFT.
Deleting index entry 86 in index $I30 of file 83536.
An index entry of index $I30 in file 0x14651 points to file 0x15266
which is beyond the MFT.
Deleting index entry pack-7f54ce9f8218d2cd8d6815b8c07461b50584027f.idx in index $I30 of file 83537.
An index entry of index $I30 in file 0x14651 points to file 0x15265
which is beyond the MFT.
Deleting index entry pack-7f54ce9f8218d2cd8d6815b8c07461b50584027f.pack in index $I30 of file 83537.
An index entry of index $I30 in file 0x146f1 points to file 0x15275
which is beyond the MFT.
Deleting index entry master in index $I30 of file 83697.
An index entry of index $I30 in file 0x146f6 points to file 0x15276
which is beyond the MFT.
Deleting index entry remotes in index $I30 of file 83702.
An index entry of index $I30 in file 0x1477d points to file 0x15278
which is beyond the MFT.
Deleting index entry pad.rkt in index $I30 of file 83837.
An index entry of index $I30 in file 0x14797 points to file 0x1527c
which is beyond the MFT.
Deleting index entry pad1.rkt in index $I30 of file 83863.
An index entry of index $I30 in file 0x14810 points to file 0x1527d
which is beyond the MFT.
Deleting index entry cm.rkt in index $I30 of file 83984.
An index entry of index $I30 in file 0x14926 points to file 0x1527e
which is beyond the MFT.
Deleting index entry multi-file-search.rkt in index $I30 of file 84262.
An index entry of index $I30 in file 0x149ef points to file 0x1527f
which is beyond the MFT.
Deleting index entry com.rkt in index $I30 of file 84463.
An index entry of index $I30 in file 0x14b47 points to file 0x15202
which is beyond the MFT.
Deleting index entry COMMIT_EDITMSG in index $I30 of file 84807.
An index entry of index $I30 in file 0x14b47 points to file 0x15279
which is beyond the MFT.
Deleting index entry index in index $I30 of file 84807.
An index entry of index $I30 in file 0x14b4c points to file 0x15274
which is beyond the MFT.
Deleting index entry master in index $I30 of file 84812.
An index entry of index $I30 in file 0x14b61 points to file 0x1520b
which is beyond the MFT.
Deleting index entry 02 in index $I30 of file 84833.
An index entry of index $I30 in file 0x14b61 points to file 0x1525a
which is beyond the MFT.
Deleting index entry 28 in index $I30 of file 84833.
An index entry of index $I30 in file 0x14b61 points to file 0x15208
which is beyond the MFT.
Deleting index entry 29 in index $I30 of file 84833.
An index entry of index $I30 in file 0x14b61 points to file 0x1521f
which is beyond the MFT.
Deleting index entry 2c in index $I30 of file 84833.
An index entry of index $I30 in file 0x14b61 points to file 0x15261
which is beyond the MFT.
Deleting index entry 2e in index $I30 of file 84833.
An index entry of index $I30 in file 0x14b61 points to file 0x151f0
which is beyond the MFT.
Deleting index entry 45 in index $I30 of file 84833.
An index entry of index $I30 in file 0x14b61 points to file 0x1523e
which is beyond the MFT.
Deleting index entry 47 in index $I30 of file 84833.
An index entry of index $I30 in file 0x14b61 points to file 0x151e5
which is beyond the MFT.
Deleting index entry 49 in index $I30 of file 84833.
An index entry of index $I30 in file 0x14b61 points to file 0x15214
which is beyond the MFT.
Deleting index entry 58 in index $I30 of file 84833.
Index entry 6e of index $I30 in file 0x14b61 points to unused file 0xd182.
Deleting index entry 6e in index $I30 of file 84833.
Unable to locate the file name attribute of index entry a0
of index $I30 with parent 0x14b61 in file 0xd29c.
Deleting index entry a0 in index $I30 of file 84833.
An index entry of index $I30 in file 0x14b61 points to file 0x1521b
which is beyond the MFT.
Deleting index entry cd in index $I30 of file 84833.
An index entry of index $I30 in file 0x14b61 points to file 0x15249
which is beyond the MFT.
Deleting index entry d6 in index $I30 of file 84833.
An index entry of index $I30 in file 0x14b61 points to file 0x15242
which is beyond the MFT.
Deleting index entry df in index $I30 of file 84833.
An index entry of index $I30 in file 0x14b61 points to file 0x15227
which is beyond the MFT.
Deleting index entry ea in index $I30 of file 84833.
An index entry of index $I30 in file 0x14b61 points to file 0x1522e
which is beyond the MFT.
Deleting index entry f3 in index $I30 of file 84833.
An index entry of index $I30 in file 0x14b61 points to file 0x151f2
which is beyond the MFT.
Deleting index entry ff in index $I30 of file 84833.
An index entry of index $I30 in file 0x14b62 points to file 0x15254
which is beyond the MFT.
Deleting index entry 1ed39b36ad4bd48c91d22cbafd7390f1ea38da in index $I30 of file 84834.
An index entry of index $I30 in file 0x14b75 points to file 0x15224
which is beyond the MFT.
Deleting index entry 96260247010fe9811fea773c08c5f3a314df3f in index $I30 of file 84853.
An index entry of index $I30 in file 0x14b79 points to file 0x15219
which is beyond the MFT.
Deleting index entry 8f689724ca23528dd4f4ab8b475ace6edcb8f5 in index $I30 of file 84857.
An index entry of index $I30 in file 0x14b7c points to file 0x15223
which is beyond the MFT.
Deleting index entry 1df17cf850656be42c947cba6295d29c248d94 in index $I30 of file 84860.
An index entry of index $I30 in file 0x14b7c points to file 0x15217
which is beyond the MFT.
Deleting index entry 31db8a3c72a3e44769bbd8db58d36f8298242c in index $I30 of file 84860.
An index entry of index $I30 in file 0x14b7c points to file 0x15267
which is beyond the MFT.
Deleting index entry 8e1254d755ff1882d61c07011272bac3612f57 in index $I30 of file 84860.
An index entry of index $I30 in file 0x14b82 points to file 0x15246
which is beyond the MFT.
Deleting index entry f959bfaf9643c1b9e78d5ecf8f669133efdbf3 in index $I30 of file 84866.
An index entry of index $I30 in file 0x14b88 points to file 0x151fe
which is beyond the MFT.
Deleting index entry 7e9aa15b1196b2c60116afa4ffa613397f2185 in index $I30 of file 84872.
An index entry of index $I30 in file 0x14b8a points to file 0x151ea
which is beyond the MFT.
Deleting index entry 73cb0cd248e494bb508f41b55d862e84cdd6e0 in index $I30 of file 84874.
An index entry of index $I30 in file 0x14b8e points to file 0x15264
which is beyond the MFT.
Deleting index entry bd555d9f0383cc14c317120149e9376a8094c4 in index $I30 of file 84878.
An index entry of index $I30 in file 0x14b96 points to file 0x15212
which is beyond the MFT.
Deleting index entry 630dba40562d991bc6cbb6fed4ba638542e9c5 in index $I30 of file 84886.
An index entry of index $I30 in file 0x14b99 points to file 0x151ec
which is beyond the MFT.
Deleting index entry 478be31ca8e538769246e22bba3330d81dc3c8 in index $I30 of file 84889.
An index entry of index $I30 in file 0x14b99 points to file 0x15258
which is beyond the MFT.
Deleting index entry 66c60c0a0f3253bc9a5112697e4cbb0dfc0c78 in index $I30 of file 84889.
An index entry of index $I30 in file 0x14b9c points to file 0x15238
which is beyond the MFT.
Deleting index entry 1c7ceeddc2953496f9ffbfc0b6fb28846e3fe3 in index $I30 of file 84892.
An index entry of index $I30 in file 0x14b9c points to file 0x15247
which is beyond the MFT.
Deleting index entry ae6e32ffc49d897d8f8aeced970a90d3653533 in index $I30 of file 84892.
An index entry of index $I30 in file 0x14ba0 points to file 0x15233
which is beyond the MFT.
Deleting index entry f71c7d874e45179a32e138b49bf007e5bbf514 in index $I30 of file 84896.
Index entry 2e04fefbd794f050d45e7a717d009e39204431 of index $I30 in file 0x14ba7 points to unused file 0xd097.
Deleting index entry 2e04fefbd794f050d45e7a717d009e39204431 in index $I30 of file 84903.
An index entry of index $I30 in file 0x14baa points to file 0x15241
which is beyond the MFT.
Deleting index entry 0dda7dec1c635cd646dfef308e403c2843d5dc in index $I30 of file 84906.
An index entry of index $I30 in file 0x14baa points to file 0x151fc
which is beyond the MFT.
Deleting index entry 98151e654dd546edcfdec630bc82d90619ac8e in index $I30 of file 84906.
An index entry of index $I30 in file 0x14bb1 points to file 0x151e9
which is beyond the MFT.
Deleting index entry 1997c5be62ffeebc99253cced7608415e38e4e in index $I30 of file 84913.
An index entry of index $I30 in file 0x14bb1 points to file 0x1521d
which is beyond the MFT.
Deleting index entry 6bf3aedefd3ac62d9c49cad72d05e8c0ad242c in index $I30 of file 84913.
An index entry of index $I30 in file 0x14bb1 points to file 0x151f4
which is beyond the MFT.
Deleting index entry 907b755afdca14c00be0010962d0861af29264 in index $I30 of file 84913.
An index entry of index $I30 in file 0x14bb3 points to file 0x15218
which is beyond the MFT.
Deleting index entry
Solution 1:
I fixed this problem by avoiding it and using a FAT32 partition as opposed to NTFS. I've had zero problems with FAT32. I don't know that this is necessarily an answer to a problem as much as its a work around, but if you find yourself in
Solution 2:
Ubuntu is not responsible for the ntfs drivers. Ntfs in linux has always been buggy for me - works for a little while, but corruption does eventually occur. Ntfs is not open source, and the implementation on linux is merely a best attempt at making it work. I now mount ntfs as read only, and if I need large file support for a shared drive between the two, I use exFAT. exFAT works flawlessly on both, and requires no extra setup on Ubuntu or Windows to use.