简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM