Backup and Restore Your Linux System with rsync

preview_player
Показать описание
From this video you will learn how to backup your whole Linux system and how to restore it back if something bad happens to it.

The command you need is this one:

sudo rsync -aAXv --delete --exclude=/dev/* --exclude=/proc/* --exclude=/sys/* --exclude=/tmp/* --exclude=/run/* --exclude=/mnt/* --exclude=/media/* --exclude="swapfile" --exclude="lost+found" --exclude=".cache" --exclude="Downloads" --exclude=".VirtualBoxVMs" --exclude=".ecryptfs" /source /destination

You can also add the option --dry-run to simulate the backup process.

The command to restore your system is shorter:

sudo rsync -aAXv --delete --exclude="lost+found" /backup /system

To see more options run:

rsync --help

################################################

################################################

More cool Linux stuff at other social media:

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

You can also unite all exclude options with --exclude={/dev/*, /proc/*, /sys/*, /tmp/*, /run/*, /mnt/*, /media/*, /home/*, /lost+found}. But make sure you cd to root (cd /) before you run rsync, otherwise the joint exclude option may not work.
PS. Thanks to MoreChannelNoise for this tip. The comment is below.

AverageLinuxUser
Автор

Another marvellous video, ALU! I am learning more from you in a couple of months than I have ever learned before! Keep up the wonderful work ;) !

pyotrleflegin
Автор

Thanks for a great & informative video. Also Thanks for being a total asset to the Linux community!!!

avrtony
Автор

Really great video as always, I've watched your Arch Installation video like 15 times and finally put Arch to metal first try without issue.

devonnewsom
Автор

Dear ALU, I have only one word for your videos. AWESOME!

Thank you for your work, it helps a lot.

hernesc
Автор

That dry run option was very smart ! I did not know such a command existed.... Thanks for sharing !!

sudipchatterjee
Автор

Wow just yesterday I backedup my home folder to USB harddisk using Grsync. I will suggest Grsync, its just a frontend to rsync and people who are not comfortable with command line will find it useful. Thank you for sharing.

petslittleworld
Автор

I really liked waht you showed us. I learned a lot. I am slowly getting into Linux, and people (like you) make it easier for the Noobs (like me) to start feeling confident and make switch from Windows.

PoeLemic
Автор

well this video covers all that needs to be mention. it helps me a lot! thank you!!!

yt_gucker
Автор

I found this very helpful. Adding from experience using this method on Raspberry Pi, rysnc is the best for backing up data. However, installed software may not work correctly. I had problems with something as simple as web browser (chromium) after system restore by this method. I have ended up using rsync to backup data (files incl. code, images, etc.) and the SD card copier on the Pi for cloning the entire system including installed software. The installed software works correctly by this method. Thanks.

sanjaybhatikar
Автор

thank you for sharing this. using it to backup both systems and documents.

sankarasubbaiyer
Автор

Great video. Just to say you can combine all your excludes in one line like this:
sudo rsync -aAXvh --progress --delete --exclude={".cache", "/dev/*", "/proc/*", "/sys/*", "/tmp/*", "/run/*", "/mnt/*", "/media/*", "/lost+found"}

illusion
Автор

According to the man page, "--delete" actually deletes extraneous files and directories from the destination. I think this means that it deletes all files that aren't in the source. Just to clarify this, because the explanation given in the video sounds (to me), like that option only transfers the files that are missing in the destination, which is the default behavior for rsync.

edsanville
Автор

thank you for all your videos. they are all very clear and extremely informative. cheers!

brennanlabs
Автор

It took me three weeks to figure this out lol. I tried to backup with rsync to my external SSD that is formatted as a fat file system. I came here and I simply copy pasted your commands. I searched the resulting error codes on the internet for days until I realized I just have the wrong file system.
Linux can be hard if you're not paying attention :D
Thank you for this video!

AndreyPeychev
Автор

Thanks! It was very clear and easy to understand.

nileshk
Автор

Thank you for the great video, it's still relevant in 2022 for ext4 users

AshRinNice
Автор

Чув, твій сайт -- це просто бімба, дякую!

drewberchtolzthofen
Автор

Much appreciated. Keep up the nice work!

LeonardoCaldasxlx
Автор

Thank you, again!
Now, when I have finished watching your guide I can say: people could really benefit from using this lifesaving guide!
Personally, I would like to see a guide showing how to transition my existing Ubuntu-based system to a ZFS volume.
So not only the data HDDs but my OS which is written on nvme SSD are being bulletproofed by using the numerous benefits of the ZFS on Linux.

trubadyr