Rsync Backup on Linux

preview_player
Показать описание
This video is going over Rsync Backup in Linux. This is a vital part of backing up and will do practice backups and restores from network locations.

Backup Syntax
sudo rsync -aAXv --delete --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/home/*,/lost+found} /source /destination

Restore Syntax
sudo rsync -aAXv --delete /backup /system

Current OS
Debian KDE 10 buster .

Рекомендации по теме
Комментарии
Автор

One recommndation I would make for running rsync from a cron job and that's to prefix the command with "nice -n20" just in case you're doing something else when the cron job launches. That way it will give rsync the lowest possible priority on your CPU and won't interrupt whatever you're doing. If nothing else is going on, it'll give it full CPU usage, but if you have another process taking up CPU time, that'll get higher priority.

aitchpea
Автор

Rsync is fantastic. It’s my favorite backup tool. I’m glad you covered it, and covered it so well. Backups have come a long way (I still remember backing up data on 5.25” floppies and even tape drives), so there’s no reason not to properly backup one’s data, and this video explains it all extremely well. Thank you!

mitchelvalentino
Автор

TimeShift using rsync is awesome. Restoring my system was so fast my eyes were bugging out of my head in amazement.

AndrewMurrell
Автор

You can use the --dry-run ( 2 dashes) option to run rsync without actually doing the backup so you can see what it's going to do.

RickRomig
Автор

Good video. I used to live with rsync and scripts with it. One option I would add is -z (compresses file data as it is sent). Big speedup over slower networks with very little overhead:

-z, --compress
With this option, rsync compresses the file data as it is sent to the destination machine, which reduces the amount of data being transmitted -- something that is useful over a slow connection.
Note that this option typically achieves better compression ratios than can
be achieved by using a compressing remote shell or a compressing transport because it takes advantage of the implicit information in the matching data blocks that are not explicitly sent over the connection.

teamvigod
Автор

The one thing I always do before that line is check for running processes and/or dismount databases otherwise a lot of critical files will be open and not backed up just because you left apps open on your machine.

Ranblv
Автор

If you want a GUI to rsync, try, Grsync, it's a pretty thorough GUI

JessicaFEREM
Автор

As someone mentioned, -x would naturally exclude other files systems but also --exclude=/home/titus/{ltb/*, 256nvmw/*, .cache/*} would save a few keystrokes... and don't forget --dry-run when test different rsync arguments, especially when using --del (being short for --delete).

MarkConstable
Автор

Been needing this- and with YOU doing the video- I can learn it.. too many RAMBLE- or talk so fast I can't catch it... GREAT JOB!!

davidwayne
Автор

Thanks Chris, I was always a bit confused but -a so I took the time to crack it down:
-a, --archive archive mode; equals -rlptgoD
-r : recursive
-l: copy symlinks as symlinks
-p: preserve permissions
-t: preserve modification times
-g:preserve group
-o:preserve owner
-D: same as devices specials (don't really know what this is) x
So now I see what you were saying, -a is a sensible way to copy.



-AX i don't really understand what they are useful for, even though Chris explained it.

santiagomiranda
Автор

Thank you, I am using rsync for the first time. I have tried before with no luck, but your piece was clear. I have used Grsync before. I thought there was a manual for rsync which told what all the options were.

brianhiggins
Автор

Thank you, Chris. Timeshift has been great when I needed it. But I think I might also do an rysnc cron-job as well.

AnzanHoshinRoshi
Автор

I appreciate the time you take to make these videos. You're content has helped me out. You mentioned going over cron jobs but didn't. I'm sure it could be a video all in itself for somebody who hasn't done it, but regardless thanks for this.

justingilpin
Автор

Yes, so glad you did Rsync! I've been using it for years ever since someone on linuxquestions.org told me about it. It's incredible!

heckyes
Автор

Great vid as usual. If I may, I'd like to add the fact that this method (RSYNC) allows for really big data backups with no real limit beside the destination storage space available. Compare to say windows server backup software which are usually limited to 2tb. Which I have encountered multiple times in various clients businesses. They usually use this builtin windows tools to perform backups. But this tool like many others have a data limit of 2tb due to the process they used for the transfer.

xFUNKYFACE
Автор

Love your stuff mate :) - also greetings from Australia :)

digitalsparky
Автор

I am personally using deja-dup and I am very satisfied with the backup function and the simple GUI application.

Cyanwasserstoff
Автор

Great video!! I love using rsync. Easy to set up and implement through Cron.

rmcellig
Автор

I have been using Linux Lite and Peppermint os Linux for about 4 years now and it's time to upgrade a few machines. I added a new 4TB WD Red Drive to my Master heaviest duty fastest PC that was running Linux Lite 14.04 LTS and added the new drive via fstab to mount to the /media/ folder at boot time. I then watched another one of your videos that showed how to set up a Samba Shared Folder and after a little tweaking, I was able to accomplish that. I then went over to my old Toshiba Laptop that has a 250GB HD in it and modified the fstab to auto -mount to the new shared folder on a 2TB Partition I made on the new 4TB drive on the Master PC. Working on the command line is a little tedious, but I managed to watch this video a couple of times and was able to read between the lines a little bit about how to get the rsync configured using my specific folder, share device and backup names. I'm still not totally convinced I did it correctly, but it seems to be attached and able to create, read and write files and folders to the Master PC Shared folder on the new HD.
I followed your command line almost exactly, but got a little confused about whether to use the actual Samba shared folder name or the actual names and tree structure to point to the folder. Anyway after a little testing and tweaking, it appears to point to the right folder seems to be working. I fired off the backup job and went to dinner, and when I came back everything was standing still, but there were no errors on the screen. Everything just seemed to stop for no apparent reason. There was plenty of space on the Master drive to store the files, and I really could not see any reason for the pause. Nothing I could do would move the job along. I went into task manager on the source PC and rsync appeared to be in use, but after waiting almost 30 min, no change in status of the backup job in terminal. I tried to kill the job with a Ctrl-Z in terminal, and that didn't yield any results. I finally closed the terminal and then restarted a new terminal and tried to run the rsync job again, but this time to a new directory. I got an error that I Googled, and it said that either the target drive was out of space (which it was not as it was a new 2TB Partition that I placed on the 4GB Drive), OR the connection simply timed out. I believe this was what happened. The author suggested adding --Timeout=120 to the rsync command to prevent timeouts from occuring for 2 minutes. But, I wanted to kill the existing job and start over, so I went into task manager and tried to kill the tasks from there, but no dice either. I don't believe I started task manager as a Root User. Unfortunately, after a few minutes the laptop locked up and mouse froze. The only way to shut it down was a hard power off and restart. It came up just fine, so I tried to run the job again, but this time to a new target directory and using the additional --timeout=120 command line variable, and it kicked off and has been running for over an hour just chugging along backing up this old laptop. It's using wired ethernet connection through my gigabit network, but this old Laptop has only a 100Mbit connection, so this will take a while as the drive was about 90% full. The first job backed up about 10% of the laptop's files when it stopped working, so I could tell by checking available disk space on the target drive on the Master PC that so far I have backed up much more data than the first time. My goal it to basically replace Peppermint OS 8 (Ubuntu 16.04) with the latest version of Peppermint OS which I believe is Peppermint OS 10 Respin. I was planning on re-partitioning the Laptop HD into multiple partitions as outlined in one of your other videos to make this job easier next time I update. I will have to do the upgrade on the Master PC as well because it is running ver 14.04 LTS of Linux Lite. It was my very first Linux installation back in the day, and I DID originally put multiple partitions on that one for the root, boot, swap and home directories. In fact the entire OS is on an SSD drive, and my data is on a 2nd traditional HD, so that one should be easier to update I hope.
Anyway, thanks a million for your hard work on these videos! It sure helps out people like me that enjoy a little challenge, but really love the stability of Linux compared to the old Windbloz Software we had to endure for many years in the corporate world. Thanks Again from Central Florida!!!

optionstraderman
Автор

Thanks so much! Good to know about the exclude option!

Stefan-ghxr