LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Partial TDMS file corruption

Solved!
Go to solution

I had a problem with a data logger, in which the CompactRIO ran out of space while it was logging using TDMS. The tdms file was still there, but I think something happened to it. When I open the TDMS file, it actually opens and reads fine in Excel, but only with the associated *.tdms_index file. Without the .tdms_index, it does not automatically generate a new one when opened. Instead, I get this error:

 

USI encountered an exception: TDS Exception in Initialize: Tds Error: TdsErrNotTdsFile(-2503)

USI encountered an exception: (208): Error while reading model <filename readonly='yes'>(C:\filename.tdms)</filename> (TDMS), code: 80

 

In addition, I can't read it using the TDMS File Viewer in labview, and I get the same -2503 error.

 

Is there a way to fix the file so that it can autogenerate the tdms_index file correctly? Or is the best way is to copy and paste the readable TDMS file into another xlsx file, because I would rather have it retain the TDMS type.

 

Best Regards,

Linus

0 Kudos
Message 1 of 5
(5,482 Views)
Solution
Accepted by topic author ilnus

There are several topics on this on the forums.  The one that might work the best is the one posted here.

 

https://forums.ni.com/t5/DIAdem/Retreive-data-from-corrupt-TDMS-files/m-p/1551592#M13327

 

It basically gets rid of the last written segment in a TDMS file.  If your corruption is at the end this might just recover all of your other data.

 

If that doesn't work for you there is a longer thread here:

 

https://forums.ni.com/t5/LabVIEW/Corrupted-TDMS-File/td-p/2165954

 

Which talks about breaking up a TDMS file into N TDMS files where each file is a segment in the original file.  This can help if the corruption is in the middle of the file.

Message 2 of 5
(5,464 Views)
Solution
Accepted by topic author ilnus

See here the format of the TDMS file. Perhaps as a result of insufficient memory declaration the last structure was not written down completely. The idea is to crop the file so that the last record is correct.

 

Labview 4.0, 5.0, 6.1, 8.6, 2009, 2011, 2012, 2014
If you do not know something, ask me.
Message 3 of 5
(5,458 Views)

Hi Hooovahh,

 

The RecoveryTDMSFile.vi didn't work for me. However, the second link gave me the idea of using the hex editor to edit the TDMS file. I wan't keen on using a hex editor because I had no idea what to look for. But then Borjomy's post on the TDMS file format helped a lot. Since the TDMS file has repeated patterns of collected data for each time period, I have to remove the last section of bad data right after the last good section. Each data section starts right after the hex character BF, and begins with 54 44 53 6D 0E. After I removed the bad section, the TDMS file worked!

 

Thanks,

Linus

0 Kudos
Message 4 of 5
(5,430 Views)

Hi, i had the same problem:  Tds Error: TdsErrNotTdsFile(-2503)
Please check your VI, in my case labview was creating a .lvm file but with the extension tdms. After I changed the program giving it the correct type of file tdms, I could read the file.   

0 Kudos
Message 5 of 5
(4,197 Views)