Debian – How to debug: tar: A lone zero block

corruptiondebiantar

How to debug this? This issue has suddenly appeared within the last couple of days. All backups of a website are corrupted.

If the backup is just left as tar, there are no problems, but as soon the tar is compressed as gz or xz I can't uncompress them.

There is a lot of free disk

Local disk space    2.68 TB total / 2.26 TB free / 432.46 GB used

error

tar: Skipping to next header[===============================>                                                    ] 39% ETA 0:01:14
tar: A lone zero block at 2291466===============================>                                                ] 44% ETA 0:01:13
tar: Exiting with failure status due to previous errors
 878MiB 0:00:58 [15.1MiB/s] [===================================>                                                ] 44%

And why does it say Skipping to next header? It has never done that before. Something is terribly wrong the some of the files.

There are about 15k pdf, jpg or png files in the directories.

command

pv $backup_file | tar -izxf - -C $import_dir

There must be some data that corrupts the compression.

I have also tried to check the HDD health by doing this:

# getting the drives
lsblk -dpno name

smartctl -H /dev/sda
smartctl -H /dev/sdb

On both drives I get this:

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

How can I find out which files that are corrupting the tar.gz? I just want to delete them.

update

Have now copied all files to another server and I have the exact same issue. I can tar everything and extract it without problems, but as soon I want to compress the files, I can't uncompress them (gz/xz).

Best Answer

Your file is either truncated or corrupted, so xz can't get to the end of the data. tar complains because the archive stops in the middle, which is logical since xz didn't manage to read the whole data.

Run the following commands to check where the problem is:

cat /var/www/bak/db/2017-05-20-1200_mysql.tar.xz >/dev/null
xzcat /var/www/bak/db/2017-05-20-1200_mysql.tar.xz >/dev/null

If cat complains then the file is corrupted on the disk and the operating system detected the corruption. Check the kernel logs for more information; usually the disk needs to be replaced at this point. If only xz complains then the OS didn't detect any corruption but the file is nevertheless not valid (either corrupted or truncated). Either way, you aren't going to be able to recover this file. You'll need to get it back from your offline backups.

Related Question