LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 03-05-2012, 03:53 PM   #1
masuch
Member
 
Registered: Sep 2011
Location: /dev/null
Distribution: ubuntu 64bits
Posts: 129

Rep: Reputation: Disabled
Question rsync backup exclude directory discussion - from running OS on ext4 journaling part


Hi,

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
sync
time sudo rsync -a --force --hard-links --xattrs --sparse --numeric-ids --delete --delete-excluded --delete-after --progress
--exclude="/var/lib/netmrg/Maildir/new/**"
--exclude="/var/lib/i2p/i2p-config/peerProfiles/**"
--exclude="/var/lib/clamav/Maildir/new/**"
--exclude="/root/Maildir/new/**"
--exclude="/home/$USER/.VirtualBox/**"
--exclude="/home/$USER/.mozilla/firefox/62vtqtf7.9.0.1-32bit/Cache/**"
--exclude="/home/$USER/.mozilla/firefox/4z75xyzh.default/Cache/**"
--exclude="/home/$USER/.mozilla/firefox/1f33wc1i.nightly-build/Cache/**"
--exclude="/home/$USER/.cache/**"
--exclude="/home/$USER/.thumbnails/**"
--exclude="/home/$USER/.gvfs"
--exclude="/media/**"
--exclude="/mnt/**"
--exclude="/proc/**"
--exclude="/tmp/**"
--exclude="/run/**"
--exclude="/cdrom/**"
--exclude="/dev/**"
--exclude="/build/**"
--exclude="/lost+found/**"
--exclude="/sys/**"
--exclude="/var/cache/**"
--exclude="/var/backup/**"
--exclude="/var/backups/**"
--exclude="/var/crash/**"
--exclude="/var/log/**"
--exclude="/var/tmp/**"
--exclude="/var/webmin/**"
--exclude="/var/www/**"
--exclude="/var/lib/i2p/i2p-config/netDb/**"
--exclude="/opt/avg/avg8/var/run/**"
/ ${_destination}
--log-file=${_destination}--`date +%Y%m%d--%H-%M-%S`.log


Thank you for any recommendations ,suggestions.
Regards,
Martin.

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

Last edited by masuch; 03-05-2012 at 03:56 PM.
 
Old 03-06-2012, 09:42 AM   #2
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware-current, Cross Linux from Scratch, Gentoo
Posts: 2,692
Blog Entries: 1

Rep: Reputation: 217Reputation: 217Reputation: 217
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.
 
Old 03-06-2012, 06:41 PM   #3
masuch
Member
 
Registered: Sep 2011
Location: /dev/null
Distribution: ubuntu 64bits
Posts: 129

Original Poster
Rep: Reputation: Disabled
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)

Regards,
M.
 
Old 03-07-2012, 08:05 AM   #4
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware-current, Cross Linux from Scratch, Gentoo
Posts: 2,692
Blog Entries: 1

Rep: Reputation: 217Reputation: 217Reputation: 217
Not sure how helpful my include/exclude file will be for anyone else, but here it is.
 
Old 03-08-2012, 07:36 AM   #5
masuch
Member
 
Registered: Sep 2011
Location: /dev/null
Distribution: ubuntu 64bits
Posts: 129

Original Poster
Rep: Reputation: Disabled
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.

Last edited by masuch; 03-08-2012 at 07:43 AM. Reason: edit wrong info
 
Old 03-08-2012, 09:04 AM   #6
rng
Member
 
Registered: Aug 2011
Posts: 746

Rep: Reputation: 23
What will be the commands to restore the system? Can the system be run at the distination drive?
 
Old 03-08-2012, 10:51 AM   #7
masuch
Member
 
Registered: Sep 2011
Location: /dev/null
Distribution: ubuntu 64bits
Posts: 129

Original Poster
Rep: Reputation: Disabled
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)
 
Old 03-08-2012, 03:07 PM   #8
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 4,052

Rep: Reputation: 484Reputation: 484Reputation: 484Reputation: 484Reputation: 484
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:
/mnt
/proc
/sys

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.

jlinkels
 
  


Reply

Tags
backup, directory, exclude, ext4, rsync


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Old file system discovered after disabling ext4 journaling k14 Linux - General 6 05-13-2011 07:36 AM
[SOLVED] Rsync exclude a directory with all subdirectories and files Slackovado Slackware 1 12-26-2010 11:40 PM
Improving MetaData Performance of the Ext4 Journaling Device DragonSlayer48DX Linux - News 0 01-06-2010 08:34 PM
How to exclude specific directories from an rsync backup kaplan71 Linux - Software 2 05-16-2008 12:09 PM
Solving RSYNC's rather poor directory-exclude ability? hockeyrink Linux - Software 4 08-18-2006 03:11 PM


All times are GMT -5. The time now is 03:46 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration