Automate Backup in Linux Using RSYNC & Crontab | Backup Data On Remote Server Using RSYNC
#Welcome to Nehra Classes Youtube Channel#
#Automate Backup Using rsync & crontab in Linux#
============================================
rsync or remote synchronization is a software utility for Unix-Like systems that efficiently sync files and directories between two hosts or machines.
One of them being the source or the local-host from which the files will be synced, the other one being the remote-host, on which synchronization will take place.
There are basically two ways in which rsync can copy/sync data:
Copying/syncing to/from another host over any remote shell like ssh, rsh.
Copying/Syncing through rsync daemon using TCP.
============================================
Server: (192.168.1.111)
# yum repolist
# rpm -qa | grep rsync
# yum install rsync -y
# rpm -qi rsync
# su – vikasnehra
# mkdir backup
# cd backup
# touch test{1..10}.txt
# mkdir -p /tmp/backup
# rsync –help
# rsync -v /home/vikasnehra/backup/* /tmp/backup/
# exit
# mkdir -p /backupsource/
# cd /backupsource/ ; touch test{1..10}.txt
CLIENT: (192.168.1.108)
# yum repolist
# rpm -qa | grep rsync
# yum install rsync -y
# mkdir -p /backupdestination/
Go To SERVER:
# rsync -av -e ssh /backupsource/ root@192.168.1.108:/backupdestination/
Go To CLIENT:
# cd /backupdestination/
# ls -lha
# rm -rf *
# ls -lha /root/.ssh/
# mkdir -p /root/.ssh/
# chmod 700 /root/.ssh/
# touch /root/.ssh/authorized_keys
# chmod 600 /root/.ssh/authorized_keys
Go To SERVER:
# ssh-keygen
# scp -r /root/.ssh/id_rsa.pub root@192.168.1.108:/root/.ssh/authorized_keys
# date
# crontab -e
25 20 * * * bash /root/backup.sh
# vim /root/backup.sh
!#/bin/bash
/usr/bin/rsync -av -e ssh /backupsource/ root@192.168.1.108:/backupdestination/
# crontab -l
# tail -f /var/log/cron
Go To CLIENT:
# ll /backupdestination/
===
Thanks for watching the video. If it helped you then, please do like & share it with others as well. Feel free to post your queries & suggestions, we will be glad to answer your queries.
If you like our hard work then do subscribe to our channel & turn on the bell notification for latest updates.
===
Our Some Popular Videos:
Yum Server RHEL 7:
DNF/Yum Server RHEL 8:
Puppet Configuration:
Startis File System in RHEL 8:
Concept of All RAID Levels:
Configure RAID-0 in Linux:
Configure RAID-1 in Linux:
Configure RAID-5 in Linux:
Configure RAID-6 in Linux:
Configure RAID-10 in Linux:
Migrate LVM:
LVM Snapshot:
===
Contact Us:
Vikas Nehra’s Twitter Handle:👇
http://bit.ly/VikasNehraTwitterHandle
Registration:👇
http://bit.ly/NehraClassesRegForm
Twitter Handle:👇
http://bit.ly/NehraClassesTwiiterHandle
Facebook Page:👇
www.facebook.com/nehraclasses
Instagram:👇
https://www.instagram.com/nehraclasses/
Webpage:👇
http://bit.ly/NehraClassesWebpage
Telegram Channel: 👇
https://t.me/NehraClasses
WhatsApp Us: 👇
https://bit.ly/2Kpqp5z
Email Us:👇
Email: nehraclasses@gmail.com
===
©COPYRIGHT. ALL RIGHTS RESERVED.
by Nehra Classes
linux ftp server
such a great video sir… very clear explanation… Thanks for sharing 🙂
hi am getting permission denied while giving command > rsync -av -e ssh……. what to do ?
Love it. How to do it in an Organisation when you have thousands of servers?
Thank you Nehra, great content, my friend!
hello sir , how to remove the files after transfer automatically from the source machine
Sir please tell me Hindi video
. You made it so elude.
Love the the way you make things simple..
Great video rsync cron and basic shell script combination was great. Extremely helpful for newbies
great !!
Sir how to stop this auto backup
How to back up file from Linux to windows machine using wsl need detailed steps 🙏
Thanks
dude has his own clothing line, epic. so many colors to choose from…
will you provide Linux Administration Training ? if Yes please share the contact number
very good explanation. easy to understand
Nice video.. Weldone, now remains to setup md5 checksum to confirm source and destination files, if not same.. To initiate synchronization again
sir like windows if our os is crashed, so we can recover files from c drive but in linux how we will do that
how to do this to upload to the cloud? automatically move files to the cloud
Hi sir how to delete old data after 5days
How to write in same script after backup and than delete old data which is last 5days
Please guide sir to crack Linux interview
Your video is great
awesome yaar . thanks ..
gt 🙂
hello sir, can i run this same in the ubuntu also?
If u want to unmount filesystem(LVM)like /, /var, /opt, /home, /tmp, /usr how u can do this unmount ? R u using single user mode for all /, /var,… etc. ?
If u want to unmount filesystem(Normal Partition)like /, /var, /opt, /home, /tmp, /usr how u can do this unmount ? R u using single user mode for all /, /var,… etc. ?
If u want to unmount filesystem(LVM)like /, /var, /opt, /home, /tmp, /usr how u can do this unmount ? R u using single user mode for all /, /var,… etc. ?
If u want to unmount filesystem(Noramal partition )like /, /var, /opt, /home, /tmp, /usr how u can do this unmount ? R u using single user mode for all /, /var,… etc. ?
Very nice explanation sir. And It is most important task in Any organization..
error showing : connection refused
Hello sir
Same process i have followed with Ubuntu 20 but did not run Crontab , i did not find rsync in usr/bin
Please help
Very good video
In actual industry is backup taken the same way
Hi Sir,
Could you please provide me with the knowledge on what is "migrating IP from old to new host" and what happens if we do this?
Thanks
Chandra
Crystal clear explanation Nehra g i wish u were in our organization ! Keep ur great work going
Great video and great insight into in depth knowledge of data backup, can we do the real time sync for any file changed and can be synced for backup possibilities. Also is it possible to make the versioning of files, same like they are in the Google backup utility?
Possible with mysql database.?
This can use to copy 10GB files to backup server everyday.?
Nice explanation sir
How to connect remote file path and copy those same at current location Linux machine
How to copy symlink files ? from a server to a pendrive ?