可以从主目录的备份中排除哪些文件和目录?


41

Duplicity在进行高效备份方面已经做得很好,但是我仍要尽量减少要备份的文件数量。

主目录中可以排除哪些文件或目录?请明确命名这些名称,允许使用通配符,路径是相对于主目录的。


好问题!我发现使用“磁盘使用状况分析器”分析主目录(我备份的目录)非常有用,并确保忽略顶部显示的所有内容,并且在数据丢失的情况下也不会丢失。例如,我对备份src包含在线可用源代码的本地副本的目录不感兴趣。
joelpet

Answers:


38

如果缺少这些文件和目录,大多数将重新创建。它们主要用于减少应用程序(Firefox扩展缓存)的启动时间,指示锁(.gksu.lock)或包含特定于会话的信息(例如dbus会话的ID)。最近的文档经常更改,因此备份通常不那么明智。

这些目录可能被排除在外:

.gvfs                           # contains mounted file systems?
.local/share/gvfs-metadata
.Private                        # contains the actual encrypted home directory
.dbus                           # session-specific
.cache
.Trash                          # do I need to say more?
.local/share/Trash
.cddb                           # cached info about audio CDs
.aptitude                       # cached packages lists

特定于Flash:

.adobe        # Cache for flash, maybe others?
.macromedia   # except for Flash persistence, there is no reason to keep this

档案:

.xsession-errors            # contains errors from the current graphical session
.recently-used              # recently used files
.recently-used.xbel
.thumbnails
.Xauthority                 # session-specific
.ICEauthority
.gksu.lock
.pulse                      # directory
.pulse-cookie
.esd_auth

特定于KDE:

.kde/share/apps/RecentDocuments # Recent documents on KDE
.kde/share/apps/klipper         # Contains a history of the Klipper clipboard (KDE)
.kde/share/apps/okular/docdata  # you will loose saved scrolling positions of PDFs
.kde/share/apps/gwenview/recentfolders
.kde/share/apps/kmess/displaypics  # cached other users' profile pics
.kde/share/apps/kmess/customemoticons  # cached emoticons of others

特定于Firefox(另请参阅Profile文件夹):

.mozilla/firefox/*/Cache
.mozilla/firefox/*/minidumps    # in case Fx crashes dumps will be stored in this
.mozilla/firefox/*/.parentlock       # session-specific           
.mozilla/firefox/*/urlclassifier3.sqlite  # phishing database, recreated
.mozilla/firefox/*/blocklist.xml   # blacklisted extensions
.mozilla/firefox/*/extensions.sqlite  # extension database, recreated on startup
.mozilla/firefox/*/extensions.sqlite-journal
.mozilla/firefox/*/extensions.rdf
.mozilla/firefox/*/extensions.ini
.mozilla/firefox/*/extensions.cache
.mozilla/firefox/*/XUL.mfasl     # cached UI data, recreated
.mozilla/firefox/*/XPC.mfasl
.mozilla/firefox/*/xpti.dat
.mozilla/firefox/*/compreg.dat

特定于Opera的文件(有关Superuser.com的相关问题:是否可以在Opera配置文件文件夹中的文件和目录上找到文档?):

.opera/temporary_downloads
.opera/cache
.opera/thumbnails
.opera/opcache
.opera/icons
.opera/application_cache
.opera/widgets/*/cache
.opera/lock

科莫多编辑

.komodoedit/*/codeintel/db
.komodoedit/*/host-*/*/codeintel
.komodoedit/*/XRE/Cache
.komodoedit/*/XRE/.activatestate/komodo edit/Crash Reports
.komodoedit/*/XRE/.activatestate/komodo edit/*/Cache
.komodoedit/*/XRE/.activatestate/komodo edit/*/minidump
.komodoedit/*/XRE/.parentlock
.komodoedit/*/XRE/extensions.rdf
.komodoedit/*/XRE/extensions.ini
.komodoedit/*/XRE/extensions.cache
.komodoedit/*/XRE/XPC.mfasl
.komodoedit/*/XRE/XUL.mfasl
.komodoedit/*/XRE/xpti.dat
.komodoedit/*/XRE/pluginreg.dat
.komodoedit/*/XRE/compreg.dat
.komodoedit/*/XRE/*.sqlite-journal
.komodoedit/*/pystdout.log
.komodoedit/*/pystderr.log
.komodoedit/*/history.sqlite.bak
.komodoedit/*/running.lock
.komodoedit/*/mutex.lock
.komodoedit/*/*.xmlc
.komodoedit/*/startup-env.tmp
.komoeoedit/*/commandments.fifo
.komoeoedit/*/history.sqlite

