+3 votes
232 views
Synchronization and backup with Rsync

in Linux / Unix by (551k points)
reopened | 232 views

1 Answer

+4 votes
Best answer

Whenever we administer a server or on our own computers we need to keep information synchronized between computers or between directories.

Rsync is a cross-platform free application used to perform file synchronization and backup operations. It is best known and used in UNIX / Linux .

Rsync on a server listens by default to TCP port 873 and serves both for backup on a local server or on a remote server or different devices on a network.

We will start installed rsync from the terminal for example for Linux Ubuntu we type

sudo apt-get install rsync

Then we will install the application Grsync is a graphical interface of the rsync synchronize tool in Linux.

sudo apt-get install grsync

You can also install Grsync on various Linux, Windows and OS X platforms. Grsync is free software.
When starting, we can create an account between two remote and local directories.

image


We create a synchronization

In the Sessions we can define several backup copies, or synchronization, different in the source and destination directory, which we can select at any time through a drop-down. So we can define several synchronizations and then activate with a single click such as backup, projects, emails.

We select the source and destination directories. If we use a slash bar at the end of the source route it will indicate that we only want to copy content from that folder to the destination. If we do not put the bar, it copies the source directory and the content.

Synchronize directory and content
Origin: / home / user / origin
Synchronize content only
Destination: / home / user / origin /

We have several options to choose to keep same user, group and permissions, define if the destination copy is deleted if a duplicate is found.

We will see several examples both from commands and from Grsync interfaces

Synchronize a hard drive and a pendrive
Origin: / home / user / images
Destination: / media / user / usb001

Synchronize multiple directories in a single session
To do this in the root directory I create a text file without extension called list in the .grsync directory that is as a hidden directory, and inside I write a list of the directories to synchronize
####### / home / user / .grsync / list #######
# .grsync / list
/Projects
/images
/ documents
####### end / home / user / .grsync / list #######

Then in the advanced options tab I indicate that the synchronization from the origin will be touching the directories mentioned in the file list



image


Therefore in the Basic Options tab for example for a computer synchronization to pendrive
Origin: / home / user /
Destination: / media / user / usb001

In advanced options we indicate where is the list of directories to read
--files-from = / home / user / .grsync / list

Other options that allow Grsync to be customized are:

Update only existing files, compare them and do not copy new files
Ignore files that already exist in the destination or not update the newer files, just copy those that do not exist

This is a custom copy synchronization per user and according to your preferences, each session can have a different configuration with a clear focus of incremental backups.
Grsync allows to simulate all the processes with it can be known if something is going to go wrong before making a copy or synchronization, since it shows the real result of the files that will be modified

by (3.5m points)
edited

Related questions

+4 votes
1 answer
asked Jul 23, 2020 in Linux / Unix by backtothefuture (551k points) | 794 views
+5 votes
1 answer
asked Feb 22, 2020 in Linux / Unix by backtothefuture (551k points) | 333 views
+5 votes
1 answer
asked Nov 18, 2019 in Linux / Unix by backtothefuture (551k points) | 250 views
+4 votes
1 answer
asked Oct 22, 2019 in Linux / Unix by backtothefuture (551k points) | 416 views
Sponsored articles cost $40 per post. You can contact us via Feedback
10,632 questions
10,764 answers
510 comments
3 users