-   Linux - General (
-   -   rsync backup exclude directory discussion - from running OS on ext4 journaling part (

masuch 03-05-2012 04:53 PM

rsync backup exclude directory discussion - from running OS on ext4 journaling part

I would like to ask for propositions, recomendations which directory should be excluded if I am doing backup of the whole current running OS system by rsync on ext4 partition.

my current rsync backup script has following conformation:

rm -rf /home/${USER}/.local/share/Trash/info/*
rm -rf /home/${USER}/.local/share/Trash/files/*
sudo apt-get clean
sudo apt-get autoclean
time sudo rsync -a --force --hard-links --xattrs --sparse --numeric-ids --delete --delete-excluded --delete-after --progress
/ ${_destination}
--log-file=${_destination}--`date +%Y%m%d--%H-%M-%S`.log

Thank you for any recommendations ,suggestions.

P.S. I understand that it depends on installed applications but let's pretend that I have them installed :-)

weibullguy 03-06-2012 10:42 AM

This is the script I use to backup my $HOME directory. Rather than passing a long list of --exclude='s, I keep a file with a list of things to include and exclude. I back up to another machine in my basement running rsync as a server using cron. I think the list of files/directories is easier to manage than a grunch of --exclude='s.

masuch 03-06-2012 07:41 PM

Thanks a lot !

It is quite a lot of directories. Had/has to take systematic work.
(If you have some spare time you could please to share this exclude/include file (for example by dropbox) on internet to have its always fresh for public)


weibullguy 03-07-2012 09:05 AM

Not sure how helpful my include/exclude file will be for anyone else, but here it is.

masuch 03-08-2012 08:36 AM

I am using exclude directories to clean up linux operating system/s as well.
For backup by tar xz's files reduced from 30 Gbytes to 17 Gbytes.
For backup/chroot by rsync reduced about 20 Gbytes.

rng 03-08-2012 10:04 AM

What will be the commands to restore the system? Can the system be run at the distination drive?

masuch 03-08-2012 11:51 AM

I made clone by rsync of the whole / directory (excluding unnecessary dirs) to another ext4 partition.
Made some changes in /etc/hosts,hostname,fstab,gtags/htmake.conf and maybe some another config files and update-grub,
if update-grub did not succed put it in 40_custom file manually and that was all I did and it works. I used this clone of ubuntu OS just three times but without problems for now :-)
(what I have problem is use it on gpt(uefi) hard-disk/partition/s. Need more study how to properly install grub2 to avoid C/H/S error messages - it still does not work even manually created menuentry for grub2 config/s)

jlinkels 03-08-2012 04:07 PM

Why do so complicated? You are right that this is very clean, but if you omit the excludes, a few gigs more might be backed up. I don't worry about it, it is much more difficult to be sure that not too much s excluded.

These really have to be excluded:

If you want to restore your system, you should not exclude /dev!

If you want to clone, it might be a good idea to exclude some udev rules, like persistent_net_rules if your system has that. When you don't, usually the new system reserves eth0 or eth1 for the NIC in the other system and tries to make eth2 work.


All times are GMT -5. The time now is 01:52 PM.