Hi Richard,

> I have a question. Yesterday my HDF5 file got corrupted due to disk-space
> shortage.
> ...
> Thus I would like to catch the
> errors returned by the HDF5 library and then close all resources leaving the
> HDF5 file in a proper state. Is that possible, or is the file lost after a
> failed write action?

While it can be dramatically less space efficient, I tend to write
entirely new HDF5 files, close them, flush to disk, and then rename(3)
to (more-or-less) atomically overwrite the old file.  This works
regardless of the underlying HDF5 driver.  All one needs is the
guarantee that the driver really flushes when asked to flushed.  As
always, it leaves one at the mercy of the OS.

My use case is maintaining the last N simulation restart files where I
never want to clobber any old ones before I know the most recent has
been successfully written.  The approach may not be useful when you
want to add data to a large, pre-existing file as it would require a
large file copy.

- Rhys

_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Reply via email to