0

I am using the zip -FS command to sync a directory with a zip archive. While it works quite well in general, I have noticed, that this doesn't update changes in file permission or owner.

Is there a way to achieve this? Or is there another archiving / packaging tool that can do it? Don't need compression, just a way to regularly sync many small files into a single big file.

  • Actually I came across that before, but couldn't see any archiver fulfilling the requirements. tar doesn't seem to support complete filesync and squashfs seems to be read-only and more focused on strong compression? – Sleet2004 Mar 26 '23 at 22:06
  • What do you mean with "full filesync"? Also, compression in squashfs is completely configurable. You can turn it off or set it to a level where compression is faster that you can read data from storage. And just like tar and zip, changes to the archive are simply appended to the squash image. – Marcus Müller Mar 26 '23 at 22:16
  • Basically I want to periodically sync changes in a directory to the archive. i.e. add new files and remove deleted files. zip can do that with the FS option – Sleet2004 Mar 26 '23 at 22:18
  • So can tar and mksquashfs – Marcus Müller Mar 26 '23 at 22:22
  • which is the option for tar? I have seen -u, but this only adds and does not delete files – Sleet2004 Mar 26 '23 at 22:32
  • Ah deletion is actually hard, indeed. You're right in that respect - there's no command flag for that. But honestly, all that zip does with -FS is to copy over the files that have neither been deleted nor changed from the old archive, and add the changed and new ones. Now, copying contents of an archive isn't inherently faster than copying contents of a file system, especially if your backup medium is slower at reading than the medium getting backed up. But you're right, this is less comfortable. Is there anything wrong with just backing up the files to a proper directory? – Marcus Müller Mar 26 '23 at 22:37
  • ok, I see, thought it is more efficient than that. Actually my end goal is to back up a big amount of small files to a cloud storage and this causes performance issues. So my idea was to create intermediate archives into which I sync batches of small files and then sync the archives to the cloud. But I am realizing now, that this will probably fail also for other reasons. Need to think of a different solution. – Sleet2004 Mar 26 '23 at 22:42
  • 1
    It is indeed more efficient, because it doesn't recompress files (although if you used tar piped into zstd -2, that would probably be faster than you can read data anyways), and mostly, because the compressed data is nice and linear on disk - no wild jumping around between sectors to read different files, no multiple context switches to stat, open and read each file. But whether it is worth it - debatable! – Marcus Müller Mar 26 '23 at 22:48

0 Answers0