 Tommy here from Learn Systems. We're going to dive into R-Sync running on FreeNAS. R-Sync, if you're wondering, is a wonderful tool for synchronizing data. But no, I'll just tell you right now at the beginning of the video, it's not as fast or as efficient as the ZFS replication, which I have another video for. But there are special use cases where R-Sync may be what's needed and it solves problems, sometimes especially when you're transferring between non-FreeNAS systems. So we're going to show both how to transfer from one FreeNAS to another using R-Sync and also how to transfer to like a Linux system using R-Sync. But first, if you'd like to learn more about me and my company, head over to LawrenceSystems.com. If you'd like to hire short project, there's a hires button right at the top. If you want to support this channel in other ways, there's affiliate links down below to get you deals and discounts on products and services we talk about on this channel, including a link to our Patreon if you'd like to become a Patreon supporter. We also have a swag store where you can get shirts and other items that are for sale and that changes from time to time what's available and what's not. So go ahead and check that out frequently. And finally, our forums. If you'd like to have a more in-depth discussion about this video, suggestions for new videos or just reach out and say hi and talk tech, our forums are a great place for that. All right, now back to the content. We'll start real quick and say, what is R-Sync? R-Sync is an open-source utility that provides incremental final transfers. It's been used for a long time by me and well in the Linux community as a whole to synchronize two different directories together. So if you have a path with a lot of data in it and maybe some of the data is over here and you're not sure if all of it is, R-Sync is a great way to synchronize the two paths. And if just a single file added over on the other side, R-Sync goes, oh, we got this and we'll bring it over as well. So it can do incremental transfers. It's really smart, it has a lot of options, it's easily scripted. Now it can be run over SSH, which goes beyond the scope of this particular video. And it's also not necessary to set up these modules inside of FreeNAS in order to have it working over SSH. It's just an extra parameter. You can Google how to R-Sync over SSH. Maybe I'll do a video in the future, but it's pretty well documented how to do it. We're gonna talk though about how set up R-Sync inside of FreeNAS and how you can have two FreeNASs talking together with R-Sync or even a Linux system to pull that or actually it expands beyond that. And we've seen it where other NASs that do have R-Sync abilities and you wanna sync FreeNAS to something, R-Sync may be a tool to go to for it. So like I said, it has some special use cases. Now first I wanna thank Tech Supply Direct for supplying us with this server right here. This is that Dell R730. I have a review video I'll leave a link to below on there. I mean if you're interested in getting a server like this from Tech Supply Direct, I do have an offer code that gives you 10% off on here. So this is a reasonably fast and nice server. It's an R730 with 64 gigs of RAM, plenty of storage, plenty of fast storage. But the first thing we gotta do is we're gonna go to services. And we're gonna turn the R-Sync module on. And if you want it to start automatically, there's the checkbox for that. Now we're gonna go and configure it. TCP port 873 is the default for R-Sync. Second, R-Sync does not itself have any security. It is now exposing port 873 and any of the modules we tie to it for anyone who connects to it internally. This is why one, it should not be publicly exposed across the internet unless you have some special use case where you want people to get those files and there's sometimes development times when you go, maybe I do want people to be able to pull this and I wanna publicly share it. But by the way, it does not have security. As I said, I just wanna make sure that's really clear. Don't just forward port 873 out to the world unless it's something you wanna potentially share with the world. Next, we have to add a module. So this is our source system right here, 3.212, like I said. And we have the options of read and write, write only, read only. And we have this module. And we're gonna share some photos. So we'll call this module, photos. And some photos. There we go. Get it spelled properly. If not, some little point out that I misspelled something, which is fine. And I have some photos right here. So here's the path on this particular system. We're setting it to read only because I want to share this with another freelancer. I want to be able to sync the files but I don't want anything written back to it. So I don't want it to be any rewrite sense user. We're just gonna go with root. So it has the high level permissions here but you could match them to whatever I have assigned here. I'm not even sure what ones and I don't feel like looking. But root and wheel will be fine because root has permission to go over everything. You can limit the number of connections if you want. So how many are sync connections come there? We're gonna leave it at zero which zero should leave us at the max. Zero is unlimited. Host allow. Now while it does not have any username password type security, it does have implicit host allow or host deny. So I could say only allow certain systems or deny other systems. And you can put networks in there as well. Enter some other auxiliary parameters we're not gonna get in but if you have certain advanced use case information you can pass those parameters long. But that's it. That's all we gotta do is set the module up and hit save. So now we have name photos, comment some photos. We have the path. We have it set to read only mode. We have the permissions. I'm able to look at it with root and wheel which means I can definitely get all the files. You probably wanna match them but for sake of this demo I'm not gonna match them to whatever permissions are actually on those particular files. But that's it for our source system. Now let's go over here to FreeNAS and what can we do with that? Well let's go ahead and pull that data. So we're gonna go, what's the path? First we gotta decide where's the data gonna land and I made a folder called rsync YouTube demo. Pretty straightforward. User, what user permissions are we gonna do on there? Why not? Remote host, 192.168.3.212. So that's this IP address here. That's the system. Now FreeNAS actually supports the encapsulating over SSH. Like I said it goes out of scope of this but it does have that built in but you do have to and setting it up from a command line is probably the easiest way to do that. You do have to have the FreeNAS making the request have installed SSH keys on both systems. So you have to have this having the private key and then a public key pushed over there. Like I said it goes out of scope but yes it is supported on here. Rsync module name, well we called it photos right there. So we'll just paste that in. Photos, direction, push or pull. Well we can't push because that's read only. So we definitely want pull and we want the data to go from the source system to 12.2.3.8, no problem. And we're gonna say pull some photos. Pull some photos. Schedule a task, hey why not? This should run every day or every hour, however you wanna do it. Now these are great for things like if you just are dumping some files somewhere onto one FreeNAS and you wanna rsync to another FreeNAS and you don't wanna go through the entire setup like I did where ZFS syncing but I just need those files that get dumped into this folder copied over to this particular system. This is an easy way to do it and you can set it for however long you want. The first time it runs it copies all the files and it's incremental every time they're after. So however you wanna set it. And these tasks unlike the ZFS replication are completely rsync tasks. There's no replication of snapshot data or any snapshots required for this to work. Recursive, yeah, we want everything if there was subdirectories. Time stamps compress it while it's running. Have to save them temporary from each updated file holding direction until the end of the transfer. These are all default options. It's fine just to leave them all at default but you can also choose delete. You may wanna do that. And what that means is if something is deleted on the source, do you wanna delete it in there? Like I said, a couple of the options that you have but we'll leave all these at the defaults because we just wanna get the data from where it is over there but you can see it's easy enough to change these. So we do that. It's pending but we can force it to run now. We don't have to wait for it because there's no snapshots. We can just say go ahead and run. Task started and it'll be done here really fast. Let's actually just force refresh the page. There, it's done. View the log. Unfortunately, it doesn't say any logs are available for that. I don't think there's any logging options that you can even really turn on. Maybe there's some extra parameters but you get the idea. It runs. It doesn't give you much of a notice. It'll give you a notice of a failed and it gives you a success when it's run. But now if we go over to this system here in our R Sync demo, so let's go ahead and log into it. Make the screen slightly bigger. R Sync YouTube demo. There's those. All right, and we'll just log into the other system. Root app, one, two, one, six, eight. Three dot two, one, two. And we see we have the same things here. Now let's go ahead and delete something. We'll rm.picasa.ini file. So now it's missing from here but it's here. So let's go ahead and turn on the delete option. So we'll hit edit. We'll choose delete, hit save. Now if there's a deletion on one side, it'll do again. So let's run this again. And it instantly turns into success because it already copied it once. And now we see the Picasso file. It disappeared. It's missing from this destination system. And if we were to remove more files and it would also do the same thing, you're kind of getting the idea that it's delete syncing. So actually let's rm.img17.star, here we go. We deleted anything that begins with a 17. So now all these have 18s and 19s in them. And these ones still have all the 17s when we list them. So we'll run it one more time. Go up here. And now they're synchronized and all the ones with the 17 done because we have that delete function turned on. So pretty straightforward how that works and how you get them synchronizing. So it's really easy to set up. Now the final thing is, how do you sync it with like another non-freenast system? And this is more the use case. I mean, our sync will work perfectly fine between two freenast systems but what if you had one that's not freenast and you want that module and you have some other type of system where you need to synchronize. Well, let's go ahead and do that. Exit. Exit. Exit. All right. So I have this little script setup that says rsync-freenast-youtube-demo. It's rsync-av-delete-progress-stats1921683212 colon colon photos. Now this is the module name right here. So we gave the module the name photos so we do photos slash that means grab everything in there. If there was a subdirector you could actually go with one of the subdirectors underneath but we're not worried about that. We just want this one right here. Where are we going to dump them? Home, Lawrence, TMP. So if we go in here, look in TMP, LS, nothing in there. It's empty. Let's run that real quick. And the progress and stats is what gives you these little stats right here. So we can see that pretty quickly went in there. So we go in and look at the TMP folder. There's all those files. Great, clear it. And let's run it again. And you can see the files haven't changed. Now what if we go into TMP and we remove some files here? Now you remember it's read only on the other side. Well, we removed all the files. It just runs again and synchronizes again. But what if we accidentally goofed up a couple like RM, IMG19 star. So we still have files. We don't have all of them. Well, same thing. It's just going to rsync and synchronize again for those files and now they're all back. Now, this, like I said, will work in both a read write direction. You could use the module and do it the other way and push things from this system using rsync over. But as I stated in very beginning, there's no security when you're doing rsync inside of here. So the system is just leaving port 873 open. It does have the ability for, you know, host allow, host deny on a per module basis when you're doing this. So use it at your own risk. Use it and making sure that you're doing this on a secure network and make sure that the data is okay to be exposed. So it can be very handy for getting files across, especially when you're setting up a new system or migrating to FreeNAS. Some other NAS systems I've run into, some of the weird ones that I've seen people have, they have rsync, but they don't have a lot of other tools for synchronization. But the good news is because FreeNAS supports polling from an rsync module. You can use FreeNAS to pull from another NAS. Also, if you have some other NAS, you want to use this backup, kind of the opposite is true as well. Where I've seen it, where people set up a module in rsync module, they restrict it to another system. And you can have that system pulling data from FreeNAS as a backup because well, not all other NASs support things such as ZFS replication. So it's a great tool to use. I really like it. It's not what I'm going to use generally to synchronize to FreeNAS systems. That's why I did the replication video. That's going to be the more ideal way to do it. But if you just have some data, you need synchronized between another system or even if you want to make something easily available and you want to pull some type of project files that you keep stored on your FreeNAS system, but you want to easily sync to another Linux system with a quick script, this is an easy way to do it to be able to pull whatever those latest files are from it. So that's all you got to do to get these set up. And you can set up as many modules as you want until you run out of space to do so. So if you want to add more, and remember each one is also two modules aren't named the same. You can have multiple modules pointed at multiple directories. And that's it. All right, thanks. And thank you for making it to the end of the video. If you liked this video, please give it a thumbs up. If you'd like to see more content from the channel, hit the subscribe button and hit the bell icon. If you like YouTube to notify you when new videos come out. If you'd like to hire us, head over to laurancesystems.com fill out our contact page and let us know what we can help you with and what projects you'd like us to work together on. If you want to carry on the discussion, head over to forums.laurancesystems.com where we can carry on the discussion about this video, other videos or other tech topics in general, even suggestions for new videos that are accepted right there on our forums, which are free. Also, if you'd like to help the channel in other ways, head over to our affiliate page. We have a lot of great tech offers for you. And once again, thanks for watching and see you next time.