Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon
Labs

Backup and Recovery Using Rsync

This hands-on lab is designed specifically to show how a free tool, `rsync`, can be used to perform backup and recovery operations from a local system to a remote one. Rsync derives its name from its main task: remote synchronization. It is commonly used as a backup or mirroring tool, but can also be used to sync files either remotely or locally. To view the man page for rsync, click [here](https://linux.die.net/man/1/rsync).

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Beginner
Duration
Clock icon 45m
Published
Clock icon Sep 30, 2019

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Install Rsync

    Install Rsync on both Server1 and Client1:

    yum install rsync
    

    Note: To use the above command without adding sudo, you will need to be the root user. If you do not elevate privileges to root, you will need to add sudo to the beginning of the command. Either way is fine.

  2. Challenge

    Create a Directory for Backup on Client1

    Create a new directory called files4backup:

    mkdir /home/cloud_user/files4backup
    
  3. Challenge

    Create Two Files in files4backup, tps_report1.txt and tps_report2.txt, Which Will Be Used to Verify That the Backup Was Successful Later On

    Create two new text files, tps_report1.txt and tps_report2.txt:

    touch /home/cloud_user/files4backup/tps_report1.txt
    touch /home/cloud_user/files4backup/tps_report2.txt
    
  4. Challenge

    Using rsync, Copy the Files from Client1 to Server1

    Run the following command:

    rsync -avz /home/cloud_user/files4backup/ [email protected]:/home/cloud_user/files4backup/
    

    You may be prompted for a password. If so, use the one provided on the lab page for cloud_user

    Verify that the contents of the files4backup directory were copied from Client1 to Server1. This can be accomplished by logging into Server1 and running the following commands:

    cd /home/cloud_user/files4backup
    ls
    

    The two files that we created in in the last step should be present.

  5. Challenge

    OPTIONAL - Modify tps_report1.txt and Verify That the Changes Are Carried over after Performing Another Copy to Server1

    On Client1:

    Open the tps_report1.txt file:

    vim /home/cloud_user/files4backup/tps_report1.txt
    

    Add some text to the file and save it, then perform another remote copy:

    rsync -avz /home/cloud_user/files4backup/ [email protected]:/home/cloud_user/files4backup/
    

    Back on Server1:

    Open the tps_report1.txt file to verify that the changes were carried over:

    vim tps_report1.txt
    
  6. Challenge

    Delete a File in the files4backup Directory on Client1 and Restore It from Server1

    On Client1, remove tps_report2.txt:

    rm /home/cloud_user/files4backup/tps_report2.txt
    

    Verify that it's gone:

    cd /home/cloud_user/files4backup/
    ls
    

    We should only see tps_report1.txt in there.

    From Server1, run a remote copy of our files4backup directory back to Client1:

    rsync -avz /home/cloud_user/files4backup/ [email protected]:/home/cloud_user/files4backup/
    

    Back on Client1, verify that tps_report2.txt exists:

    cd /home/cloud_user/files4backup
    ls
    

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

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.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans