Rsync home
Indice
Abstract
Prima di qualunque attività importante, un MUST è salvare i dati. Io ho usato questa tecnica per il cambio di hard disk del mio portatile, ma il motivo per farlo sono molti e un "backup" non ha bisogno di buoni motivi per essere fatto :-)
Strumenti
Esistono molti tool per fare salvataggio. Per questo esercizio ho usato rsync che per mette di "mantenere" aggiornata una copia di backup. rsync infatti sincronizza 2 cartelle (la sorgente con la destinazione) attraverso una fase di controllo e di copia.
Locale
Se avete un disco esterno, una chiavetta usb o qualunque altra device locale, potete usarla come destinazione del salvataggio
un semplice
df -H
mostrerà le periferiche e come il sistema le vede (mount) ipotizziamo che la periferica sia montata come
/media/$USER/linuxbackup/
($USER andrà sostituito con l'utente owner)
bene l'obbiettivo sarà salvare il contenuto di
/home/$USER
in una cartella (home ad esempio), nel percorso
/media/$USER/linuxbackup/home
Copiare tutto o solo cio che ci server
Al netto che copiare tutto non è un errore, vi sono cose che non ha senso copiare e addirittura altre che è preferibile non copiare.
Per fare una copia selettiva ci viene incontro la direttiva :
da man rsync:
--exclude-from=FILE read exclude patterns from FILE
This option is related to the --exclude option, but it specifies
a FILE that contains exclude patterns (one per line). Blank
lines in the file and lines starting with ’;’ or ’#’ are
ignored. If FILE is -, the list will be read from standard
input.
possiamo dargli un path di directory da escludere.
Esempio di file exclude
# rsync-homedir-excludes # # A list of files to exclude when backing up *nix home directories using rsync. # # Author: Ruben Barkow <https://github.com/rubo77/rsync-homedir-excludes> # Version: 2015-08-30 # directories, probably not worth a backup: #Downloads #games #VirtualBox* #.vagrant #.vagrant.d #.android #.AndroidStudioBeta #.gradle #.gvm #.grails/ #.grails_history #.local/share/notbit/ #.wine # games #.minecraft #.PlayOnLinux #.local/share/Steam/ #These directories may be excluded: # contains mounted file systems .gvfs .local/share/gvfs-metadata # contains the actual encrypted home directory .Private # session-specific .dbus .cache .Trash .local/share/Trash # cached info about audio CDs .cddb # cached packages lists .aptitude
#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 # recently used files .recently-used .recently-used.xbel .thumbnails # session-specific .Xauthority .ICEauthority .gksu.lock .pulse # directory .pulse-cookie .esd_auth #KDE specific: # Recent documents on KDE .kde/share/apps/RecentDocuments # Contains a history of the Klipper clipboard (KDE) .kde/share/apps/klipper # you will loose saved scrolling positions of PDFs .kde/share/apps/okular/docdata .kde/share/apps/gwenview/recentfolders # cached other users' profile pics .kde/share/apps/kmess/displaypics # cached emoticons of others .kde/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 #GnuPG: .gnupg/rnd .gnupg/random_seed .gnupg/.#* .gnupg/*.lock .gnupg/gpg-agent-info-* #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