-- backup, which directory
-- backup, to which file, located where
tar - tape archiver
http://gnu.org/software/tar/manual
$ tar --helpsome 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 --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 --ignore-failed-read Do not exit with nonzero on unreadable files. -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 --ignore-failed-read --one-file-system --numeric-owner --xattrs -capf /mnt/backup/{backup-filename}.tar.xz .
restore
descend into target directory, and un
tar
$ 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