I hope all is well.
I have developed a test program in C# to simulate the corruption of a file if a fatal error occurs before closing all open HDF5 files, groups etc.
In order to execute this test, perform the following steps:
Download HDF5_Simple_Writer.zip (3.5 MB) and unzip the folder.
Run the C# solution, restore the nuget packages (
PInvoke library), and rebuild the solution.
Read through the solution if needed but note: The boolean
crash on line 22 determines whether you would like to run a normal execution (
false) or if you want to simulate a fatal crash (
First set the boolean
false to execute the process as normal. An HDF5 file entitled TestFile.h5 should have been created in the same directory as the solution. Open the file to see the test data set written to a test group within the file.
Thereafter, set the boolean
true to simulate a fatal crash (power loss to the machine). Set a break point on line 101 (
Console.WriteLine();). Start the program and when this break point is hit, simply stop the program.
You should then see the following error when trying to open the file:
The fatal crashing of the program we are developing is something we are trying to safeguard against. If the HDF5 file is corrupted by such a crash what are the procedures we can put in place (apart from using a UPS on the machine) to ensure that this file corruption does not happen?
If this corruption is unavoidable, what measures can be taken to retrieve data within the corrupted file?