Performing Backups and Restores on a Linux Host

30 minutes
  • 4 Learning Objectives

About this Hands-on Lab

The Linux command line provides several utilities for creating and restoring backups. The `tar` command can be used to create compressed archives of files and directories. The `dd` command can be used to copy and restore drives and partitions, and to create image files of drives and partitions that can be used for backups. Both archives and image files, as well as regular files and directories, can be remotely synced using the `rsync` command. In this lab, you will be tasked with using these utilities to back up important data on a Linux host and sync it to a backup server.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Use the tar Command to Create Backups of Directories on the server01 Host
  • Create an archive called full_bkp.tgz in /home/cloud_user using gzip compression on the following directories: /home, /etc, /opt, /usr/local, /root, and /srv.
  • Create an archive called var_bkp.tbz in /home/cloud_user of the /var directory using bzip2 compression.
Use the dd Command to Create and Restore Backups of Devices on the server01 Host
  • Use /home/cloud_user/xvdg.img to restore the /dev/xvdg device (use a byte size of 4MB).
  • Create an image file of /dev/xvdf in /home/cloud_user/, and call it xvdf.img.bz (it should be compressed with bzip2).
  • Once the xvdf.img.bz file has been created, wipe the /dev/xvdf device using the /dev/zero device.
Synchronize Backups to server02 Using the rysnc Command on the server01 Host
  • Sync (with compression) var_bkp.tbz and full_bkp.tgz to /home/cloud_user/archive on server02. Permissions and timestamps should be preserved.
  • Sync xvdf.img.bz to /home/cloud_user/archive. Do not use archive mode or compression.
  • Sync (with compression) the following directories to /home/cloud_usr/sync on server02: /home, /etc, /opt, /usr/local, /var/lib, /var/log, /root, /srv. Permissions and timestamps should be preserved.
Validate the Backup Files and Directories Were Successfully Copied on the server02 Host
  • List the contents of the /home/cloud_user/archive directory.
  • List the contents of the /home/cloud_user/sync directory.

Additional Resources

You work as a Storage Administrator for a local print shop, and have been tasked with performing some backups and restores on your production server (server01) to a backup server (server02). First, you need to create a tar archive of the following directories using gzip compression: /home, /etc, /opt, /usr, /root, and /srv. The archive should be named full_bkp.tgz and should be located in /home/cloud_user. Then, you need to create a tar archive of the /var directory using bzip2 compression. The archive should be named var_bkp.tbz.

Next, you need to restore the /dev/xvdg device using the /home/cloud_user/xvdg.img image file. Once restored, create an image file of /dev/xvdf called xvdf.img.bz (using bzip2 compression). It should be located in /home/cloud_user. After the image file has been created, wipe the /dev/xvdf device of all data.

Finally, you need to sync the tar archives you have created, as well as the disk image, to /home/cloud_user/archive on server02. Then, you need to perform a sync of the following directories on sever01 to the /home/cloud_user/sync directory on server02: /home, /etc, /opt, /usr/local, /var/lib, /var/log, /root, and /srv.

Notes:

  • All tasks except remote sync should be performed as the root user.
  • Use cloud_user when performing a remote sync, as remote root login is disabled.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?