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
http://gnu.org/software/tar/manual

$ 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

--numeric-owner
always use numbers for user/group names

--owner=NAME
Force NAME as owner for added files.

--one-file-system 
stay in local file system when creating archive

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

--show-defaults
show tar defaults

-v, --verbose
verbosely list files processed

--xattrs
enable extended attributes support

backup
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 .

restore
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