CentOS 9.x tar

From Notes_Wiki
Revision as of 08:48, 22 May 2022 by Saurabh (talk | contribs) (Created page with "Home > CentOS > CentOS 9.x > CentOS 9.x Command line tools and utilities > CentOS 9.x tar =Resume a tar.gz command that was killed= Support a file is being created using: <pre> tar czf backup.tar.gz /mnt/backup </pre> But the process is killed in between. Now instead of re-compressing all the files which are part of backup.tar.gz already, it is possible to create another .tar.gz file with remaining data. To do that use: <pre> cd ~ tar ztf...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Home > CentOS > CentOS 9.x > CentOS 9.x Command line tools and utilities > CentOS 9.x tar

Resume a tar.gz command that was killed

Support a file is being created using:

tar czf backup.tar.gz /mnt/backup

But the process is killed in between. Now instead of re-compressing all the files which are part of backup.tar.gz already, it is possible to create another .tar.gz file with remaining data. To do that use:

cd ~
tar ztf backup.tar.gz | sed -e '/\/$/d' -e x -e '/^$/d' >files-done
tar czfX backup2.tar.gz files-done /mnt/backup

The first tar command might show error about unexpected end or corrupted tar file. We can ignore that. The last file in the first tar is most likely not stored properly. The above steps ensure that the last file is again stored in the new tar file. Thus, ensuring all files are backed up properly.

Refer:




Home > CentOS > CentOS 9.x > CentOS 9.x Command line tools and utilities > CentOS 9.x tar