talk.tex 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. \documentclass{beamer}
  2. \usetheme{poul}
  3. \usepackage[utf8]{inputenc}
  4. \usepackage[svgpath=images/]{svg}
  5. %Information to be included in the title page:
  6. \title{Backup and (possibly) Restore}
  7. \author{Andrea Gussoni}
  8. \institute{P.O.u.L.}
  9. \date{23 Marzo 2017}
  10. \titlegraphic{\includesvg[height=1.5cm]{logowhite}}
  11. \begin{document}
  12. \frame{\titlepage}
  13. \begin{frame}
  14. \frametitle{Why do we need backups?}
  15. Bad things can happen and do happen:
  16. \begin{itemize}
  17. \item You may drop your computer accidentally.
  18. \item The disk may be damaged by vibrations during the daily train commute.
  19. \item The computer where you keep the unique copy of your thesis
  20. may be stolen.
  21. \item Or after some time it may simply age and stop operating.
  22. \end{itemize}
  23. \end{frame}
  24. \begin{frame}
  25. \frametitle{What are backups?}
  26. \begin{block}{Definition}
  27. The copying and archiving of computer data so that it may be
  28. used to restore the original after a data loss event.
  29. \end{block}
  30. \end{frame}
  31. \begin{frame}
  32. \frametitle{What to backup?}
  33. It is important to distinguish what it is necessary to backup from what
  34. it is not.\\
  35. Obviously this depends on the setup that you are using (native services, containers, VMs etc...)
  36. \end{frame}
  37. \begin{frame}
  38. \frametitle{A general guideline}
  39. Must:
  40. \begin{itemize}
  41. \item /home
  42. \end{itemize}
  43. \vfill
  44. At your discretion:
  45. \begin{itemize}
  46. \item /etc
  47. \item /var
  48. \end{itemize}
  49. \vfill
  50. Not necessary\footnote{if these folders contain something important probably you are doing something wrong in your setup}:
  51. \begin{itemize}
  52. \item /proc /sys /tmp
  53. \item /dev /mnt /media
  54. \end{itemize}
  55. \end{frame}
  56. \begin{frame}
  57. \frametitle{Backup types}
  58. Backups can be:
  59. \begin{itemize}
  60. \item \textbf{full}: a complete backup of a all files and folder starting from a root node.
  61. \item \textbf{incremental}: contains all the differences since the last incremental backup.
  62. \item \textbf{differential} contains the changes since the last full backup.
  63. \end{itemize}
  64. \end{frame}
  65. \begin{frame}
  66. \frametitle{Backup Support}
  67. \begin{itemize}
  68. \item Hard disks (HDD).
  69. \item Solid-State drives (SSD).
  70. \item Optical supports: DVDs, Blu-ray.
  71. \item Flash Drives.
  72. \item Cloud\footnote{Remember that there is no cloud, just other people's computers.}.
  73. \end{itemize}
  74. \end{frame}
  75. \begin{frame}
  76. \frametitle{dd}
  77. \textbf{dd} is a powerful tool that basically can copy everything that is a file or a block device. It is common to use it for disk cloning.\\
  78. Usage example:
  79. \begin{itemize}
  80. \item \textit{dd if=/dev/sdX of=/dev/sdY \&\& sync\footnote{useful to actually wait the end of data transfer and avoid corrupted copies}}
  81. \begin{itemize}
  82. \item \textbf{if:} input file/device
  83. \item \textbf{out:} output file/device
  84. \end{itemize}
  85. \end{itemize}
  86. \vfill
  87. \begin{alertblock}{Caution}
  88. Since \textbf{dd} often requires \textit{sudo} privileges to run, if you mismatch the name of a device you can actually wipe the content of your primary hard disk, double check always the arguments before pressing enter.
  89. \end{alertblock}
  90. \end{frame}
  91. \begin{frame}
  92. \frametitle{GNU ddrescue}
  93. gdrescue is an enhanced version of dd that tries to rescue good parts in case of read errors. It may be usefull to recover data from a drive with some damaged sector.\\
  94. Usage Example:
  95. \begin{itemize}
  96. \item \textit{ddrescue [options] /dev/sdX outfile mapfile}
  97. \begin{itemize}
  98. \item \textbf{mapfile:} a human readable text file ddrescue uses to manage the copy
  99. \end{itemize}
  100. \end{itemize}
  101. \begin{alertblock}{Caution}
  102. For the rescued data to be correct, both dd and gddrescue are best used on unmounted devices.
  103. \end{alertblock}
  104. \begin{block}{Tip}
  105. gddrescue can also be useful when trying to reallocate sectors on a drive with a few sector unreadable. Doing a wipe of the drive with gddrescue should reallocate bad sectors.
  106. \end{block}
  107. \end{frame}
  108. \begin{frame}
  109. \frametitle{rsync}
  110. Also known as an advanced version of cp
  111. \begin{exampleblock}{Pros}
  112. \begin{itemize}
  113. \item (unlike cp) preserves hard and symbloic links, file permissions and ownerships, modification times, etc.
  114. \item designed to be network efficient because only transfers file changes.
  115. \item easy to use.
  116. \end{itemize}
  117. \end{exampleblock}
  118. \begin{alertblock}{Cons}
  119. \begin{itemize}
  120. \item no storage encryption.
  121. \end{itemize}
  122. \end{alertblock}
  123. \end{frame}
  124. \begin{frame}
  125. \frametitle{rsync: usage}
  126. \begin{itemize}
  127. \item rsync -Pr source destination
  128. \begin{itemize}
  129. \item \textbf{P:} keep partially transferred files if the transfer is interrupted.
  130. \item \textbf{r:} recursive directory option
  131. \end{itemize}
  132. \vfill
  133. \item rsync source host:destination\footnote{But please don't do this \textit{rsync -av --delete source host:$\sim$/}}
  134. \begin{itemize}
  135. \item uses ssh by default, but can also be forced with the -e ssh option.
  136. \end{itemize}
  137. \vfill
  138. \item rsync -aAXv --exclude={...} /* /backup folder
  139. \begin{itemize}
  140. \item backup /* while following symlinks and preserving file properties.
  141. \end{itemize}
  142. \end{itemize}
  143. \end{frame}
  144. \begin{frame}
  145. \frametitle{rsnapshot: rsync automated}
  146. rsnapshot produces automated, periodical system snapshots
  147. \vfill
  148. \begin{exampleblock}{Pros}
  149. \begin{itemize}
  150. \item preserves hard and symbolic links, file permissions and ownership, modification times, etc.
  151. \item network efficient.
  152. \item each snapshot contains a full system backup.
  153. \item easy to use.
  154. \end{itemize}
  155. \end{exampleblock}
  156. \vfill
  157. \begin{alertblock}{Cons}
  158. \begin{itemize}
  159. \item no storage encryption.
  160. \end{itemize}
  161. \end{alertblock}
  162. \end{frame}
  163. \begin{frame}
  164. \frametitle{duplicity}
  165. duplicity produces encrypted, incremental backups in tar format.
  166. \begin{exampleblock}{Pros}
  167. \begin{itemize}
  168. \item preserves hard and symbolic links, file permissions and ownership, modification times, etc.
  169. \item network efficient.
  170. \item incremental backups.
  171. \item supports storage encryption with gpg.
  172. \item easy to use.
  173. \end{itemize}
  174. \end{exampleblock}
  175. \end{frame}
  176. \begin{frame}
  177. \frametitle{duplicity: usage}
  178. \begin{itemize}
  179. \item duplicity /home/user scp::/user@host//backup/directory
  180. \vfill
  181. \item duplicity [restore] scp://user@host//backup/directory /home/user
  182. \vfill
  183. \item duplicity full /home/user scp::/user@host//backup/directory
  184. \end{itemize}
  185. \end{frame}
  186. \begin{frame}
  187. \frametitle{duplicity: usage}
  188. \begin{itemize}
  189. \item duplicity list-current-files scp::/user@host//backup/directory
  190. \begin{itemize}
  191. \item list the files contained in the backup.
  192. \end{itemize}
  193. \vfill
  194. \item duplicity [restore] -t 3D scp://user@host//backup/directory /home/user
  195. \begin{itemize}
  196. \item specify the time from which to restore files.
  197. \end{itemize}
  198. \vfill
  199. \item duplicity remove-older-than 30D scp::/user@host//backup/directory
  200. \begin{itemize}
  201. \item remove from the backup full backups older than the specified period.
  202. \end{itemize}
  203. \end{itemize}
  204. \end{frame}
  205. \begin{frame}
  206. \end{frame}
  207. \begin{frame}
  208. \end{frame}
  209. \begin{frame}
  210. \end{frame}
  211. \begin{frame}
  212. \end{frame}
  213. \begin{frame}
  214. \frametitle{License}
  215. \begin{center}
  216. {\large Thank you!}
  217. \vfill
  218. \includesvg[height=1.5cm]{by-sa}\\
  219. {\footnotesize These slides are published under a Creative Commons Attribution-ShareAlike 4.0 license.}
  220. \end{center}
  221. \end{frame}
  222. \end{document}