Linux Server- Backup Directories & Files
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.
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
The ls function will show you the created directories and files.
Create files- create multiple files inside the directory by using the cat command.
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”
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.
In this step, we can find the path of directories by using PWD command.
By using rsync command, you can easily can take backup.
-a (archive) option to preserve attributes of files.
-v (verbose) option forces
rsync to list the files as they are being copied.
The syntax should be as follows: rsync specifiedpath destinationpath
You can find the backed-up file in your destination path.
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.