GnuPG:

.gnupg/rnd
.gnupg/random_seed
.gnupg/.#*
.gnupg/*.lock
.gnupg/gpg-agent-info-*

谷歌浏览器:

.config/google-chrome/Default/Local Storage
.config/google-chrome/Default/Session Storage
.config/google-chrome/Default/Application Cache
.config/google-chrome/Default/History Index *

其他应用:

.pulse/icons                  # Pidgin
.java/deployment/cache        # Cached applets
.icedteaplugin
.icedtea
.gnome2/epiphany/favicon_cache
.dropbox                      # to avoid problems, let Dropbox re-create these
.dropbox-dist

@ rubo77此要点不再起作用。
justfortherec

奇怪,原链路不工作,当你直接调用它,但它与git.io缩短服务的工作原理:你可以从我的下载ignorelist 要点wget http://git.io/vmQZ2 -O /var/tmp/ignorelist随后开始用rsync的rsync -a --progress --exclude-from=/var/tmp/ignorelist /home/$USER/ /media/$USER/linuxbackup/home/askubuntu.com/a/545676/34298
rubo77

HEAD和master都不起作用,但是此链接有效:wget https://gist.githubusercontent.com/rubo77/8ffaadbc58ab099d2bc3/raw/ignorelist
Lekensteyn

10

好问题。我喜欢这些-我们可以在其中收集社区意见/列表,并从中挑选相关内容。这是我的.exclude档案。我将此文件作为多个脚本中的参数提供给rsync--exclude-file=(也可以使用duplicity进行处理)。请注意,该问题暗示“您想要/需要保存什么”。例如,我备份了完整的.mozillaDIR,因为它包含多个配置文件和调整项,并且更容易将其转储到整个磁盘上。我的配置中也暗示:我做了很多“从头开始安装”来进行测试。因此,我具有一个已知良好安装基础的clonezilla映像,并且将我的个人(/ home)数据添加到磁盘上之后,将其存储在USB中;有时是选择性的,有时是整体的。

# Filename: admin/dotfiles/exclude
# Create Date: 20110307-23:36HRS
# ln -s admin/dotfiles/exclude ~/.exclude

.cache
.adobe
.aptitude
.compiz # no settings here; processes
.dbus
.dropbox # don't try to restore and reinitialize either of
.dropbox-dist # these DIRs; very messy results can happen
.elegant-gnome-backup
.fontconfig
.gnome2_private # MT; at least on my system
.pulse*
.gconfd
.gvfs
.macromedia
.local/share/Trash/
.thumbnails
Downloads/
Dropbox/ # recreated on re-initialization
Public/
Music/
Templates/ # stored on U1
Ubuntu One/ # recreated on re-initialization
wdir/iso/
wdir/backups/

如果我通过DejaDup使用双重性,也有这样的文件吗?(从Ubuntu 16.04开始,没有~/.exclude像我这样的DejaDup用户)
Frank Nocke

2

我在https://github.com/rubo77/rsync-homedir-excludes创建了一个ignorelist

您可以将其与Duplicity或rsync一起使用,例如:

rsync -aP --exclude-from=rsync-homedir-excludes.txt /home/$USER/ /media/$USER/linuxbackup/home/$USER/

我们会定期更新此信息,到目前为止:

################################################
# These directories may definitely be excluded #
################################################

# Contains mounted file systems:

.gvfs
.local/share/gvfs-metadata
# contains the actual encrypted home directory
/.Private

# Session-specific:
/.dbus
/.cache
/.Trash
.Trash-1*
.local/share/Trash
/Trash

# Cached info about audio CDs:
.cddb

# Cached packages lists:
.aptitude

# Node Package Manager cache
.npm

#Flash-specific:

# Cache for flash, maybe others?
.adobe
# except for Flash persistence, there is no reason to keep this
.macromedia

#Files:

# Contains errors from the current graphical session
.xsession-errors
.wayland-errors

# Recently used files
.local/share/RecentDocuments
.recently-used
.recently-used.xbel
.thumbnails
.thumb
Thumbs.db
.DS_Store
.localised
.bash_history
.CFUserTextEncoding

# Common Unix Printing System
/.cups

# run-time configuration information for Subversion
/.subversion

# Python virtual environments
/.virtualenvs

# Session-specific
.Xauthority
.ICEauthority
.gksu.lock
.pulse
.pulse-cookie
.esd_auth

#KDE specific:

# Recent documents on KDE
.kde/share/apps/RecentDocuments
.kde4/share/apps/RecentDocuments
# Contains a history of the Klipper clipboard (KDE)
.kde/share/apps/klipper
.kde4/share/apps/klipper
# You will loose saved scrolling positions of PDFs
.kde/share/apps/okular/docdata
.kde/share/apps/gwenview/recentfolders
.kde4/share/apps/okular/docdata
.kde4/share/apps/gwenview/recentfolders
# Cached other users' profile pics
.kde/share/apps/kmess/displaypics
.kde4/share/apps/kmess/displaypics
# Cached emoticons of others
.kde/share/apps/kmess/customemoticons
.kde4/share/apps/kmess/customemoticons

#Firefox-specific (see also Profile folder):

.mozilla/firefox/*/Cache
# in case Fx crashes dumps will be stored in this
.mozilla/firefox/*/minidumps
# session-specific 
.mozilla/firefox/*/.parentlock
# phishing database, recreated
.mozilla/firefox/*/urlclassifier3.sqlite
# blacklisted extensions
.mozilla/firefox/*/blocklist.xml
# extension database, recreated on startup
.mozilla/firefox/*/extensions.sqlite
.mozilla/firefox/*/extensions.sqlite-journal
.mozilla/firefox/*/extensions.rdf
.mozilla/firefox/*/extensions.ini
.mozilla/firefox/*/extensions.cache
# cached UI data, recreated
.mozilla/firefox/*/XUL.mfasl
.mozilla/firefox/*/XPC.mfasl
.mozilla/firefox/*/xpti.dat
.mozilla/firefox/*/compreg.dat
# cached plugin data, recreated
.mozilla/firefox/*/pluginreg.dat

