Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create archives on Linux which support replacing/deleting files?

If one has a compressed archive with thousands files in it, what is the optimal way to delete/replace files in it from a shell script?

tar does not support replacing files in archive, and "decompress and compress again" way for replacing a single file in a large archive doesn't seem an optimal way.

xz as it seems doesn't support this option either.

7z is also not suitable for this task (man page for 7z doesn't recommend to use it for compressing individual files, only for compressing tar files, due to issues with preserving file owner/group info).

pax also doesn't have options for deleting/replacing files in archive.

Is there a common way on Linux for creating such archives from command line?

like image 926
Al Berger Avatar asked Nov 01 '22 21:11

Al Berger


1 Answers

I think you should seriously consider using ZFS or any other advanced file system. This will allow you to

  • create incremental backups (via snapshots)
  • modify files within backups
  • manage everything via command line (cronjobs etc.)
  • use compression
  • move backups across devices
  • use different RAID levels if you need more security

ZFS runs perfectly under Solaris, but there is already a stable port for Linux.

like image 195
Pavel Avatar answered Nov 15 '22 06:11

Pavel