Backups
Archive system files to a file
When creating full system backup it is better to use bsdtar than tar. tar with --xattrs will not preserve extended properties.
Boot from live USB.
Mount source and destination file systems:
fdisk -l mkdir root sudo mount </dev/nvme0n1p5> root mkdir backup sudo mount </dev/sda4> backupCD to source file system:
cd rootCreate backup (starting from current folder):
sudo bsdtar --acls --xattrs -czpvf ../backup/<archive_name>.tar.gz .Restore backup (to current folder):
sudo bsdtar --acls --xattrs -xzpvf ../backup/<archive_name>.tar.gz
Archive user files
To archive user files and folders on Linux (tar stores owner/group of the file):
tar -cf archive.tar -C <directory> .
or
tar -cf archive.tar <directory>
where -C <path> (change folder) can be used to not store full path names when whole mount point from some other place, for example:
tar -cf 2021-08-18_listingi.tar -C /media/truecrypt1 .
Compress archive with password
Compression:
7z a -p -mhe=on archive.tar.7z archive.tar
and -mhe=on is for enabling header encryption (cannot list file names).
Decompression:
7z x archive.tar.7z