#SeaMonkey-specific (see also Profile folder):

.mozilla/seamonkey/*/Cache
# in case Fx crashes dumps will be stored in this
.mozilla/seamonkey/*/minidumps
# session-specific 
.mozilla/seamonkey/*/.parentlock
# blacklisted extensions
.mozilla/seamonkey/*/blocklist.xml
# extension database, recreated on startup
.mozilla/seamonkey/*/extensions.sqlite
.mozilla/seamonkey/*/extensions.rdf
.mozilla/seamonkey/*/extensions.ini
# cached UI data, recreated
.mozilla/seamonkey/*/xpti.dat
.mozilla/seamonkey/*/compreg.dat
# cached plugin data, recreated
.mozilla/seamonkey/*/pluginreg.dat

# Thunderbird Cache in your profile folder
.thunderbird/*/Cache

#Opera-specific (related question on Superuser.com: Is documentation available on files and directories in the Opera profile folder?):

.opera/temporary_downloads
.opera/cache
.opera/thumbnails
.opera/opcache
.opera/icons
.opera/application_cache
.opera/widgets/*/cache
.opera/lock

# Keychain dir (manage SSH and GPG keys, front-end to ssh-agent and ssh-add)
/.keychain

#Komodo Edit:

.komodoedit/*/codeintel/db
.komodoedit/*/host-*/*/codeintel
.komodoedit/*/XRE/Cache
.komodoedit/*/XRE/.activatestate/komodo edit/Crash Reports
.komodoedit/*/XRE/.activatestate/komodo edit/*/Cache
.komodoedit/*/XRE/.activatestate/komodo edit/*/minidump
.komodoedit/*/XRE/.parentlock
.komodoedit/*/XRE/extensions.rdf
.komodoedit/*/XRE/extensions.ini
.komodoedit/*/XRE/extensions.cache
.komodoedit/*/XRE/XPC.mfasl
.komodoedit/*/XRE/XUL.mfasl
.komodoedit/*/XRE/xpti.dat
.komodoedit/*/XRE/pluginreg.dat
.komodoedit/*/XRE/compreg.dat
.komodoedit/*/XRE/*.sqlite-journal
.komodoedit/*/pystdout.log
.komodoedit/*/pystderr.log
.komodoedit/*/history.sqlite.bak
.komodoedit/*/running.lock
.komodoedit/*/mutex.lock
.komodoedit/*/*.xmlc
.komodoedit/*/startup-env.tmp
.komoeoedit/*/commandments.fifo
.komoeoedit/*/history.sqlite

