Linux Server- Backup Directories & Files

Linux Server- Backup

08 September, 2021

Linux Servers are one of the most flexible and safe servers providing high-end security. Many admins and developers use Linux Servers to keep backups of their data and files. This blog explains how you can back up the individual files and directories in a Linux Server. 

For demonstration purposes, we’ll be working on Ubuntu, one of the most popular Linux Servers. Folders in Linux are addressed as Directories.

Step 1: 

Creating Directories- If you do not have any directories created yet, create a directory as per the below screenshot. 

The mkdir function helps create new directories. We have created a directory named FileforBackup

linux server- mkdir

 

The ls function will show you the created directories and files. 

linux server- ls

 

Step 2: 

Create files-  create multiple files inside the directory by using the cat command. 

linux server- cd

 

 

Step 3: 

Create one more directory to store the backed-up files so we can store the entire directory or file in the specified location. We have named the directory as “Storage Location”

linux server- directory for backup

 

If you want to take backup your files to any external disk or external storage by using the mnt command mount the external device and you can specify the external device path. 

Step 4: 

In this step, we can find the path of directories by using PWD command. 

  

mnt function

Step 5: 

By using rsync command, you can easily can take backup. 

Use the -a (archive) option to preserve attributes of files.

The -v (verbose) option forces rsync to list the files as they are being copied.

The syntax should be as follows: rsync specifiedpath destinationpath 

 the syntax

  

Step 6: 

You can find the backed-up file in your destination path. 

rsync function

Lastly, complete the backup process by using the rsync command. 

In the same way, we can back up the entire machine to any specified location as well.

Note: If you use any external hard disk or any external storage device to make a backup you should mount that device in any specified location.  

 

How we can help:

Our server team can help with the installation, configuration, deployment and monitoring of Windows/UNIX/Linux based servers. Want to migrate or do an audit of your server? We help you with all your server needs along with proactive support for the server and IT infrastructure.