1 | <?xml version="1.0" encoding="utf-8" ?>
|
---|
2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
---|
3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
---|
6 | <meta name="generator" content="Docutils 0.12: http://docutils.sourceforge.net/" />
|
---|
7 | <title></title>
|
---|
8 | <style type="text/css">
|
---|
9 |
|
---|
10 | /*
|
---|
11 | :Author: David Goodger ([email protected])
|
---|
12 | :Id: $Id: TestBoxImaging.html 64523 2016-11-02 20:07:37Z vboxsync $
|
---|
13 | :Copyright: This stylesheet has been placed in the public domain.
|
---|
14 |
|
---|
15 | Default cascading style sheet for the HTML output of Docutils.
|
---|
16 |
|
---|
17 | See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
|
---|
18 | customize this style sheet.
|
---|
19 | */
|
---|
20 |
|
---|
21 | /* used to remove borders from tables and images */
|
---|
22 | .borderless, table.borderless td, table.borderless th {
|
---|
23 | border: 0 }
|
---|
24 |
|
---|
25 | table.borderless td, table.borderless th {
|
---|
26 | /* Override padding for "table.docutils td" with "! important".
|
---|
27 | The right padding separates the table cells. */
|
---|
28 | padding: 0 0.5em 0 0 ! important }
|
---|
29 |
|
---|
30 | .first {
|
---|
31 | /* Override more specific margin styles with "! important". */
|
---|
32 | margin-top: 0 ! important }
|
---|
33 |
|
---|
34 | .last, .with-subtitle {
|
---|
35 | margin-bottom: 0 ! important }
|
---|
36 |
|
---|
37 | .hidden {
|
---|
38 | display: none }
|
---|
39 |
|
---|
40 | a.toc-backref {
|
---|
41 | text-decoration: none ;
|
---|
42 | color: black }
|
---|
43 |
|
---|
44 | blockquote.epigraph {
|
---|
45 | margin: 2em 5em ; }
|
---|
46 |
|
---|
47 | dl.docutils dd {
|
---|
48 | margin-bottom: 0.5em }
|
---|
49 |
|
---|
50 | object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
|
---|
51 | overflow: hidden;
|
---|
52 | }
|
---|
53 |
|
---|
54 | /* Uncomment (and remove this text!) to get bold-faced definition list terms
|
---|
55 | dl.docutils dt {
|
---|
56 | font-weight: bold }
|
---|
57 | */
|
---|
58 |
|
---|
59 | div.abstract {
|
---|
60 | margin: 2em 5em }
|
---|
61 |
|
---|
62 | div.abstract p.topic-title {
|
---|
63 | font-weight: bold ;
|
---|
64 | text-align: center }
|
---|
65 |
|
---|
66 | div.admonition, div.attention, div.caution, div.danger, div.error,
|
---|
67 | div.hint, div.important, div.note, div.tip, div.warning {
|
---|
68 | margin: 2em ;
|
---|
69 | border: medium outset ;
|
---|
70 | padding: 1em }
|
---|
71 |
|
---|
72 | div.admonition p.admonition-title, div.hint p.admonition-title,
|
---|
73 | div.important p.admonition-title, div.note p.admonition-title,
|
---|
74 | div.tip p.admonition-title {
|
---|
75 | font-weight: bold ;
|
---|
76 | font-family: sans-serif }
|
---|
77 |
|
---|
78 | div.attention p.admonition-title, div.caution p.admonition-title,
|
---|
79 | div.danger p.admonition-title, div.error p.admonition-title,
|
---|
80 | div.warning p.admonition-title, .code .error {
|
---|
81 | color: red ;
|
---|
82 | font-weight: bold ;
|
---|
83 | font-family: sans-serif }
|
---|
84 |
|
---|
85 | /* Uncomment (and remove this text!) to get reduced vertical space in
|
---|
86 | compound paragraphs.
|
---|
87 | div.compound .compound-first, div.compound .compound-middle {
|
---|
88 | margin-bottom: 0.5em }
|
---|
89 |
|
---|
90 | div.compound .compound-last, div.compound .compound-middle {
|
---|
91 | margin-top: 0.5em }
|
---|
92 | */
|
---|
93 |
|
---|
94 | div.dedication {
|
---|
95 | margin: 2em 5em ;
|
---|
96 | text-align: center ;
|
---|
97 | font-style: italic }
|
---|
98 |
|
---|
99 | div.dedication p.topic-title {
|
---|
100 | font-weight: bold ;
|
---|
101 | font-style: normal }
|
---|
102 |
|
---|
103 | div.figure {
|
---|
104 | margin-left: 2em ;
|
---|
105 | margin-right: 2em }
|
---|
106 |
|
---|
107 | div.footer, div.header {
|
---|
108 | clear: both;
|
---|
109 | font-size: smaller }
|
---|
110 |
|
---|
111 | div.line-block {
|
---|
112 | display: block ;
|
---|
113 | margin-top: 1em ;
|
---|
114 | margin-bottom: 1em }
|
---|
115 |
|
---|
116 | div.line-block div.line-block {
|
---|
117 | margin-top: 0 ;
|
---|
118 | margin-bottom: 0 ;
|
---|
119 | margin-left: 1.5em }
|
---|
120 |
|
---|
121 | div.sidebar {
|
---|
122 | margin: 0 0 0.5em 1em ;
|
---|
123 | border: medium outset ;
|
---|
124 | padding: 1em ;
|
---|
125 | background-color: #ffffee ;
|
---|
126 | width: 40% ;
|
---|
127 | float: right ;
|
---|
128 | clear: right }
|
---|
129 |
|
---|
130 | div.sidebar p.rubric {
|
---|
131 | font-family: sans-serif ;
|
---|
132 | font-size: medium }
|
---|
133 |
|
---|
134 | div.system-messages {
|
---|
135 | margin: 5em }
|
---|
136 |
|
---|
137 | div.system-messages h1 {
|
---|
138 | color: red }
|
---|
139 |
|
---|
140 | div.system-message {
|
---|
141 | border: medium outset ;
|
---|
142 | padding: 1em }
|
---|
143 |
|
---|
144 | div.system-message p.system-message-title {
|
---|
145 | color: red ;
|
---|
146 | font-weight: bold }
|
---|
147 |
|
---|
148 | div.topic {
|
---|
149 | margin: 2em }
|
---|
150 |
|
---|
151 | h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
---|
152 | h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
---|
153 | margin-top: 0.4em }
|
---|
154 |
|
---|
155 | h1.title {
|
---|
156 | text-align: center }
|
---|
157 |
|
---|
158 | h2.subtitle {
|
---|
159 | text-align: center }
|
---|
160 |
|
---|
161 | hr.docutils {
|
---|
162 | width: 75% }
|
---|
163 |
|
---|
164 | img.align-left, .figure.align-left, object.align-left {
|
---|
165 | clear: left ;
|
---|
166 | float: left ;
|
---|
167 | margin-right: 1em }
|
---|
168 |
|
---|
169 | img.align-right, .figure.align-right, object.align-right {
|
---|
170 | clear: right ;
|
---|
171 | float: right ;
|
---|
172 | margin-left: 1em }
|
---|
173 |
|
---|
174 | img.align-center, .figure.align-center, object.align-center {
|
---|
175 | display: block;
|
---|
176 | margin-left: auto;
|
---|
177 | margin-right: auto;
|
---|
178 | }
|
---|
179 |
|
---|
180 | .align-left {
|
---|
181 | text-align: left }
|
---|
182 |
|
---|
183 | .align-center {
|
---|
184 | clear: both ;
|
---|
185 | text-align: center }
|
---|
186 |
|
---|
187 | .align-right {
|
---|
188 | text-align: right }
|
---|
189 |
|
---|
190 | /* reset inner alignment in figures */
|
---|
191 | div.align-right {
|
---|
192 | text-align: inherit }
|
---|
193 |
|
---|
194 | /* div.align-center * { */
|
---|
195 | /* text-align: left } */
|
---|
196 |
|
---|
197 | ol.simple, ul.simple {
|
---|
198 | margin-bottom: 1em }
|
---|
199 |
|
---|
200 | ol.arabic {
|
---|
201 | list-style: decimal }
|
---|
202 |
|
---|
203 | ol.loweralpha {
|
---|
204 | list-style: lower-alpha }
|
---|
205 |
|
---|
206 | ol.upperalpha {
|
---|
207 | list-style: upper-alpha }
|
---|
208 |
|
---|
209 | ol.lowerroman {
|
---|
210 | list-style: lower-roman }
|
---|
211 |
|
---|
212 | ol.upperroman {
|
---|
213 | list-style: upper-roman }
|
---|
214 |
|
---|
215 | p.attribution {
|
---|
216 | text-align: right ;
|
---|
217 | margin-left: 50% }
|
---|
218 |
|
---|
219 | p.caption {
|
---|
220 | font-style: italic }
|
---|
221 |
|
---|
222 | p.credits {
|
---|
223 | font-style: italic ;
|
---|
224 | font-size: smaller }
|
---|
225 |
|
---|
226 | p.label {
|
---|
227 | white-space: nowrap }
|
---|
228 |
|
---|
229 | p.rubric {
|
---|
230 | font-weight: bold ;
|
---|
231 | font-size: larger ;
|
---|
232 | color: maroon ;
|
---|
233 | text-align: center }
|
---|
234 |
|
---|
235 | p.sidebar-title {
|
---|
236 | font-family: sans-serif ;
|
---|
237 | font-weight: bold ;
|
---|
238 | font-size: larger }
|
---|
239 |
|
---|
240 | p.sidebar-subtitle {
|
---|
241 | font-family: sans-serif ;
|
---|
242 | font-weight: bold }
|
---|
243 |
|
---|
244 | p.topic-title {
|
---|
245 | font-weight: bold }
|
---|
246 |
|
---|
247 | pre.address {
|
---|
248 | margin-bottom: 0 ;
|
---|
249 | margin-top: 0 ;
|
---|
250 | font: inherit }
|
---|
251 |
|
---|
252 | pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
---|
253 | margin-left: 2em ;
|
---|
254 | margin-right: 2em }
|
---|
255 |
|
---|
256 | pre.code .ln { color: grey; } /* line numbers */
|
---|
257 | pre.code, code { background-color: #eeeeee }
|
---|
258 | pre.code .comment, code .comment { color: #5C6576 }
|
---|
259 | pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
---|
260 | pre.code .literal.string, code .literal.string { color: #0C5404 }
|
---|
261 | pre.code .name.builtin, code .name.builtin { color: #352B84 }
|
---|
262 | pre.code .deleted, code .deleted { background-color: #DEB0A1}
|
---|
263 | pre.code .inserted, code .inserted { background-color: #A3D289}
|
---|
264 |
|
---|
265 | span.classifier {
|
---|
266 | font-family: sans-serif ;
|
---|
267 | font-style: oblique }
|
---|
268 |
|
---|
269 | span.classifier-delimiter {
|
---|
270 | font-family: sans-serif ;
|
---|
271 | font-weight: bold }
|
---|
272 |
|
---|
273 | span.interpreted {
|
---|
274 | font-family: sans-serif }
|
---|
275 |
|
---|
276 | span.option {
|
---|
277 | white-space: nowrap }
|
---|
278 |
|
---|
279 | span.pre {
|
---|
280 | white-space: pre }
|
---|
281 |
|
---|
282 | span.problematic {
|
---|
283 | color: red }
|
---|
284 |
|
---|
285 | span.section-subtitle {
|
---|
286 | /* font-size relative to parent (h1..h6 element) */
|
---|
287 | font-size: 80% }
|
---|
288 |
|
---|
289 | table.citation {
|
---|
290 | border-left: solid 1px gray;
|
---|
291 | margin-left: 1px }
|
---|
292 |
|
---|
293 | table.docinfo {
|
---|
294 | margin: 2em 4em }
|
---|
295 |
|
---|
296 | table.docutils {
|
---|
297 | margin-top: 0.5em ;
|
---|
298 | margin-bottom: 0.5em }
|
---|
299 |
|
---|
300 | table.footnote {
|
---|
301 | border-left: solid 1px black;
|
---|
302 | margin-left: 1px }
|
---|
303 |
|
---|
304 | table.docutils td, table.docutils th,
|
---|
305 | table.docinfo td, table.docinfo th {
|
---|
306 | padding-left: 0.5em ;
|
---|
307 | padding-right: 0.5em ;
|
---|
308 | vertical-align: top }
|
---|
309 |
|
---|
310 | table.docutils th.field-name, table.docinfo th.docinfo-name {
|
---|
311 | font-weight: bold ;
|
---|
312 | text-align: left ;
|
---|
313 | white-space: nowrap ;
|
---|
314 | padding-left: 0 }
|
---|
315 |
|
---|
316 | /* "booktabs" style (no vertical lines) */
|
---|
317 | table.docutils.booktabs {
|
---|
318 | border: 0px;
|
---|
319 | border-top: 2px solid;
|
---|
320 | border-bottom: 2px solid;
|
---|
321 | border-collapse: collapse;
|
---|
322 | }
|
---|
323 | table.docutils.booktabs * {
|
---|
324 | border: 0px;
|
---|
325 | }
|
---|
326 | table.docutils.booktabs th {
|
---|
327 | border-bottom: thin solid;
|
---|
328 | text-align: left;
|
---|
329 | }
|
---|
330 |
|
---|
331 | h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
---|
332 | h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
|
---|
333 | font-size: 100% }
|
---|
334 |
|
---|
335 | ul.auto-toc {
|
---|
336 | list-style-type: none }
|
---|
337 |
|
---|
338 | </style>
|
---|
339 | </head>
|
---|
340 | <body>
|
---|
341 | <div class="document">
|
---|
342 |
|
---|
343 |
|
---|
344 | <div class="section" id="testbox-imaging-backup-restore">
|
---|
345 | <h1>Testbox Imaging (Backup / Restore)</h1>
|
---|
346 | <div class="section" id="introduction">
|
---|
347 | <h2>Introduction</h2>
|
---|
348 | <p>This document is explores deloying a very simple drive imaging solution to help
|
---|
349 | avoid needing to manually reinstall testboxes when a disk goes bust or the OS
|
---|
350 | install seems to be corrupted.</p>
|
---|
351 | </div>
|
---|
352 | </div>
|
---|
353 | <div class="section" id="definitions-glossary">
|
---|
354 | <h1>Definitions / Glossary</h1>
|
---|
355 | <p>See AutomaticTestingRevamp.txt.</p>
|
---|
356 | </div>
|
---|
357 | <div class="section" id="objectives">
|
---|
358 | <h1>Objectives</h1>
|
---|
359 | <blockquote>
|
---|
360 | <ul class="simple">
|
---|
361 | <li>Off site, no admin interaction (no need for ILOM or similar).</li>
|
---|
362 | <li>OS independent.</li>
|
---|
363 | <li>Space and bandwidth efficient.</li>
|
---|
364 | <li>As automatic as possible.</li>
|
---|
365 | <li>Logging.</li>
|
---|
366 | </ul>
|
---|
367 | </blockquote>
|
---|
368 | </div>
|
---|
369 | <div class="section" id="overview-of-the-solution">
|
---|
370 | <h1>Overview of the Solution</h1>
|
---|
371 | <p>Here is a brief summary:</p>
|
---|
372 | <blockquote>
|
---|
373 | <ul class="simple">
|
---|
374 | <li>Always boot testboxes via PXE using PXELINUX.</li>
|
---|
375 | <li>Default configuration is local boot (hard disk / SSD)</li>
|
---|
376 | <li>Restore/backup action triggered by machine specific PXE config.</li>
|
---|
377 | <li>Boots special debian maintenance install off NFS.</li>
|
---|
378 | <li>A maintenance service (systemd style) does the work.</li>
|
---|
379 | <li>The service reads action from TFTP location and performs it.</li>
|
---|
380 | <li>When done the service removes the TFTP machine specific config
|
---|
381 | and reboots the system.</li>
|
---|
382 | </ul>
|
---|
383 | </blockquote>
|
---|
384 | <dl class="docutils">
|
---|
385 | <dt>Maintenance actions are:</dt>
|
---|
386 | <dd><ul class="first last simple">
|
---|
387 | <li>backup</li>
|
---|
388 | <li>backup-again</li>
|
---|
389 | <li>restore</li>
|
---|
390 | <li>refresh-info</li>
|
---|
391 | <li>rescue</li>
|
---|
392 | </ul>
|
---|
393 | </dd>
|
---|
394 | </dl>
|
---|
395 | <p>Possible modifier that indicates a subset of disk on testboxes with other OSes
|
---|
396 | installed. Support for partition level backup/restore is not explored here.</p>
|
---|
397 | <div class="section" id="how-to-use">
|
---|
398 | <h2>How to use</h2>
|
---|
399 | <p>To perform one of the above maintenance actions on a testbox copy the</p>
|
---|
400 | </div>
|
---|
401 | </div>
|
---|
402 | <div class="section" id="storage-server">
|
---|
403 | <h1>Storage Server</h1>
|
---|
404 | <p>The storage server will have three areas used here. Using NFS for all three
|
---|
405 | avoids extra work getting CIFS sharing right too (NFS is already a pain).</p>
|
---|
406 | <blockquote>
|
---|
407 | <ol class="arabic simple">
|
---|
408 | <li>/export/testbox-tftp - TFTP config area. Read-write.</li>
|
---|
409 | <li>/export/testbox-backup - Images and logs. Read-write.</li>
|
---|
410 | <li>/export/testbox-nfsroot - Custom debian. Read-only, no root squash.</li>
|
---|
411 | </ol>
|
---|
412 | </blockquote>
|
---|
413 | </div>
|
---|
414 | <div class="section" id="tftp-export-testbox-tftp">
|
---|
415 | <h1>TFTP (/export/testbox-tftp)</h1>
|
---|
416 | <p>The testbox-tftp share needs to be writable, root squashing is okay.</p>
|
---|
417 | <p>We need files from both PXELINUX and SYSLINUX to make this work now. On a
|
---|
418 | debian system, the <tt class="docutils literal">pxelinux</tt> and <tt class="docutils literal">syslinux</tt> packages needs to be
|
---|
419 | installed. We actually do this further down when setting up the nfsroot, so
|
---|
420 | it's possible to get them from there by postponing this step a little. On
|
---|
421 | debian 8.6.0 the PXELINUX files are found in <tt class="docutils literal">/usr/lib/PXELINUX</tt> and the
|
---|
422 | SYSLINUX ones in <tt class="docutils literal">/usr/lib/syslinux</tt>.</p>
|
---|
423 | <p>The initial PXE image as well as associated modules comes in three variants,
|
---|
424 | BIOS, 32-bit EFI and 64-bit EFI. We'll only need the BIOS one for now.
|
---|
425 | Perform the following copy operations:</p>
|
---|
426 | <pre class="literal-block">
|
---|
427 | cp /usr/lib/PXELINUX/pxelinux.0 /mnt/testbox-tftp/
|
---|
428 | cp /usr/lib/syslinux/modules/*/ldlinux.* /mnt/testbox-tftp/
|
---|
429 | cp -R /usr/lib/syslinux/modules/bios /mnt/testbox-tftp/
|
---|
430 | cp -R /usr/lib/syslinux/modules/efi32 /mnt/testbox-tftp/
|
---|
431 | cp -R /usr/lib/syslinux/modules/efi64 /mnt/testbox-tftp/
|
---|
432 | </pre>
|
---|
433 | <p>For simplicitly, all the testboxes boot using good old fashioned BIOS, no EFI.
|
---|
434 | However, it doesn't really hurt to be prepared.</p>
|
---|
435 | <p>The PXELINUX related files goes in the root of the testbox-tftp share. (As
|
---|
436 | mentioned further down, these can be installed on a debian system by running
|
---|
437 | <tt class="docutils literal"><span class="pre">apt-get</span> install pxelinux syslinux</tt>.) We need the <tt class="docutils literal">*pxelinux.0</tt> files
|
---|
438 | typically found in <tt class="docutils literal">/usr/lib/PXELINUX/</tt> on debian systems (recent ones
|
---|
439 | anyway). It is possible we may need one ore more fo the modules <a class="footnote-reference" href="#id6" id="id1">[1]</a> that
|
---|
440 | ships with PXELINUX/SYSLINUX, so do copy <tt class="docutils literal">/usr/lib/syslinux/modules</tt> to
|
---|
441 | <tt class="docutils literal"><span class="pre">testbox-tftp/modules</span></tt> as well.</p>
|
---|
442 | <p>The directory layout related to the configuration files is dictated by the
|
---|
443 | PXELINUX configuration file searching algorithm <a class="footnote-reference" href="#id7" id="id2">[2]</a>. Create a subdirectory
|
---|
444 | <tt class="docutils literal">pxelinux.cfg/</tt> under <tt class="docutils literal"><span class="pre">testbox-tftp</span></tt> and create the world readable file
|
---|
445 | <tt class="docutils literal">default</tt> with the following content:</p>
|
---|
446 | <pre class="literal-block">
|
---|
447 | PATH bios
|
---|
448 | DEFAULT local-boot
|
---|
449 | LABEL local-boot
|
---|
450 | LOCALBOOT
|
---|
451 | </pre>
|
---|
452 | <p>This will make the default behavior to boot the local disk system.</p>
|
---|
453 | <p>Create <tt class="docutils literal"><span class="pre">pxelinux.cfg/do-backup</span></tt>, <tt class="docutils literal"><span class="pre">pxelinux.cfg/do-backup-again</span></tt>,
|
---|
454 | <tt class="docutils literal"><span class="pre">pxelinux.cfg/do-restore</span></tt>, <tt class="docutils literal"><span class="pre">pxelinux.cfg/do-refresh-info</span></tt>, and
|
---|
455 | <tt class="docutils literal"><span class="pre">pxelinux.cfg/do-rescue</span></tt> configuration files on the form:</p>
|
---|
456 | <pre class="literal-block">
|
---|
457 | PATH bios
|
---|
458 | DEFAULT maintenance
|
---|
459 | LABEL maintenance
|
---|
460 | MENU LABEL Maintenance (NFS)
|
---|
461 | KERNEL maintenance-boot/vmlinuz-3.16.0-4-amd64
|
---|
462 | APPEND initrd=maintenance-boot/initrd.img-3.16.0-4-amd64 testbox-action-backup ro ip=dhcp aufs=tmpfs boot=nfs root=/dev/nfs nfsroot=10.42.1.1:/export/testbox-nfsroot,ro nfsvers=3 nfsrootdebug
|
---|
463 | LABEL local-boot
|
---|
464 | LOCALBOOT
|
---|
465 | </pre>
|
---|
466 | <p>When you want to preform an action on a testbox, copy the <tt class="docutils literal"><span class="pre">do-<action></span></tt> to
|
---|
467 | <tt class="docutils literal"><span class="pre">pxeclient.cfg/<HEX-ip-addr></span></tt> and trigger a boot of the testbox. The machine
|
---|
468 | config will be removed automatically once the action has been successfully
|
---|
469 | completed.</p>
|
---|
470 | </div>
|
---|
471 | <div class="section" id="images-and-logs-export-testbox-backup">
|
---|
472 | <h1>Images and logs (/export/testbox-backup)</h1>
|
---|
473 | <p>The testbox-backup share needs to be writable, root squashing is okay.</p>
|
---|
474 | <p>In the root there must be a file <tt class="docutils literal"><span class="pre">testbox-backup</span></tt> so we can easily tell
|
---|
475 | whether we've actually mounted the share or are just staring at an empty mount
|
---|
476 | point directory.</p>
|
---|
477 | <p>The <tt class="docutils literal"><span class="pre">testbox-maintenance.sh</span></tt> script maintains a global log in the root
|
---|
478 | directory that's called <tt class="docutils literal">maintenance.log</tt>. Errors will be logged there as
|
---|
479 | well as a ping and the action.</p>
|
---|
480 | <p>We use a directory layout based on dotted decimal IP addresses here, so for a
|
---|
481 | server with the IP 10.40.41.42 all its file will be under <tt class="docutils literal">10.40.41.42/</tt>:</p>
|
---|
482 | <dl class="docutils">
|
---|
483 | <dt><tt class="docutils literal"><hostname></tt></dt>
|
---|
484 | <dd>The name of the testbox (empty file). Help finding a testbox by name.</dd>
|
---|
485 | <dt><tt class="docutils literal"><span class="pre">testbox-info.txt</span></tt></dt>
|
---|
486 | <dd>Information about the testbox. Starting off with the name, decimal IP,
|
---|
487 | PXELINUX style hexadecimal IP, and more.</dd>
|
---|
488 | <dt><tt class="docutils literal">maintenance.log</tt></dt>
|
---|
489 | <dd>Maintenance log file recording what the maintenance service does.</dd>
|
---|
490 | <dt><tt class="docutils literal"><span class="pre">disk-devices.lst</span></tt></dt>
|
---|
491 | <dd>Optional list of disk devices to consider backuping up or restoring. This is
|
---|
492 | intended for testboxes with additional disks that are used for other purposes
|
---|
493 | and should touched.</dd>
|
---|
494 | <dt><tt class="docutils literal">sda.raw.gz</tt></dt>
|
---|
495 | <dd>The gzipped raw copy of the sda device of the testbox.</dd>
|
---|
496 | <dt><tt class="docutils literal"><span class="pre">sd[bcdefgh].raw.gz</span></tt></dt>
|
---|
497 | <dd>The gzipped raw copy sdb, sdc, sde, sdf, sdg, sdh, etc if any of them exists
|
---|
498 | and are disks/SSDs.</dd>
|
---|
499 | <dt>Note! If it turns out we can be certain to get a valid host name, we might just</dt>
|
---|
500 | <dd>switch to use the hostname as the directory name instead of the IP.</dd>
|
---|
501 | </dl>
|
---|
502 | </div>
|
---|
503 | <div class="section" id="debian-nfs-root-export-testbox-nfsroot">
|
---|
504 | <h1>Debian NFS root (/export/testbox-nfsroot)</h1>
|
---|
505 | <p>The testbox-nfsroot share should be read-only and must <strong>not</strong> have root
|
---|
506 | squashing enabled.</p>
|
---|
507 | <p>There are several ways of creating a debian nfsroot, but since we've got a
|
---|
508 | tool like VirtualBox around we've just installed it in a VM, prepared it,
|
---|
509 | and copied it onto the NFS server share.</p>
|
---|
510 | <p>As of writing debian 8.6.0 is current, so a minimal 64-bit install of it was
|
---|
511 | done in a VM. After installation the following modifications was done:</p>
|
---|
512 | <blockquote>
|
---|
513 | <ul>
|
---|
514 | <li><p class="first"><tt class="docutils literal"><span class="pre">apt-get</span> install pxelinux syslinux <span class="pre">initramfs-tools</span> zip gddrescue joe</tt>
|
---|
515 | and optionally <tt class="docutils literal"><span class="pre">apt-get</span> install smbclient <span class="pre">cifs-utils</span></tt>.</p>
|
---|
516 | </li>
|
---|
517 | <li><p class="first"><tt class="docutils literal">/etc/default/grub</tt> was modified to set <tt class="docutils literal">GRUB_CMDLINE_LINUX_DEFAULT</tt> to
|
---|
518 | <tt class="docutils literal">""</tt> instead of <tt class="docutils literal">"quiet"</tt>. This allows us to see messages during boot
|
---|
519 | and perhaps spot why something doesn't work on a testbox. Regenerate the
|
---|
520 | grub configuration file by running <tt class="docutils literal"><span class="pre">update-grub</span></tt> afterwards.</p>
|
---|
521 | </li>
|
---|
522 | <li><p class="first">Create the directory <tt class="docutils literal">/etc/systemd/system/getty@tty1.service.d</tt> and create
|
---|
523 | the file <tt class="docutils literal">noclear.conf</tt> in it with the following content:</p>
|
---|
524 | <pre class="literal-block">
|
---|
525 | [Service]
|
---|
526 | TTYVTDisallocate=no
|
---|
527 | </pre>
|
---|
528 | <p>This stops getty from clearing VT1 and let us see the tail of the boot up
|
---|
529 | messages, which includes messages from the testbox-maintenance service.</p>
|
---|
530 | </li>
|
---|
531 | <li><p class="first">Mount the testbox-nfsroot under <tt class="docutils literal">/mnt/</tt> with write privileges. (The write
|
---|
532 | privileges are temporary - don't forget to remove them later on.):</p>
|
---|
533 | <pre class="literal-block">
|
---|
534 | mount -t nfs myserver.com:/export/testbox-nfsroot
|
---|
535 | </pre>
|
---|
536 | <p>Note! Adding <tt class="docutils literal"><span class="pre">-o</span> nfsvers=3</tt> may help with some NTFv4 servers.</p>
|
---|
537 | </li>
|
---|
538 | <li><p class="first">Copy the debian root and dev file system onto nfsroot. If you have ssh
|
---|
539 | access to the NFS server, the quickest way to do it is to use <tt class="docutils literal">tar</tt>:</p>
|
---|
540 | <pre class="literal-block">
|
---|
541 | tar -cz --one-file-system -f /mnt/testbox-maintenance-nfsroot.tar.gz . dev/
|
---|
542 | </pre>
|
---|
543 | <p>An alternative is <tt class="docutils literal">cp <span class="pre">-ax</span> . /mnt/. && cp <span class="pre">-ax</span> dev/. /mnt/dev/.</tt> but this
|
---|
544 | is quite a bit slower, obviously.</p>
|
---|
545 | </li>
|
---|
546 | <li><p class="first">chroot into the nfsroot: <tt class="docutils literal">chroot /mnt/</tt></p>
|
---|
547 | <blockquote>
|
---|
548 | <ul>
|
---|
549 | <li><p class="first"><tt class="docutils literal">mount <span class="pre">-o</span> proc proc /proc</tt></p>
|
---|
550 | </li>
|
---|
551 | <li><p class="first"><tt class="docutils literal">mount <span class="pre">-o</span> sysfs sysfs /sys</tt></p>
|
---|
552 | </li>
|
---|
553 | <li><p class="first"><tt class="docutils literal">mkdir <span class="pre">/mnt/testbox-tftp</span> <span class="pre">/mnt/testbox-backup</span></tt></p>
|
---|
554 | </li>
|
---|
555 | <li><p class="first">Recreate <tt class="docutils literal">/etc/fstab</tt> with:</p>
|
---|
556 | <pre class="literal-block">
|
---|
557 | proc /proc proc defaults 0 0
|
---|
558 | /dev/nfs / nfs defaults 1 1
|
---|
559 | 10.42.1.1:/export/testbox-tftp /mnt/testbox-tftp nfs nfsvers=3 2 2
|
---|
560 | 10.42.1.1:/export/testbox-backup /mnt/testbox-backup nfs nfsvers=3 3 3
|
---|
561 | </pre>
|
---|
562 | </li>
|
---|
563 | <li><p class="first">Do <tt class="docutils literal">mount <span class="pre">/mnt/testbox-tftp</span> && mount <span class="pre">/mnt/testbox-backup</span></tt> to mount the
|
---|
564 | two shares. This may be a good time to execute the instructions in the
|
---|
565 | sections above relating to these two shares.</p>
|
---|
566 | </li>
|
---|
567 | <li><p class="first">Edit <tt class="docutils literal"><span class="pre">/etc/initramfs-tools/initramfs.conf</span></tt> and change the <tt class="docutils literal">MODULES</tt>
|
---|
568 | value from <tt class="docutils literal">most</tt> to <tt class="docutils literal">netboot</tt>.</p>
|
---|
569 | </li>
|
---|
570 | <li><p class="first">Append <tt class="docutils literal">aufs</tt> to <tt class="docutils literal"><span class="pre">/etc/initramfs-tools/modules</span></tt>. The advanced
|
---|
571 | multi-layered unification filesystem (aufs) enables us to use a
|
---|
572 | read-only NFS root. <a class="footnote-reference" href="#id8" id="id3">[3]</a> <a class="footnote-reference" href="#id9" id="id4">[4]</a> <a class="footnote-reference" href="#id10" id="id5">[5]</a></p>
|
---|
573 | </li>
|
---|
574 | <li><p class="first">Create <tt class="docutils literal"><span class="pre">/etc/initramfs-tools/scripts/init-bottom/00_aufs_init</span></tt> as
|
---|
575 | an executable file with the following content:</p>
|
---|
576 | <pre class="literal-block">
|
---|
577 | #!/bin/sh
|
---|
578 | # Don't run during update-initramfs:
|
---|
579 | case "$1" in
|
---|
580 | prereqs)
|
---|
581 | exit 0;
|
---|
582 | ;;
|
---|
583 | esac
|
---|
584 |
|
---|
585 | modprobe aufs
|
---|
586 | mkdir -p /ro /rw /aufs
|
---|
587 | mount -t tmpfs tmpfs /rw -o noatime,mode=0755
|
---|
588 | mount --move $rootmnt /ro
|
---|
589 | mount -t aufs aufs /aufs -o noatime,dirs=/rw:/ro=ro
|
---|
590 | mkdir -p /aufs/rw /aufs/ro
|
---|
591 | mount --move /ro /aufs/ro
|
---|
592 | mount --move /rw /aufs/rw
|
---|
593 | mount --move /aufs /root
|
---|
594 | exit 0
|
---|
595 | </pre>
|
---|
596 | </li>
|
---|
597 | <li><p class="first">Update the init ramdisk: <tt class="docutils literal"><span class="pre">update-initramfs</span> <span class="pre">-u</span> <span class="pre">-k</span> all</tt></p>
|
---|
598 | <dl class="docutils">
|
---|
599 | <dt>Note! It may be necessary to do <tt class="docutils literal">mount <span class="pre">-t</span> tmpfs tmpfs /var/tmp</tt> to help</dt>
|
---|
600 | <dd><p class="first last">this operation succeed.</p>
|
---|
601 | </dd>
|
---|
602 | </dl>
|
---|
603 | </li>
|
---|
604 | <li><p class="first">Copy <tt class="docutils literal">/boot</tt> to <tt class="docutils literal"><span class="pre">/mnt/testbox-tftp/maintenance-boot/</span></tt>.</p>
|
---|
605 | </li>
|
---|
606 | <li><p class="first">Copy the <tt class="docutils literal"><span class="pre">testbox-maintenance.sh</span></tt> file found in the same directory as this
|
---|
607 | document to <tt class="docutils literal">/root/scripts/</tt> (need to create the dir) and make it
|
---|
608 | executable.</p>
|
---|
609 | </li>
|
---|
610 | <li><p class="first">Create the systemd service file for the maintenance service as
|
---|
611 | <tt class="docutils literal"><span class="pre">/etc/systemd/system/testbox-maintenance.service</span></tt> with the content:</p>
|
---|
612 | <pre class="literal-block">
|
---|
613 | [Unit]
|
---|
614 | Description=Testbox Maintenance
|
---|
615 | After=network.target
|
---|
616 | Before=getty@tty1.service
|
---|
617 |
|
---|
618 | [Service]
|
---|
619 | Type=oneshot
|
---|
620 | RemainAfterExit=True
|
---|
621 | ExecStart=/root/scripts/testbox-maintenance.sh
|
---|
622 | ExecStartPre=/bin/echo -e \033%G
|
---|
623 | ExecReload=/bin/kill -HUP $MAINPID
|
---|
624 | WorkingDirectory=/tmp
|
---|
625 | Environment=TERM=xterm
|
---|
626 | StandardOutput=journal+console
|
---|
627 |
|
---|
628 | [Install]
|
---|
629 | WantedBy=multi-user.target
|
---|
630 | </pre>
|
---|
631 | </li>
|
---|
632 | <li><p class="first">Enable our service: <tt class="docutils literal">systemctl enable <span class="pre">/etc/systemd/system/testbox-maintenance.service</span></tt></p>
|
---|
633 | </li>
|
---|
634 | <li><p class="first">xxxx ... more ???</p>
|
---|
635 | </li>
|
---|
636 | <li><p class="first">Before leaving the chroot, do <tt class="docutils literal">mount /proc /sys <span class="pre">/mnt/testbox-*</span></tt>.</p>
|
---|
637 | </li>
|
---|
638 | </ul>
|
---|
639 | </blockquote>
|
---|
640 | </li>
|
---|
641 | <li><p class="first">Testing the setup from a VM is kind of useful (if the nfs server can be
|
---|
642 | convinced to accept root nfs mounts from non-privileged clinet ports):</p>
|
---|
643 | <blockquote>
|
---|
644 | <ul>
|
---|
645 | <li><p class="first">Create a VM using the 64-bit debian profile. Let's call it "pxe-vm".</p>
|
---|
646 | </li>
|
---|
647 | <li><p class="first">Mount the TFTP share somewhere, like M: or /mnt/testbox-tftp.</p>
|
---|
648 | </li>
|
---|
649 | <li><p class="first">Reconfigure the NAT DHCP and TFTP bits:</p>
|
---|
650 | <pre class="literal-block">
|
---|
651 | VBoxManage setextradata pxe-vm VBoxInternal/PDM/DriverTransformations/pxe/AboveDriver NAT
|
---|
652 | VBoxManage setextradata pxe-vm VBoxInternal/PDM/DriverTransformations/pxe/Action mergeconfig
|
---|
653 | VBoxManage setextradata pxe-vm VBoxInternal/PDM/DriverTransformations/pxe/Config/TFTPPrefix M:/
|
---|
654 | VBoxManage setextradata pxe-vm VBoxInternal/PDM/DriverTransformations/pxe/Config/BootFile pxelinux.0
|
---|
655 | </pre>
|
---|
656 | </li>
|
---|
657 | <li><p class="first">Create the file <tt class="docutils literal"><span class="pre">testbox-tftp/pxelinux.cfg/0A00020F</span></tt> containing:</p>
|
---|
658 | <pre class="literal-block">
|
---|
659 | PATH bios
|
---|
660 | DEFAULT maintenance
|
---|
661 | LABEL maintenance
|
---|
662 | MENU LABEL Maintenance (NFS)
|
---|
663 | KERNEL maintenance-boot/vmlinuz-3.16.0-4-amd64
|
---|
664 | APPEND initrd=maintenance-boot/initrd.img-3.16.0-4-amd64 ro ip=dhcp aufs=tmpfs \
|
---|
665 | boot=nfs root=/dev/nfs nfsroot=10.42.1.1:/export/testbox-nfsroot
|
---|
666 | LABEL local-boot
|
---|
667 | LOCALBOOT
|
---|
668 | </pre>
|
---|
669 | </li>
|
---|
670 | </ul>
|
---|
671 | </blockquote>
|
---|
672 | </li>
|
---|
673 | </ul>
|
---|
674 | </blockquote>
|
---|
675 | <hr class="docutils" />
|
---|
676 | <table class="docutils footnote" frame="void" id="id6" rules="none">
|
---|
677 | <colgroup><col class="label" /><col /></colgroup>
|
---|
678 | <tbody valign="top">
|
---|
679 | <tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>See <a class="reference external" href="http://www.syslinux.org/wiki/index.php?title=Category:Modules">http://www.syslinux.org/wiki/index.php?title=Category:Modules</a></td></tr>
|
---|
680 | </tbody>
|
---|
681 | </table>
|
---|
682 | <table class="docutils footnote" frame="void" id="id7" rules="none">
|
---|
683 | <colgroup><col class="label" /><col /></colgroup>
|
---|
684 | <tbody valign="top">
|
---|
685 | <tr><td class="label"><a class="fn-backref" href="#id2">[2]</a></td><td>See <a class="reference external" href="http://www.syslinux.org/wiki/index.php?title=PXELINUX#Configuration">http://www.syslinux.org/wiki/index.php?title=PXELINUX#Configuration</a></td></tr>
|
---|
686 | </tbody>
|
---|
687 | </table>
|
---|
688 | <table class="docutils footnote" frame="void" id="id8" rules="none">
|
---|
689 | <colgroup><col class="label" /><col /></colgroup>
|
---|
690 | <tbody valign="top">
|
---|
691 | <tr><td class="label"><a class="fn-backref" href="#id3">[3]</a></td><td>See <a class="reference external" href="https://en.wikipedia.org/wiki/Aufs">https://en.wikipedia.org/wiki/Aufs</a></td></tr>
|
---|
692 | </tbody>
|
---|
693 | </table>
|
---|
694 | <table class="docutils footnote" frame="void" id="id9" rules="none">
|
---|
695 | <colgroup><col class="label" /><col /></colgroup>
|
---|
696 | <tbody valign="top">
|
---|
697 | <tr><td class="label"><a class="fn-backref" href="#id4">[4]</a></td><td>See <a class="reference external" href="http://shitwefoundout.com/wiki/Diskless_ubuntu">http://shitwefoundout.com/wiki/Diskless_ubuntu</a></td></tr>
|
---|
698 | </tbody>
|
---|
699 | </table>
|
---|
700 | <table class="docutils footnote" frame="void" id="id10" rules="none">
|
---|
701 | <colgroup><col class="label" /><col /></colgroup>
|
---|
702 | <tbody valign="top">
|
---|
703 | <tr><td class="label"><a class="fn-backref" href="#id5">[5]</a></td><td>See <a class="reference external" href="http://debianaddict.com/2012/06/19/diskless-debian-linux-booting-via-dhcppxenfstftp/">http://debianaddict.com/2012/06/19/diskless-debian-linux-booting-via-dhcppxenfstftp/</a></td></tr>
|
---|
704 | </tbody>
|
---|
705 | </table>
|
---|
706 | <hr class="docutils" />
|
---|
707 | <table class="docutils field-list" frame="void" rules="none">
|
---|
708 | <col class="field-name" />
|
---|
709 | <col class="field-body" />
|
---|
710 | <tbody valign="top">
|
---|
711 | <tr class="field"><th class="field-name">Status:</th><td class="field-body">$Id: TestBoxImaging.html 64523 2016-11-02 20:07:37Z vboxsync $</td>
|
---|
712 | </tr>
|
---|
713 | <tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Copyright (C) 2010-2016 Oracle Corporation.</td>
|
---|
714 | </tr>
|
---|
715 | </tbody>
|
---|
716 | </table>
|
---|
717 | </div>
|
---|
718 | </div>
|
---|
719 | </body>
|
---|
720 | </html>
|
---|