#GnuPG:

.gnupg/rnd
.gnupg/random_seed
.gnupg/.#*
.gnupg/*.lock
.gnupg/gpg-agent-info-*

#Google Chrome:

.config/google-chrome/Default/Local Storage
.config/google-chrome/Default/Session Storage
.config/google-chrome/Default/Application Cache
.config/google-chrome/Default/History Index *

#Chromium:

.config/chromium/Default/Local Storage
.config/chromium/Default/Session Storage
.config/chromium/Default/Application Cache
.config/chromium/Default/History Index *

#Local repositories (added by errantlinguist on 2015-04-13):
.gradle/caches
/.m2/repository

#indexer
.local/share/baloo
.local/share/zeitgeist
.local/share/akonadi

#Other apps:

# Pidgin
.pulse/icons
# Cached applets
.guayadeque/cache.db
.java/deployment/cache
.icedteaplugin
.icedtea
.gnome2/epiphany/favicon_cache

# other temporary files 
nohup.out

###############################################
# directories, probably not worth a backup    #
# (uncomment the files you don't need)        #
###############################################

#.android
#.AndroidStudio*/
#Android/Sdk
#.gradle
#.gvm
#.grails/
#.grails_history
#.kde/share/apps/nepomuk
#.local/share/notbit
#.local/libvirt
#.vagrant
#.vagrant.d
#.wine
#.twister
#/twister
#Applications/eclipse*
#/Downloads
#*Popcorntime*
#/Scribus
#/VirtualBox*
#
## Add Game Folders here:
#
#/games
#.local/share/Steam
#.steam
#Steam
#.minecraft
#.PlayOnLinux

-1

我最近一直在考虑做这种事情,并且我注意到我不想备份的主目录中的许多文件似乎都没有设置组权限。如果在其他系统上也是如此,则可以使用以下方法获得可能的可疑对象列表:

find ~ -not -perm -g+r

(尽管检查了输出,因为尽管我的邮件看上去大部分都不错,但是我的电子邮件收件箱也出现在列表上,我不知道它对其他人的作用如何。)

这对我特别有吸引力,因为我的主目录是加密的(包括文件名),因此手动排除列表将是PITA,而我应该能够使用组权限自动生成排除列表。

(我知道线程很旧,但是我认为这可能对某人有用。)


2
文件的权限是确定是否需要文件的错误指导。例如,私有SSH密钥应具有限制性权限,但是您一定要备份它们。
Lekensteyn

权限不旨在用作备份标志。您可能有很多很好的理由来设置文件和目录的自定义权限,并且您的方法可能会破坏某些东西。如果您真的不喜欢排除列表(为什么?),请使用ext3和ect4文件系统的dump / nodump标志将文件标记为备份/不备份。该标志正是为此目的而设计的。参见cyberciti.biz/faq/…–盖洛斯
Gerlos)
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.