Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm looking for a list which paths/files are safe to exclude for a full system/home backup.

Considering that I have a list of installed packages.

  • /home/*/.thumbnails
  • /home/*/.cache
  • /home/*/.mozilla/firefox/*.default/Cache
  • /home/*/.mozilla/firefox/*.default/OfflineCache
  • /home/*/.local/share/Trash
  • /home/*/.gvfs/

  • /tmp/

  • /var/tmp/
  • not real folders but can cause severe problems when 'restoring'
    • /dev
    • /proc
    • /sys

What about...

  • /var/ in general?
  • /var/backups/ - can get quite large
  • /var/log/ - does not require much space and can help for later comparison
  • /lost+found/
share|improve this question
    
This is an (very) related answer worth looking at (assuming this isn't closed as a duplicate) : askubuntu.com/questions/5596/how-to-clean-caches-in-my-homedir/… –  Scaine Mar 3 '11 at 21:44
add comment

2 Answers 2

up vote 18 down vote accepted

When I rsync my system to a backup partition, I exclude these:

--exclude=/dev/* \
--exclude=/home/*/.gvfs \
--exclude=/home/*/.mozilla/firefox/*/Cache \
--exclude=/home/*/.cache/chromium \
--exclude=/home/*/.thumbnails \
--exclude=/media/* \
--exclude=/mnt/* \
--exclude=/proc/* \
--exclude=/sys/* \
--exclude=/tmp/* \
--exclude=/home/*/.local/share/Trash \
--exclude=/etc/fstab \
--exclude=/var/run/* \
--exclude=/var/lock/* \
--exclude=/lib/modules/*/volatile/.mounted \
--exclude=/var/cache/apt/archives/* \

This way I am able to boot into the backup partition the same way I can boot to the original one.

So to sum up, I would suggest

  • not excluding /{dev,proc,media,...} themselves, just their contents

  • excluding /var/{run,lock}, and especially the big /var/cache/apt/archives/

share|improve this answer
1  
You want to exclude ALL of /dev. –  psusi Mar 1 '11 at 3:33
    
@psusi - Yes, you are right. I'm editing my post. Thanks. –  arrange Mar 3 '11 at 21:20
    
I would recommend using the -x option with rsync for backups. That way, it will not cross filesystem boundaries, which will exclude things like /dev /proc /sys /mnt and /media. You still have to exclude /home/*/.gvfs. –  Azendale Jul 7 '11 at 16:04
2  
@Azendale: might be. On the other hand, when you use something like --exclude=/proc/*, it will keep the directory /proc on the backup (which is needed if you want to boot the mirror), but not the contents of it. –  arrange Jul 8 '11 at 16:35
    
or Opera users , I would add --exclude=/home/*/.opera/cache as well :) –  Grzegorz Wierzowiecki Aug 13 '13 at 18:26
show 2 more comments

I'll recomend to exclude all /usr (except fort /usr/local/) and have a backup of dpkg --get-selections

In my opinion a Full backup isn't really usefull. I rather prefer backup data and preferences and then restore packages from the official repositories.

But is my preference...

/usr contains mainly static binary content from distribution packages. Reinstalling a package will restore /usr contents. Also /bin and /sbin contains binaries from distribution packages.

/usr/local contains manually installed packages (out of distribuition packages). so this is worth to backup.

share|improve this answer
    
Very interesting approach. It will yield a significantly smaller backup, but require way more trouble (time, internet bandwidth) when restoring. A compromise that may be worth in some use cases. Questions: how about /lib, the same applies? And how do you restore such package selection? –  MestreLion Apr 4 '13 at 11:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.