Performance Checklist
In this lab, you will use tar, rsync, and scp to archive and back up the contents of directories.
Outcomes
You should be able to:
Synchronize a remote directory to a local directory.
Create an archive of the contents of a synchronized directory.
Securely copy an archive to a remote host.
Extract an archive.
Log in as the student user on workstation using student as the password.
From workstation, run the lab archive-review start command.
The command runs a start script that determines whether hosts servera and serverb are reachable on the network.
The script also ensures that the files and directories to be created in the lab do not exist on serverb, and workstation.
[student@workstation ~]$lab archive-review start
On serverb, synchronize the /etc directory tree from servera to the /configsync directory.
Use the ssh command to log in to serverb as the student user.
[student@workstation ~]$ssh student@serverb...output omitted...[student@serverb ~]$
Use the su command to switch to the root user because creating the /configsync directory requires superuser privileges.
In later steps, you will archive the files present in the /etc directory tree, which are owned by the root user this also requires superuser privileges.
[student@serverb ~]$su -Password:redhat[root@serverb ~]#
Create the /configsync directory to store the synchronized configuration files from servera.
[root@serverb ~]#mkdir /configsync
Use the rsync command to synchronize the /etc directory tree from servera to the /configsync directory on serverb.
Be aware that only the root user can read all the content in the /etc directory on servera.
[root@serverb ~]#rsync -av root@servera:/etc /configsyncroot@servera's password:redhatreceiving incremental file list etc/ etc/.pwd.lock ...output omitted... etc/yum/protected.d -> ../dnf/protected.d etc/yum/vars -> ../dnf/vars sent 10,958 bytes received 21,665,987 bytes 3,334,914.62 bytes/sec total size is 21,615,767 speedup is 1.00
Use gzip compression to create an archive named configfile-backup-servera.tar.gz with the contents of the /configsync directory.
Use the tar command with the -czf options to create a gzip compressed archive.
[root@serverb ~]#tar -czf configfile-backup-servera.tar.gz /configsynctar: Removing leading `/' from member names[root@serverb ~]#
Use the tar command with the -tzf options to list the contents of the configfile-backup-servera.tar.gz archive.
[root@serverb ~]#tar -tzf configfile-backup-servera.tar.gz...output omitted... configsync/etc/vimrc configsync/etc/wgetrc configsync/etc/xattr.conf
Securely copy the /root/configfile-backup-servera.tar.gz archive file from serverb to the /home/student directory on workstation as the student user using student as the password.
On workstation, extract the contents of the /home/student/configfile-backup-servera.tar.gz archive to the /tmp/savedconfig/ directory.
Exit from serverb.
[root@serverb ~]#exitlogout[student@serverb ~]$exitlogout Connection to serverb closed.[student@workstation]$
Create the /tmp/savedconfig directory, where the contents of the /home/student/configfile-backup-servera.tar.gz archive will be extracted.
[student@workstation ~]$mkdir /tmp/savedconfig
Change to the /tmp/savedconfig directory.
[student@workstation ~]$cd /tmp/savedconfig[student@workstation savedconfig]$
Use the tar command with the -tzf options to list the contents of the configfile-backup-servera.tar.gz archive
[student@workstation savedconfig]$tar -tzf ~/configfile-backup-servera.tar.gz...output omitted... configsync/etc/vimrc configsync/etc/wgetrc configsync/etc/xattr.conf
Use the tar command with the -xzf options to extract the contents of the /home/student/configfile-backup-servera.tar.gz archive to the /tmp/savedconfig/ directory.
[student@workstation savedconfig]$tar -xzf ~/configfile-backup-servera.tar.gz[student@workstation savedconfig]$
List the directory tree to verify that the directory contains files from the /etc directory.
[student@workstation savedconfig]$ls -lR.: total 0 drwxr-xr-x. 3 student student 17 Feb 13 10:13 configsync ./configsync: total 12 drwxr-xr-x. 95 student student 8192 Feb 13 09:41 etc ./configsync/etc: total 1212 -rw-r--r--. 1 student student 16 Jan 16 23:41 adjtime -rw-r--r--. 1 student student 1518 Sep 10 17:21 aliases drwxr-xr-x. 2 student student 169 Feb 4 21:58 alternatives ...output omitted...
On workstation return to the student home directory.
[student@workstation savedconfig]$cd
This concludes the lab.