Skip Navigation
datahoarder @lemmy.ml
jmshrv @lemmy.world

Alternatives to tar for archiving Linux system?

Whenever I wipe my PC, I use tar to make an archive of the whole system. This works, but having to decompress the whole archive to pull files out is very annoying. Is there another archive format that:

  • Preserves permissions (i.e., is Unix-y)
  • Supports strong compression (I use either zstd or xz depending on how long I can be bothered to wait)
  • Supports pulling out individual files quickly
13 comments
  • You don't need to extract the whole thing if you use tar. The reason you have to here is because you use zstd/xz on top of it.

    Use tar as is. It's what it's made for.

  • At least on the Mac (bsdtar) you can extract single files out of a tar file.

    E.g.,

    Create the tar file:

    tar cvzf pseudo.tgz pseudo/

    Move to another directory

    cd /tmp/tt

    Extract a single file:

    tar -xf ../pseudo.tgz pseudo/10481_2017.1069.png

    You say PC, so might want to check the tar version you are using and see if there are extra parameters to do the file extraction.

  • fsarchiver is very nice. Not fast on pulling out files, but, I mean, it's infinitely faster than tar.

    Only quit using it so much because zfs-send is the real big hammer.

    Best part is it can regenerate partitions, or whatever, or you can restore a larger partition to a smaller one, all the cool permutations assuming the files actually fit. Can re-write users and permissions if you like, all the bells.

    https://www.fsarchiver.org/

     undefined
            Support for basic file attributes (permissions, ownership, …)
        Support for basic file-system attributes (label, uuid, block-size) for all linux file-systems
        Support for multiple file-systems per archive
        Support for extended file attributes (they are used by SELinux)
        Support for all major Linux filesystems (extfs, xfs, btrfs, reiserfs, etc)
        Support for FAT filesystems (in order to backup/restore EFI System Partitions)
        Experimental support for cloning ntfs filesystems
        Checksumming of everything which is written in the archive (headers, data blocks, whole files)
        Ability to restore an archive which is corrupt (it will just skip the current file)
        Multi-threaded lzo, gzip, bzip2, lzma/xz compression: if you have a dual-core / quad-core it will use all the power of your cpu
        Lzma/xz compression (slow but very efficient algorithm) to make your archive smaller.
        Support for splitting large archives into several files with a fixed maximum size
        Encryption of the archive using a password. Based on blowfish from libgcrypt.
    
    
      

    Oh, also you can always copy it over to an iso image and mount it, or a qcow or raw image of some kind for loop mount.

    Hey, didn't know about this: https://www.linux.com/news/mounting-archives-fuse-and-archivemount/

  • When I wipe my PC I always use Clonezilla. I have a separate /home partition and I usually copy /etc inside my user's home directory just before the cloning. I'd say you should give it a try.

13 comments