tar backup restore

identify and mount directories/devices for backup sources and targets, i.e.
-- backup, which directory
-- backup, to which file, located where

tar - tape archiver

$ tar --help
$ man tar

some useful options
-c, --create
create a new archive

-t, --list
list the contents of an archive

-x, --extract, --get
extract files from an archive

-a, --auto-compress
use archive suffix to determine the compression program

-f, --file=ARCHIVE
use  archive file or device ARCHIVE

always use numbers for user/group names

Force NAME as owner for added files.

stay in local file system when creating archive

-p, --preserve-permissions, --same-permissions
extract information about file permissions (default for superuser)

show tar defaults

-v, --verbose
verbosely list files processed

enable extended attributes support

descend into directory, and tar current directory avoiding absolute pathname risks

$ cd {backup-directory}
$ sudo tar --one-file-system --numeric-owner --xattrs -cvapf /mnt/backup/{backup-filename}.tar.xz .

descend into target directory, and untar

$ sudo tar --one-file-system --numeric-owner --xattrs -xvapf /mnt/backup/{backup-filename}.tar.xz

combine tar with netcat to backup/restore across the network. apparently, it is more efficient as the same system does not need to read & write at the same time.

No comments:

Post a Comment

most popular posts