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
some useful options
$ man tar
-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

Do not exit with nonzero on unreadable files.

-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 --ignore-failed-read --one-file-system --numeric-owner --xattrs -capf /mnt/backup/{backup-filename}.tar.xz .

descend into target directory, and untar
$ cd {target-directory}
$ sudo tar --one-file-system --numeric-owner --xattrs -xapf /mnt/backup/{backup-filename}.tar.xz

combine tar with netcat to backup/restore across the network, significantly more efficient as the same system is not reading/writing at the same time, unless you are on a slow network.

No comments:

Post a Comment

most viewed