Wondering how to fix Files out of time_t range for tar? We can help you.
Often customers report to us that the backup failed with a tar function error.
Here at Bobcares, we handle requests from our customers to fix similar errors as a part of our Server Management Services.
Today we will see how our Support Engineers fix this for our customers.
How to fix Files out of time_t range for tar
A typical error looks like the one given below:
Running: tar -C /mnt/onapp-backup-t54asdf345 --one-file-system -zcp -f /onapp/backups/t/b/t54asdf345 --numeric-owner --xattrs . tar: value -9999 out of time_t range 0..8589934591
Now we will see the steps that our Support Engineers follow to fix this error.
Steps to fix
To fix this, we need to change the latest modified date on the file to be within a legitimate range for tar to work properly.
This can be done by running fsck on the disk. However, at times, this may not resolve this issue. In such cases, we can do the following steps to fix this issue:
The find command helps us to search for files with specific modified dates.
For example, if we wish to find out a file that was modified over 15000 days ago, we can use the following command:
find / -mtime +15000
The oldest file will be on Jan 1, 1970.
If anything older than that is found, we need to fix it.
We can run the touch command on them to change the latest access/modify dates.
There are two ways to do this.
We can either find the files and run touch on them manually like given below:
touch /etc/fstab
Or, we can combine the two commands and use the find command’s exec flag as given below:
find / -mtime +$(( `date -u +%s` / 86400 - 1 )) -exec touch {} +
With this, we can find all the files older than Linux Epoch Time, and then run touch on them.
Here, Find replaces {} with the files it’s finding, and the + denotes the end of the exec command.
At times some files have timestamp set too far in the future.
The format of the time_t value used by tar is 32 bit, and it cannot encode the time after 03:14:07 UTC on 19 January 2038.
The following command will find and touch any files from the future:
find / -newermt "1 day" -exec touch {} +
[Need assistance? We can help you]
Conclusion
To conclude, we saw the steps that our Support Techs follow to fix this error for our customers.
0 Comments