Mobile ITnT Solutions
4910455-3175009525078105mobile itnTSolutions, LLC.00mobile itnTSolutions, LLC.4572002857500Linux Systems AdministratorProgramClass Notes:“Creating Backups”Part I00Linux Systems AdministratorProgramClass Notes:“Creating Backups”Part ICreating Backups – Part IArchiving Tools:Linux offers many native tools that can be utilized to archive files for storage or distribution:These tools include: “tar” and “star”, both of which have the ability to preserve general file attributes, such as ownership, group membership, and timestamp.Occasionally, you might want to make a backup of important files on your computer:The "tar" (tape archive) command creates, appends, updates, lists, and extracts files to and from a single file, which is called a “tar” file (also a tarball) (Ref: RH Linux 7 Book-pg40)This command has the ability to archive SELinux file contexts as well as any extended attributes set on filesCan also be instructed to compress an archive while it’s being accessed“tar” options: (RH Linux – pg40)--- -c [creates a tarball]--- -f [specifies a tarball name] --- -j [compresses a tarball with bzip2 command] --- -r [appends files to the end of an existing tarball. Does not append to compressed tarballs] --- -t [Lists contents of a tarball] --- -u [appends files to the end of an existing tarball if the specified files are newer. Does not append to compressed tarballs] --- -v [verbose mode] --- -x [Extracts from a tarball] --- -z [compresses a tarball with gzip command] --- Verbose mode is an option available in many computer operating systems, including Microsoft Windows, Mac OS and Linux that provides additional details as to what the computer is doing and what drivers and software it is loading during startup."tar" utility gets its name from "Tape Archive"... This tool will receive and send files to a destination(typically a tape or a regular file)..."tar" command has many arguments:3 Major tasks are involved in using "tar":1. Creating an archive2. Verifying the contents of an archive3. Extracting an archiveNote: The archive can be written to multiple destinations, but the most common procedure is to write it to a file.While using "tar", use the "f" option to name/create the tarfileThe "c" option is used to create a tar archiveThe "v" option is "Verbose" mode:Verbose mode is an option available in many computer operating systems, including Microsoft Windows, Mac OS and Linux that provides additional details as to what the computer is doing and what drivers and software it is loading during startup. This level of detail can be very helpful for troubleshooting problems with hardware or software, if errors are occurring during startup or after the operating system has loaded.For example: To create an archive of all configuration files in the "/etc" directory, use command: tar cvf /tmp/etc.tar /etcORtar cf /backup/etc.tar /etcls -l /backup/etc.tarNote: options are not proceeded by a -(minus) in this command (which is common behavior in tar)The order of the options is specific. . ."tar fvc" wouldn't worknotice that you specify the location where to write the archive before specifying what to put into the archiveNext, once you have created an archive file using the tar command, you can verify it's content (list contents of a tar file)..... How?By using the "t" option... "c"(create) option is replaced...--- so, tar tvf /tmp/etc.tar yields the content of the previously created archiveFinally, the 3rd task to accomplish with "tar" is the extraction of an archive... in this process, you get the files out of the archive and write them to the file system of your computer: Example: extract to another directory:tar xvf /tmp/etc.tar -C ~/tmp/etc_bkup/Compression: (65.2 - LinuxAdmin, pg: 677)It can be beneficial to compress files before backup2 most popular tools for compression of regular files on Linux are:gzip/gunzip (generally much faster)bzip2/bunzip2 (compresses a lot better)compression can be achieved without pipes since tar uses the "z" flag to compress with gzip, and the "j" flag to compress with bzip2tar czf /backup/etc.tar.gz /etc (gzip example)tar cjf /backup/etc.tar.bz2 /etc (bzip2 example)to see results: ls -l /backup/etc.ta* Other Examples:To list a specific file in a tar archive:tar tvf /backup/etc.tar etc/resolv.conf To preserve file permissions, use the "p" flag:Example: tar cpzf /backup/etc_with_perms.tgz /etc To exclude directories or files, use "exclude" within command:-- Example: tar cpzf /backup/etc_no_sysconf.tgz /etc --exclude='syscon*'"tar" can be used to copy a directory (more efficient than using "cp -r") Example: (cd /etc; tar -cf - .) | (cd /backup/copy_of_etc/ ; tar -xpf - )"tar" used to copy a directory securely over the network:Example: (cd /etc;tar -cf - . )|(ssh user@srv 'cd /backup/cp_of_etc/; tar -xf - ')Compress the tar backup when it is on the network, but leave it uncompressed at the destination:Example: cat backup.tar | gzip | ssh user@192.168.1.105 "gunzip|cat -> backup.tar"To create a tarball called /tmp/home.tar of the entire /home directory tree: tar cvf /tmp/home.tar /homeTo create a tarball called /tmp/files.tar containing multiple files from the /etc directory: tar cvf /tmp/files.tar /etc/host.conf /etc/shadow /etc/passwd /etc/yum.confTo append files located in the /etc/yum.repos.d directory to home.tar: tar rvf/tmp/home.tar /etc/yum.repos.dTo list the contents of home.tar: tar tvf /tmp/home.tarTo list the contents of files.tar: tar tvf /tmp/files.tar ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- medical marijuana solutions state colleg
- medical marijuana solutions state college pa
- syneos health commercial solutions jobs
- syneos health commercial solutions locations
- come up with solutions synonym
- crm solutions providers
- onemain solutions disability form pdf
- advantage solutions training
- tmp advantage solutions training
- medical marijuana solutions pittsburgh
- one main solutions disability
- one main solutions find a form