 Hey guys, welcome back to Daniel's Tech World on YouTube Medium and at DanielRosal.tech. So we are continuing our exploration of the various ways one can back up a Linux host. In this case, it's an Ubuntu 20.04 long-term support desktop that you're looking at backing this up to our Synology network attached storage NAS. So this particular NAS I'm using here is the Synology DS920 Plus. It's a 4-bay NAS that I received last week from Synology and it's just really at the time I'm making these videos, making its way onto world markets. It's out in Japan and Australia and coming soon in the US and in Europe. So basically, in terms of what I looked at so far, I've looked at GR Sync, which is a graphical user, a GUI, a front-end on our Sync. I've looked at ClydeBerry, which takes things a little bit further and allows it to create schedules and backup plans and coming next is going to be CloneZilla, which is for creating those good disk images, the bare metal copies, but there's a lot you can do with our Sync. Our Sync, and I've talked in previous videos and anybody who knows backups talks about a lot, both two things, one the 321 backup principle of three copies of all critical data, primary data source and two backups, two different storage media and one of those needs to be off-site. So clearly what we're doing when we're working on our Sync backup over the local area network to an NAS is we're just creating an onsite backup, but the beauty of the Synology NAS is that it has a delightful tool called Clyde Sync and that just can create a Sync bi-directional. It can be bi-directional, it can be local to remote or it can be remote to local with a Clyde storage device. So I can basically run an R Sync from this Linux desktop that we're talking about now and I'm able to then push that up to the cloud and that'll give me my two backup copies, one also onsite and one off-site up on the cloud. So Synology you could say is kind of a dream tool for people like me who take doing local backup seriously. I'm not backing up an entire enterprise over here, I'm just backing up one Linux desktop so we're not talking about petabytes of data, but for this it's very effective. I wanted to point out a couple of things before we get going. The first thing to note is that Synology you really have to pay attention to the settings in this DSM. DSM is the operating system that runs on the Synology and I did not have this backup replication screen but what I did have to do is go in and open up SSH on the NAS and I also needed to add R Sync. Additionally, I needed to manually add each user I wanted to have R Sync access. I had to manually add them into the R Sync pool so none of that stuff was kind of ready to go out of the box. So just to point out that if you've just got it and you're trying to SSH your R Sync into the NAS and you're wondering why nothing is working, you're getting these error messages, that is why. So do that firstly. Finally when you're ready to actually get going on these things, now I did say that I wanted to mention this resource by Mark Sanborn. I don't know who he is, I'm saying his name as if I do, but he did put together this nice document, use R Sync for daily, weekly and full monthly backups. Now I've talked before about full backups, incremental backups and differential backups. Full backups are what they say on the tin, backing up the full system. So when we're taking an R Sync job, the first time from our computer to our NAS and we're backing up the whole, we're basically creating a full backup. Now when you do a differential backup, you're backing up only the difference, only the changes between when the initial full backup was run and when this backup is being run. And then we have incremental backups which are the only thing being backed up each time that runs is the delta which means the change between the various incrementals. Now they have pros and cons, each of them and from the point of restorability, really incrementals are what are used nowadays, but the methodology that this blog describes is what I've just charted out here in this diagram and it's showing how you can create a few snapshots. Now this replicates just by using the R Sync CLI and setting up a couple of cron jobs. What you are basically doing here is kind of replicating the functionality that Timeshift provides and Timeshift is just a, it's kind of the Linux equivalent of back in time, I think that's what it's called and there's a Mac equivalent as well. So creating a few rollback points. Now I'm just going to explain how this worked because this blog does a nice job and he adds a couple of important points actually here. So basically one of them is that adding the delete flag and if you notice the syntax there's two dashes after the initial variables and the variables I'm going to be using are actually not those, I'm going to be using minus X minus capital A and V, V is very important to get robustity, path to source that's going to be, and I've just created a, I'm just going to do a couple of test files over here and then that. Now, weekly sync is going to be, he's creating a weekly snapshot is what I would call it to maintain our weekly incremental backup. Now what's going to change when you're using R-Sync? So on the first time that R-Sync runs, it's going to move over the whole system and as I said, I think that's, it's fair to call that a full backup and the terminology is not 100% that but effectively creating a full backup, it's going to create a file system, it won't be in the format of an archive but what he is suggesting is basically you're running R-Syncs again but running them on the NAS. So that can be done by going into the another, you have to open up the advanced features in order to get the ability to set cron jobs on the NAS but you could run an R-Sync from daily to another folder that you can call weekly and if you run that once a week and just as when you ran the first R-Sync between the computer and the NAS, the first time that runs you're going to create a full backup, it's going to, this is going to be zero and this is going to be full of your computer's files and therefore it's going to move over everything at once but the beauty of R-Sync is that each time it runs it just creates, it just moves over the delta. So I don't think it's fair to call this an incremental backup strategy in fact because if you think about it, I've just diagrammed out another snapshot point, this would give you three and three is nice if you're creating snapshots but it does mean that you're going to be, if you think about it, you're going to be ending up with three times, if this is 50 gigabytes, you're going to end up with a 50, 50 and 50, a 150 gigabytes, 150 gigabytes of storage on the NAS backing up, so three full backup. So it's not actually an incremental backup strategy because what's being held in these guys is not just the delta, it's actually the, they're just behind copies. So this is going to be a week behind daily and this is going to be two weeks behind daily and how do you set this up? It would be pretty simple, you would need to create a crown job here once a day executing R-Sync on the computer, moving that to the NAS and then on the NAS you'd be creating two crown jobs, one for a daily to weekly R-Sync push that would execute clearly once a week and the other one, a daily to R-Sync push that would execute twice per month and that would give you your three backup points but those are each actually full backups, as I said. They're not incremental or they're not differential, it's just the one R-Sync runs, it just moves over the delta each time, you don't replace, you don't overwrite a full backup with a full backup. So basically the syntax is just important to know and I've just jotted this out over here. So this is the name of the volume I've created. Now if you're backing up the whole file system, you will need to run this with pseudo elevated permissions. So I have put pseudo in my command even though for this demo I'm not gonna be using it, right? So pseudo R-Sync minus, I'm gonna get rid of this this upper A actually, tack tack delete, username this and there. Here's what I wanna point out, it's two colons, then it's the volume name and then it's the path within that volume, so I'm just gonna put stuff on the root. Now if you do need a bit of help with the various R-Sync parameters, there is an extensive man page which has all these so you can really look through and see exactly what everything is doing and I do not pretend to be an expert on R-Sync but there are plenty of options over there in order for you to just play around with and you can of course do a draw your own and whatnot with it too. So what I'm gonna do over here is I've created this folder called R-Sync test and I'm just going to, I guess I didn't need to just do that but basically just I'm just gonna repeat the process over here. Create a couple of text files, file one, file one, two, let's just do three for the sake of it. Not doing this in a very smart way. So I just created three empty text files over here and what I'm gonna do now is just simply run this command. So I've just popped that into my terminal and of course after the parameters and before the destination, now remember R-Sync is beautiful, it can be run remote to remote, local to remote in both kind of ways but the syntax, whatever you're saying, whatever, however you're gonna be doing it is gonna be source destination so I didn't specify my source here. So my source is gonna be, and if you're wondering why I'm not using till this because I can never remember where that is on my keyboard. So there we go, this should be good to go and as I said, we don't need pseudo because this is just within our user directory. So just ask me for the password, which we'll provide and that's it. It moved stuff in just a second because clearly we're just moving three text files which contain nothing. So let's just go into the NAS, do a refresh. Oh, sorry, that was the wrong one. It is Daniel desktop R-Sync and there we go, our three files have populated. Now let's just go back into our terminal and because we've added the tack-tack-delete into the command, it should sync deletion. So now let's just delete file three and then run this guy again, password again. Deleting file three has come up in the terminal output so it looks as if that's worked. Sorry, and let's just go back to the DSM and let's do a refresh. We can see that file three has been nuked on the destination. So that's basically it. Now in order to actually get from here, from running our sync commands to creating a system, there's various ways to do that but one of them would be simply just building out a couple of folders on the destination, setting up those crown jobs, server side and using server side with invisible quotes because it's a local server, the NAS but that would be and that would give you a few restore points on the NAS that would be able to, you could use that in order to, and what you would have to do if you didn't need to restore it would be to simply run the command in the opposite direction that your source would be the folder on the NAS and your destination would be the local file system and as he said, in a full system backup we would clearly be running something more, we'd be running with pseudo permissions, pseudo permissions and our source would be the root of the file system and that would be a full backup onto the destination. Thank you for watching and if you've any queries or I simply would like to get in touch my website is here at danielroso.co.al Have a great day.