How to extract and repack a user tar.gz backup manually to repair it's contents


Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"


Top Level » DirectAdmin » Backup & Restore Process

How to extract and repack a user tar.gz backup manually to repair it's contentsLast Modified: May 5, 2018, 7:56 pm
If a tar.gz is not 100% correct, you may need to extract it and re-compress it in order for DA to read it correctly.  IE: Any errors with "tar" will abort the restore process.  By re-packing it, you will remove the errors by removing any of the erroneous areas of the file.  Note that this may result in the loss of the corrupted data, but will at least help to restore the account.

It's always best to try and re-create the tar.gz file from the source, instead of repairing a broken file.  This is to give you the highest chance of restoring all data correctly.  Only use this guide as a last resort if the original data does not exist anymore, or can no longer be accessed.

Assumptions
- backup file:
- backup path: /user.admin.bob.tar.gz

1) Extract the tar.gz:

cd /home/admin/admin_backups
cp user.admin.bob.tar.gz user.admin.bob.tar.gz.backup
mkdir temp
cd temp
tar xvzf ../user.admin.bob.tar.gz


2) At this point, the backup is extracted, and you can do whatever you need to.  Modify files, add/remove parts, etc..

3) Now that the data is as desired, re-compress it. Make sure you made a backup of the tar.gz in step 1, with the cp command.  To re-compress:

cd /home/admin/admin_backups/temp
tar cvzf ../user.admin.bob.tar.gz *


© 2018 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST