---
title: "Validate backup files with absctl restore"
description: "Validate Aerospike backup files for corruption using absctl restore with the --validate flag."
---

# Validate backup files with absctl restore

> For the complete documentation index see: [llms.txt](https://aerospike.com/docs/llms.txt)
> 
> All documentation pages available in markdown.

When you run `absctl restore` with `--validate`, it reads and decodes backup files end-to-end and fails if it encounters invalid or corrupted content.

Validate mode works with `--directory`, `--input-file`, and `--directory-list` to specify backup sources. It ignores data selection and Aerospike connection options because it does not connect to the database. To validate backups in an Amazon S3 bucket, you must still connect to S3.

::: note
Validate mode cannot detect all corrupted data. The tool only identifies issues that cause errors while parsing the backup files. For more information, see [Backup File Format](https://github.com/aerospike/aerospike-tools-backup#backup-file-format).
:::

## Example

The following example illustrates the process to create a backup file and validate it.

### Create a test backup

Back up a single record to a directory:

Terminal window

```shell
absctl backup --host 127.0.0.1 --port 3000 --namespace test --directory test-backup-dir
```

Inspect the backup file:

Terminal window

```shell
cat test-backup-dir/test_00000.asb
```

Backup file content

```text
Version 3.1

# namespace test

# first-file

+ k S 4 key1

+ n test

+ d 7JEZLUt/jONdXXjTS8ply6qqyWA=

+ s demo

+ g 1

+ t 430086781

+ b 3

- I foo 123

- S bar 3 abc

- Z baz T
```

### Corrupt the backup file

Create corruption in the backup file:

Terminal window

```shell
sed -i '' -e 's/S/2/g' ./test-backup-dir/test_00000.asb
```

Verify the corruption:

Terminal window

```shell
cat test-backup-dir/test_00000.asb
```

Corrupted backup file content

```text
Version 3.1

# namespace test

# first-file

+ k 2 4 key1

+ n test

+ d 7JEZLUt/jONdXXjT28ply6qqyWA=

+ s demo

+ g 1

+ t 430086781

+ b 3

- I foo 123

- 2 bar 3 abc

- Z baz T
```

### Validate the backup directory

Run `absctl restore` in validate mode:

Terminal window

```shell
absctl restore --validate -d test-backup-dir
```

Validate mode output

```text
validation failed: failed to perform asb validation: failed to read data: error while reading asb data: 0_test_3.asb line 24 col 4 (total byte 5756): error while reading section: records: invalid character, read t, expected
```