Help us improve by taking our short survey: https://www.hdfgroup.org/website-survey/

| HDF5 Last Updated on 2026-03-23 The HDF5 Field Guide

Loading...
Searching...
No Matches
The HDF5 h5clear Tool

Navigate back: Main / HDF5 User Guide / Command Line Tools for HDF5 Files

# h5clear

## Introduction

With h5clear, you can clear the superblock status flag field, remove the metadata cache image, print the EOA and EOF, or set the EOA of a file. It is not a general repair tool and should not be used to fix file corruption. If a process doesn't shut down cleanly, the superblock mark can be left that prevents opening a file without SWMR. Then, h5clear can be used to remove this superblock mark so that the file can be inspected and appropriate actions can be taken.

## Usage

#### h5clear [OPTIONS] file_name

## Error Report Option

- –enable-error-stack Prints messages from the HDF5 error stack as they occur. Optional value 2 also prints file open errors, –enable-error-stack=2.

## Options

- –help Print a usage message and exit
- –version Print the library version number and exit
- –status Clear the status_flags field in the file's superblock
- –image Remove the metadata cache image from the file
- –filesize Print the file's EOA and EOF
- –increment=C Set the file's EOA to the maximum of (EOA, EOF) + C for the file <file_name>. C is >= 0; C is optional and will default to 1M when not set. This option helps to repair a crashed SWMR file when the stored EOA in the superblock is different from the actual EOF. The file's EOA and EOF will be the same after applying this option to the file.

## Usage Examples

- 1) h5clear -s file_name

       Clear the status_flags field in the superblock of the HDF5 file <file_name>.

- 2) h5clear -m file_name

       Remove the metadata cache image from the HDF5 file <file_name>.

- 3) h5clear –increment file_name

       Set the EOA to the maximum of (EOA, EOF) + 1M for the file <file_name>.

- 4) h5clear –increment=512 file_name

       Set the EOA to the maximum of (EOA, EOF) + 512 for the file\<file_name>.

Previous Chapter h5stat - Next Chapter h5debug

Navigate back: Main / HDF5 User Guide / Command Line Tools for HDF5 Files