Hello, in this lesson, we are going to look into our sinc, yes, another utility or transfer files
from one machine to another or copy from one machine to another, and then our sink stands for remote
synchronization.
What exactly are sync is it's a utility for efficiently transferring and synchronizing files within
the same computer or to a remote computer by comparing the modification times and size of the files.
So basically trashing files from one x ray to server B and the way it works efficiently is because it
looks at the modification times and assizes it assizes.
Let's suppose to give it a little for the first time to it.
The second time is four gig.
It will only transfer that change, which is to Guignard, the entire foget.
I'll tell you a little bit more about now.
The R sync is a lot faster than those tools like FTP or SICP.
This utility is mostly used for the backup of files and directories from one server to another.
A lot of system administrators and engineers actually have our sync command or utility running and the
crosstab to actually copy files, everyday files and modified files from one server to another as a
purpose to back them up.
The default passing port as 22, which is the same as S.H. that as the states uses, so there is no
longer sink server that you need to install on the remote server to accept the incoming traffic, it
is going to use the S.H. protocol, just like SICP uses the same protocol, S.H. or SINC does the same
thing.
So it piggybacks on Port 20 to S.H. for this lecture.
Again, we need to Lennix machine because we need to test from copying or synchronizing files from one
server to another.
I have my first machine is my first Linux VM, which is I refer to as Clide because I transfer files
from that machine to another.
And what is another machine is my server, which is which I created another Sento as a VM and I named
it Linux S.O.S seven.
It has a same specification as the the first machine that I created.
Nothing changed.
The only thing changed is the hostname.
All right, let's look at more a graphical or diagram way, so I'll make you understand how they are
singularly works.
So you have a server, A or client that needs to go to server B and he needs to transfer those files
over the utility or sync.
Now, are cinches uses as a sage or piggyback or S.H. to transfer the files.
And for that you need SSA should serve service running on the destination server where the files are
going and the port by default for SAHD is 22.
Now it what it does to our sink, it actually copies and and copies to destination keep the same copy,
the same size and the time from source to destination.
How it works.
Let me show you right now, if you have a two meg, the size of the file is two meg of a file.
It transferred the very first time, the exact same size to Meg.
Next time someone comes in and change that file, not a file size, but from two meg to eight meg.
So now you need to transfer this file from server to server be.
So now this is the beauty of our sync.
It is not going to take your entire eight meg and copy it over again.
It will actually subtract those two meg that was copied earlier and only copy the one.
Add that the difference and that file, which is six Meg Meg and then ultimately the first half are
the first two meg plus the six meg.
It's going to make combined them together to make it eight meg.
Similarly, if the file grows from eight meg to twenty meg the our single that subtract the difference
and only transferred the difference over to the destination server.
All right, let's look into the technical side, how the command works.
So basic syntax of passing command is our sync space the option?
If you want to specify any option, then the source.
What are you copying or transferring destination?
Where are you copying and which location install are sync in your Linux machine?
So first thing we need to do is if our sync is not already installed or the command is not available,
we have to install that utility.
But first, before you go ahead and install, check if it is already installed.
So if it's not, do install our sync and sent to us readhead distribution and Abuzaid to debut and you
do Atget install our sync, then our single file on a local machine.
So you need to copy a file from local machine within a local machine.
You need to do, let's say if you wanted to talk or so for that let's create a backup of the entire
home directory and we put in Atah and then we back it up.
Will our sync a directory on a local machine?
Well, our single file to a remote machine and we are sync a file from the remote machine.
All right.
So these are the steps we will take.
So I know it's a lot of information throwing at you, but we'll try one by one and I'm sure you'll understand
by the time you're done with this lecture.
So I have my Linux machine open.
This is my Linux machine, which is my client and which is my first Linux VM ops.
OK, now what I need to do is I need to make sure I have the R sink package installed before I actually
go in and do some install.
Let's do R.P.M. Dash Keyway and grew up for our.
Beautiful.
It is there, by the way.
I am logged in as myself and again, my host name is my first and next year and to check if the package
is installed or not.
You don't need to be rude.
You could just simply run away.
But if you need to install a package then yes, then you need to run.
Youm install are sick with the root credentials.
All right, now we have confirmed we do have arsing package.
Now let's get into the fun part, where we going to do our single-file on a local machine.
So I am in home, my home directory, and I do it myself.
Here you see all these directories and files.
What I wanted to do is I wanted to put all these directories and parse into a tar fall into a container
and it.
So for that I'll do tar cbf backup.
This is a name I wanted to give once it's archived and tade.
And what I'm tarring, I'm trying everything within the same direction, and this is the same directive,
which is PWP when I did it, it's home I absol.
So that's why I'm using DOT.
I could have used homes that shivs all as well.
But since I'm already in this directory, no need to specify the absolute path.
Go ahead and enter.
All right.
So it has tarde all the files and directories into backup data.
You see it is there.
Perfect.
Now I'm going to ah, use the arsing utility to ah sink this backup doctor into another directory and
that another directory I'm picking is slash temp slash backups.
So before I do that, I wanted to create that backup directory which I don't have it created yet.
So I'll do mkdir slash temp set backups.
Perfect.
It is created to test.
You could do a CD slash temp slash backup and there you go.
It is.
And you are in slash temp like backups.
That's how you conform anyway.
You cd back out do just to make sure you and your home directory.
Yes I'll run the comment.
Ah Sync.
Dash the age if you want to know every little detail about each of these options that I'm using, then
you should have run the command man are sync and it will give you the information about every option
that is available to you.
Here are the different options anyway, are sync.
Dash is Z, the H backup, which is the file name that he created and backing up where it's going to
tell me temp backups, slash temp slash backups.
Go ahead, hit, enter, they go, it's sent it says one point zero six bytes, received thirty five
bite size and took seven of 754 bites per second.
It's a transfer speed.
So now go to KDDI, temp slash backups and check, verify if the backup data file came through or not
as well as myself.
Here it is.
Their.
Nice.
OK.
Now, next thing we wanted to do here, let me move this up on the side right here, sinc a directory
on a local machine.
So before we sync the file now, I wanted to sync a directory, so let me go back into my home directory
by just typing KDDI and hitting enter now duppy WD you're going to seize home.
I have tsol dweller's mysel tr to see the content inside of my directory.
Now again you probably have a lot of different files in your home directory that you do.
You might not see on my screen because I make a lot of changes when I go through making videos, so
don't worry about it if my contents don't match with your contents.
OK, so are Senka directory.
So to do that I want to ask everything that I have in this directory to this temp backup directory.
For that I would use a combined ah cinq.
That's a Zev H slash home slash IAFIS all perfect and move this up.
And I'll put it this window right here, so you know exactly where I am.
OK, and now where I am copping it to slash temp slash backup's hit enter.
Bingo, beautiful, it works.
So let's go to Temba, back up, verify everything that I have in my home directory, which is which
is home slash home slash afsal.
You notice everything has been synchronize here.
Perfect.
Now, let's talk about the part right here.
Let's move it down.
It says our single file to a remote machine now.
Now for my remote machine, I have.
This as my remote machine, and I call it Linux S.O.S and the IP address for this remote home remote
machine is if config ENPI zero three, it is one I2 one 68, one 58.
This is the IP address and this is where I want to transfer.
So let's minimize again.
So I'll go into my home directory.
And I wanted to copy or sync the backup data file now before I.
Passing this over to the remote server, I wanted to create the destination folder where this is going
to go, so I will go back into my server.
And I'll go into slash temp and here I will create a directory called Backup Backups.
That's my sister, and you're going to see right here at the bottom, it has been created.
Let's clear the screen now.
Let's go back to our client machine.
This is a client machine.
Now we're going to use the command are sync dash, avi Z backup.
That's a file we wanted to transfer over.
Now you want to transfer over as what user as myself.
OK, which machine is it going to?
It's going to 102, 168 one to 58, which is the IP address we just checked on our remote server and
which directory it's going to colon slash temp slash backups.
This is the directory is going to go ahead hit enter.
It's going to ask you for the password, for the assault on the remote machine.
Put in the password.
Beautiful, it is fair to say Santa tells you a lot of information and speed and everything, now,
once his transfer is your job to verify it has been transferred, go to your CD, slash temps.
That backup directory dweller's mysel tr and you'll see right here, this is the one that's been transferred.
Perfect.
Let's move on.
Let me minimize this now.
The last part is right here at the bottom is our single file from our remote machine.
Now we wanted to go to the remote machine and fetch a file from there.
So which are we fetching?
So first, let's make a test file, a dummy file.
So I'll go into my home directory because on the server I'm logged in as myself here.
I'm going to create a file.
I'm not call it server file.
Who else mysel tr and you're going to see this overpoliced here.
Perfect.
Now, if I come to my client machine, to P, D and minus Elter, you see I don't have that zero file,
so I need to bring or pull that sort of file from the server.
And for that I will have to do our sync.
A DSH, I have Zoll because this is the username I was used to log in to their remote host.
What is the IP of the remote host 58 Purrfect.
Now where is that file that you are trying to bring.
The file is in a home.
I have Zoll and the file name is Server File.
Perfect.
Now when you bring it where do you want to save it or copy it to.
I like to copy it to my temp backups.
File directory enter is going to ask you for the password.
Perfect has sent 43 bites now where did it go?
That's verified.
I ask it to come to my slash temp slash back up directory, duelist mysel TIAR and you're going to see
right here, Cesur File.
See that's how you fetch a file from the server.
So anyway, there are different options that are available on our sinc that allows you to do like dry
runs, that allows you to do arsing continuously, allows you to do only only deltas, meaning only
the changes.
You just need to pick the right option to use.
Which option works for your own requirement.
Good luck.