|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | +<head> |
| 4 | +<meta charset="UTF-8"> |
| 5 | + |
| 6 | +<style> |
| 7 | +body { |
| 8 | + font-family: Arial, sans-serif; |
| 9 | + margin: 20px; |
| 10 | + line-height: 1.6; |
| 11 | + background: #ffffff; |
| 12 | + color: #111; |
| 13 | +} |
| 14 | + |
| 15 | +h1 { |
| 16 | + border-bottom: 2px solid #ccc; |
| 17 | + padding-bottom: 5px; |
| 18 | +} |
| 19 | + |
| 20 | +h2 { |
| 21 | + margin-top: 30px; |
| 22 | + border-left: 4px solid #888; |
| 23 | + padding-left: 8px; |
| 24 | +} |
| 25 | + |
| 26 | +h3 { |
| 27 | + margin-top: 20px; |
| 28 | +} |
| 29 | + |
| 30 | +code, pre { |
| 31 | + background: #f4f4f4; |
| 32 | + padding: 6px; |
| 33 | + display: block; |
| 34 | + overflow-x: auto; |
| 35 | + border-radius: 4px; |
| 36 | +} |
| 37 | + |
| 38 | +ul { |
| 39 | + margin-left: 25px; |
| 40 | +} |
| 41 | + |
| 42 | +p { |
| 43 | + margin: 10px 0; |
| 44 | +} |
| 45 | + |
| 46 | +.warning { |
| 47 | + color: #b00000; |
| 48 | + font-weight: bold; |
| 49 | +} |
| 50 | + |
| 51 | +.note { |
| 52 | + background: #eef3ff; |
| 53 | + border-left: 4px solid #4a6fdc; |
| 54 | + padding: 10px; |
| 55 | + margin: 10px 0; |
| 56 | +} |
| 57 | +</style> |
| 58 | + |
| 59 | +</head> |
| 60 | + |
| 61 | +<body> |
| 62 | + |
| 63 | +<h1>Introduction</h1> |
| 64 | + |
| 65 | +<h2>How the image is created</h2> |
| 66 | + |
| 67 | +<p> |
| 68 | +1. A 1:1 copy is created from the beginning of the device up to the end of the second partition.<br> |
| 69 | +The resulting <code>.img</code> file contains the MBR, <code>/boot</code>, and <code>/root</code>.<br> |
| 70 | +The complete operating system is stored in this file.<br> |
| 71 | +Additional partitions are <b>not included</b>. |
| 72 | +</p> |
| 73 | + |
| 74 | +<p> |
| 75 | +2. The <code>/root</code> partition is mounted and becomes accessible like a normal filesystem. |
| 76 | +</p> |
| 77 | + |
| 78 | +<p> |
| 79 | +3. Unwanted files are removed. |
| 80 | +</p> |
| 81 | + |
| 82 | +<p> |
| 83 | +4. The partition is unmounted. |
| 84 | +</p> |
| 85 | + |
| 86 | +<p> |
| 87 | +5. The image is then shrunk: |
| 88 | +</p> |
| 89 | + |
| 90 | +<p> |
| 91 | + • Unused sectors are overwritten with <code>0xFF</code><br> |
| 92 | + • Removes leftover data<br> |
| 93 | + • Improves compression efficiency<br> |
| 94 | + • Filesystem and image size are adjusted |
| 95 | +</p> |
| 96 | + |
| 97 | +<p> |
| 98 | +6. Optional compression can be applied. |
| 99 | +</p> |
| 100 | + |
| 101 | +<hr> |
| 102 | + |
| 103 | +<h2>Restoring the image</h2> |
| 104 | + |
| 105 | +<h3>Under Linux (recommended)</h3> |
| 106 | + |
| 107 | +<p><b>Use pibackup for restoring.</b></p> |
| 108 | + |
| 109 | +<p> |
| 110 | +1. MBR is taken from image and merged with partition table entries.<br> |
| 111 | +2. Corrected MBR + image data are written to target device.<br> |
| 112 | +3. Options applied: |
| 113 | +</p> |
| 114 | + |
| 115 | +<p> |
| 116 | + • /root partition size<br> |
| 117 | + • passwords<br> |
| 118 | + • device ID |
| 119 | +</p> |
| 120 | + |
| 121 | +<div class="note"> |
| 122 | +Passwords are shown encoded.<br> |
| 123 | +You may enter new ones in plain text. |
| 124 | +</div> |
| 125 | + |
| 126 | +<hr> |
| 127 | + |
| 128 | +<h3>Under Windows</h3> |
| 129 | + |
| 130 | +<p> |
| 131 | +If only <code>/boot</code> and <code>/root</code> exist, the image can be restored using a standard imaging tool. |
| 132 | +</p> |
| 133 | + |
| 134 | +<p> |
| 135 | +The system will boot, but <code>/root</code> must be expanded afterwards. |
| 136 | +</p> |
| 137 | + |
| 138 | +<p class="warning"> |
| 139 | +⚠ Do NOT use raspi-config if additional partitions exist. |
| 140 | +</p> |
| 141 | + |
| 142 | +<hr> |
| 143 | + |
| 144 | +<h2>Installing a New Operating System on an SSD</h2> |
| 145 | + |
| 146 | +<div class="warning"> |
| 147 | +⚠ All data in <code>/boot</code> and <code>/root</code> will be lost. |
| 148 | +</div> |
| 149 | + |
| 150 | +<p> |
| 151 | +1. Create new system<br> |
| 152 | +2. Test system<br> |
| 153 | +3. Install pibackup<br> |
| 154 | +4. Create image<br> |
| 155 | +5. Select source + target<br> |
| 156 | +6. Start restore |
| 157 | +</p> |
| 158 | + |
| 159 | +<hr> |
| 160 | + |
| 161 | +<h3>fstab Notes</h3> |
| 162 | + |
| 163 | +<p>If partitions are not mounted via automount:</p> |
| 164 | + |
| 165 | +<pre>sudo nano /etc/fstab</pre> |
| 166 | + |
| 167 | +<p>All entries must use the same PARTUUID.</p> |
| 168 | + |
| 169 | +<hr> |
| 170 | + |
| 171 | +<h1>pibackup Exclude File Syntax</h1> |
| 172 | + |
| 173 | +<p>Removes unnecessary files before compression.</p> |
| 174 | + |
| 175 | +<pre>/etc/pibackup/raspberry.exclude</pre> |
| 176 | + |
| 177 | +<h2>Syntax</h2> |
| 178 | + |
| 179 | +<pre>command = /path</pre> |
| 180 | + |
| 181 | +<p><code>§user</code> is replaced with current username.</p> |
| 182 | + |
| 183 | +<hr> |
| 184 | + |
| 185 | +<h2>Commands</h2> |
| 186 | + |
| 187 | +<p><b>RF - Remove File</b><br> |
| 188 | +rf = /home/§user/.bash_history</p> |
| 189 | + |
| 190 | +<p><b>RD - Remove Directory</b><br> |
| 191 | +rd = /home/§user/emptyfolder</p> |
| 192 | + |
| 193 | +<p><b>RT - Remove Tree</b><br> |
| 194 | +rt = /var/lib/snapd</p> |
| 195 | + |
| 196 | +<p><b>RFID - Remove Files in Directory</b><br> |
| 197 | +rfid = /var/backups/*</p> |
| 198 | + |
| 199 | +<p><b>RAID - Remove All in Directory</b><br> |
| 200 | +raid = /home/§user/Downloads</p> |
| 201 | + |
| 202 | +<p><b>RAIT - Remove All in Tree</b><br> |
| 203 | +rait = /tmp</p> |
| 204 | + |
| 205 | +<hr> |
| 206 | + |
| 207 | +<h2>Example Entries</h2> |
| 208 | + |
| 209 | +<pre> |
| 210 | +rait = /tmp |
| 211 | +rait = /var/tmp |
| 212 | +rait = /var/cache/apt/archives |
| 213 | +rait = /var/log |
| 214 | + |
| 215 | +rait = /home/§user/.cache/mozilla |
| 216 | +rait = /home/§user/.cache/chromium |
| 217 | + |
| 218 | +raid = /home/§user/Downloads |
| 219 | + |
| 220 | +rt = /var/lib/snapd |
| 221 | +rt = /home/§user/snap |
| 222 | +</pre> |
| 223 | + |
| 224 | +<hr> |
| 225 | + |
| 226 | +<h1>Compression Guide</h1> |
| 227 | + |
| 228 | +<p>Uses Zstandard (zstd) with long mode enabled.</p> |
| 229 | + |
| 230 | +<h2>Levels</h2> |
| 231 | + |
| 232 | +<p><b>1–3:</b> Very fast, larger files</p> |
| 233 | +<p><b>4–6:</b> Best balance, recommended</p> |
| 234 | +<p><b>7–10:</b> Better compression, slower</p> |
| 235 | +<p><b>11–19:</b> Maximum compression, very slow</p> |
| 236 | + |
| 237 | +<h2>Long Mode</h2> |
| 238 | + |
| 239 | +<p>Improves compression by searching further back in data.</p> |
| 240 | + |
| 241 | +<h2>Recommended</h2> |
| 242 | + |
| 243 | +<p> |
| 244 | +• Pi 3: 3–5<br> |
| 245 | +• Pi 4: 4–7<br> |
| 246 | +• Pi 5: 5–10 |
| 247 | +</p> |
| 248 | + |
| 249 | +</body> |
| 250 | +</html> |
0 commit comments