1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390
|
.\" -*- mode: troff; coding: utf-8 -*-
.\" Automatically generated by Podwrapper::Man 1.52.3 (Pod::Simple 3.45)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
.ie n \{\
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\"
.\" Required to disable full justification in groff 1.23.0.
.if n .ds AD l
.\" ========================================================================
.\"
.IX Title "virt-sysprep 1"
.TH virt-sysprep 1 2025-02-18 guestfs-tools-1.52.3 "Virtualization Support"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH 名前
.IX Header "名前"
virt\-sysprep \- 仮想マシンをクローンできるよう、再設定、設定解除またはカスタマイズします
.SH 書式
.IX Header "書式"
.Vb 1
\& virt\-sysprep [\-\-options] \-d domname
\&
\& virt\-sysprep [\-\-options] \-a disk.img [\-a disk.img ...]
.Ve
.SH 説明
.IX Header "説明"
Virt\-sysprep can reset or unconfigure a virtual machine so that clones can be made from it. Steps in this process include removing SSH host keys, removing persistent network MAC configuration, and removing user accounts. Virt\-sysprep can also customize a virtual machine, for instance by adding SSH keys, users or logos. Each step can be enabled or disabled as required.
.PP
Virt\-sysprep modifies the guest or disk image \fIin place\fR. The guest must be shut down. If you want to preserve the existing contents of the guest, \fIyou must snapshot, copy or clone the disk first\fR. See "COPYING AND CLONING" below.
.PP
You do \fInot\fR need to run virt\-sysprep as root. In fact we\*(Aqd generally recommend that you don\*(Aqt. The time you might want to run it as root is when you need root in order to access the disk image, but even in this case it would be better to change the permissions on the disk image to be writable as the non\-root user running virt\-sysprep.
.PP
"Sysprep" stands for "system preparation" tool. The name comes from the Microsoft program \fIsysprep.exe\fR which is used to unconfigure Windows machines in preparation for cloning them. (Virt\-sysprep does not work on Microsoft Windows guests.)
.SH オプション
.IX Header "オプション"
.IP \fB\-\-help\fR 4
.IX Item "--help"
簡単なヘルプを表示します。
.IP "\fB\-a\fR file" 4
.IX Item "-a file"
.PD 0
.IP "\fB\-\-add\fR file" 4
.IX Item "--add file"
.PD
仮想マシンからディスクイメージの \fIfile\fR を追加します。
.Sp
ディスクイメージの形式は自動的に検出されます。強制的に特定の形式を使用するには \fI\-\-format\fR オプションを使用します。
.IP "\fB\-a\fR URI" 4
.IX Item "-a URI"
.PD 0
.IP "\fB\-\-add\fR URI" 4
.IX Item "--add URI"
.PD
Add a remote disk. The URI format is compatible with guestfish. See "ADDING REMOTE STORAGE" in \fBguestfish\fR\|(1).
.IP \fB\-\-colors\fR 4
.IX Item "--colors"
.PD 0
.IP \fB\-\-colours\fR 4
.IX Item "--colours"
.PD
Use ANSI colour sequences to colourize messages. This is the default when the output is a tty. If the output of the program is redirected to a file, ANSI colour sequences are disabled unless you use this option.
.IP "\fB\-c\fR URI" 4
.IX Item "-c URI"
.PD 0
.IP "\fB\-\-connect\fR URI" 4
.IX Item "--connect URI"
.PD
libvirt を使用していると、指定された \fIURI\fR に接続します。 省略すると、デフォルトの libvirt ハイパーバイザーに接続します。
.Sp
ゲストのブロックデバイスを直接指定していると((\fI\-a\fR))、libvirt は何も使用されません。
.IP "\fB\-d\fR guest" 4
.IX Item "-d guest"
.PD 0
.IP "\fB\-\-domain\fR guest" 4
.IX Item "--domain guest"
.PD
名前付きの libvirt 仮想マシンからすべてのディスクを追加します。 名前の代わりに仮想マシンの UUID を使用できます。
.IP \fB\-n\fR 4
.IX Item "-n"
.PD 0
.IP \fB\-\-dry\-run\fR 4
.IX Item "--dry-run"
.PD
Perform a read\-only "dry run" on the guest. This runs the sysprep operation, but throws away any changes to the disk at the end.
.IP "\fB\-\-enable\fR operations" 4
.IX Item "--enable operations"
Choose which sysprep operations to perform. Give a comma\-separated list of operations, for example:
.Sp
.Vb 1
\& \-\-enable ssh\-hostkeys,udev\-persistent\-net
.Ve
.Sp
would enable ONLY \f(CW\*(C`ssh\-hostkeys\*(C'\fR and \f(CW\*(C`udev\-persistent\-net\*(C'\fR operations.
.Sp
If the \fI\-\-enable\fR option is not given, then we default to trying most sysprep operations (see \fI\-\-list\-operations\fR to show which are enabled).
.Sp
Regardless of the \fI\-\-enable\fR option, sysprep operations are skipped for some guest types.
.Sp
特定のバージョンの virt\-sysprep によりサポートされる操作の一覧を表示するには \fI\-\-list\-operations\fR を使用します。
.Sp
See "OPERATIONS" below for a list and an explanation of each operation.
.IP "\fB\-\-operation\fR operations" 4
.IX Item "--operation operations"
.PD 0
.IP "\fB\-\-operations\fR operations" 4
.IX Item "--operations operations"
.PD
Choose which sysprep operations to perform. Give a comma\-separated list of operations, for example:
.Sp
.Vb 1
\& \-\-operations ssh\-hostkeys,udev\-persistent\-net
.Ve
.Sp
would enable ONLY \f(CW\*(C`ssh\-hostkeys\*(C'\fR and \f(CW\*(C`udev\-persistent\-net\*(C'\fR operations.
.Sp
\&\fI\-\-operations\fR allows you to enable and disable any operation, including the default ones (which would be tried when specifying neither \fI\-\-operations\fR nor \fI\-\-enable\fR) and all the available ones; prepending a \f(CW\*(C`\-\*(C'\fR in front of an operation name removes it from the list of enabled operations, while the meta\-names \f(CW\*(C`defaults\*(C'\fR and \f(CW\*(C`all\*(C'\fR represent respectively the operations enabled by default and all the available ones. For example:
.Sp
.Vb 1
\& \-\-operations firewall\-rules,defaults,\-tmp\-files
.Ve
.Sp
would enable the \f(CW\*(C`firewall\-rules\*(C'\fR operation (regardless whether it is enabled by default), all the default ones, and disable the \f(CW\*(C`tmp\-files\*(C'\fR operation.
.Sp
\&\fI\-\-operations\fR can be specified multiple times; the first time the set of enabled operations is empty, while any further \fI\-\-operations\fR affects the operations enabled so far.
.Sp
If the \fI\-\-operations\fR option is not given, then we default to trying most sysprep operations (see \fI\-\-list\-operations\fR to show which are enabled).
.Sp
Regardless of the \fI\-\-operations\fR option, sysprep operations are skipped for some guest types.
.Sp
特定のバージョンの virt\-sysprep によりサポートされる操作の一覧を表示するには \fI\-\-list\-operations\fR を使用します。
.Sp
See "OPERATIONS" below for a list and an explanation of each operation.
.IP \fB\-\-echo\-keys\fR 4
.IX Item "--echo-keys"
When prompting for keys and passphrases, virt\-sysprep normally turns echoing off so you cannot see what you are typing. If you are not worried about Tempest attacks and there is no one else in the room you can specify this flag to see what you are typing.
.IP "\fB\-\-format\fR raw|qcow2|.." 4
.IX Item "--format raw|qcow2|.."
.PD 0
.IP "\fB\-\-format\fR auto" 4
.IX Item "--format auto"
.PD
The default for the \fI\-a\fR option is to auto\-detect the format of the disk image. Using this forces the disk format for \fI\-a\fR options which follow on the command line. Using \fI\-\-format auto\fR switches back to auto\-detection for subsequent \fI\-a\fR options.
.Sp
例:
.Sp
.Vb 1
\& virt\-sysprep \-\-format raw \-a disk.img
.Ve
.Sp
forces raw format (no auto\-detection) for \fIdisk.img\fR.
.Sp
.Vb 1
\& virt\-sysprep \-\-format raw \-a disk.img \-\-format auto \-a another.img
.Ve
.Sp
forces raw format (no auto\-detection) for \fIdisk.img\fR and reverts to auto\-detection for \fIanother.img\fR.
.Sp
仮想マシンのディスクイメージが信頼できない raw 形式である場合、 ディスク形式を指定するためにこのオプションを使用すべきです。 これにより、悪意のある仮想マシンにより起こり得る セキュリティ問題を回避できます (CVE\-2010\-3851)。
.IP "\fB\-\-key\fR SELECTOR" 4
.IX Item "--key SELECTOR"
Specify a key for LUKS, to automatically open a LUKS device when using
the inspection.
.RS 4
.IP "\fB\-\-key\fR NAME\fB:key:\fRKEY_STRING" 4
.IX Item "--key NAME:key:KEY_STRING"
.PD 0
.IP "\fB\-\-key\fR UUID\fB:key:\fRKEY_STRING" 4
.IX Item "--key UUID:key:KEY_STRING"
.IP "\fB\-\-key\fR \fBall:key:\fRKEY_STRING" 4
.IX Item "--key all:key:KEY_STRING"
.PD
\&\f(CW\*(C`NAME\*(C'\fR is the libguestfs device name (eg. \f(CW\*(C`/dev/sda1\*(C'\fR). \f(CW\*(C`UUID\*(C'\fR is
the device UUID. \f(CW\*(C`all\*(C'\fR means try the key against any encrypted
device.
.Sp
Use the specified \f(CW\*(C`KEY_STRING\*(C'\fR as passphrase.
.IP "\fB\-\-key\fR NAME\fB:file:\fRFILENAME" 4
.IX Item "--key NAME:file:FILENAME"
.PD 0
.IP "\fB\-\-key\fR UUID\fB:file:\fRFILENAME" 4
.IX Item "--key UUID:file:FILENAME"
.IP "\fB\-\-key\fR \fBall:file:\fRFILENAME" 4
.IX Item "--key all:file:FILENAME"
.PD
Read the passphrase from \fIFILENAME\fR.
.IP "\fB\-\-key\fR NAME\fB:clevis\fR" 4
.IX Item "--key NAME:clevis"
.PD 0
.IP "\fB\-\-key\fR UUID\fB:clevis\fR" 4
.IX Item "--key UUID:clevis"
.IP "\fB\-\-key\fR \fBall:clevis\fR" 4
.IX Item "--key all:clevis"
.PD
Attempt passphrase\-less unlocking for the device with Clevis, over the
network. Please refer to "ENCRYPTED DISKS" in \fBguestfs\fR\|(3) for more
information on network\-bound disk encryption (NBDE).
.Sp
Note that if any such option is present on the command line, QEMU user
networking will be automatically enabled for the libguestfs appliance.
.RE
.RS 4
.RE
.IP \fB\-\-keys\-from\-stdin\fR 4
.IX Item "--keys-from-stdin"
Read key or passphrase parameters from stdin. The default is
to try to read passphrases from the user by opening \fI/dev/tty\fR.
.Sp
If there are multiple encrypted devices then you may need to supply
multiple keys on stdin, one per line.
.IP \fB\-\-list\-operations\fR 4
.IX Item "--list-operations"
virt\-sysprep プログラムによりサポートされる操作を一覧表示します。
.Sp
These are listed one per line, with one or more single\-space\-separated fields, eg:
.Sp
.Vb 6
\& $ virt\-sysprep \-\-list\-operations
\& bash\-history * Remove the bash history in the guest
\& cron\-spool * Remove user at\-jobs and cron\-jobs
\& dhcp\-client\-state * Remove DHCP client leases
\& dhcp\-server\-state * Remove DHCP server leases
\& [etc]
.Ve
.Sp
The first field is the operation name, which can be supplied to \fI\-\-enable\fR. The second field is a \f(CW\*(C`*\*(C'\fR character if the operation is enabled by default or blank if not. Subsequent fields on the same line are the description of the operation.
.Sp
Before libguestfs 1.17.33 only the first (operation name) field was shown and all operations were enabled by default.
.IP "\fB\-\-mount\-options\fR mp:opts[;mp:opts;...]" 4
.IX Item "--mount-options mp:opts[;mp:opts;...]"
Set the mount options used when libguestfs opens the disk image. Note this has no effect on the guest. It is used when opening certain guests such as ones using the UFS (BSD) filesystem.
.Sp
Use a semicolon\-separated list of \f(CW\*(C`mountpoint:options\*(C'\fR pairs. You may need to quote this list to protect it from the shell.
.Sp
例:
.Sp
.Vb 1
\& \-\-mount\-options "/:noatime"
.Ve
.Sp
これはルートディレクトリを \f(CW\*(C`notime\*(C'\fR でマウントします。 この例:
.Sp
.Vb 1
\& \-\-mount\-options "/:noatime;/var:rw,nodiratime"
.Ve
.Sp
will do the same, plus mount \fI/var\fR with \f(CW\*(C`rw,nodiratime\*(C'\fR.
.IP \fB\-q\fR 4
.IX Item "-q"
.PD 0
.IP \fB\-\-quiet\fR 4
.IX Item "--quiet"
.PD
Don’t print log messages.
.Sp
To enable detailed logging of individual file operations, use \fI\-x\fR.
.IP \fB\-\-network\fR 4
.IX Item "--network"
.PD 0
.IP \fB\-\-no\-network\fR 4
.IX Item "--no-network"
.PD
Enable or disable network access from the guest during the installation.
.Sp
In virt\-sysprep, the network is \fIdisabled\fR by default. You must use \fI\-\-network\fR to enable it, in order that options such as \fI\-\-install\fR or \fI\-\-update\fR will work.
.Sp
\&\fBvirt\-builder\fR\|(1) has more information about the security advantages of disabling the network.
.IP \fB\-v\fR 4
.IX Item "-v"
.PD 0
.IP \fB\-\-verbose\fR 4
.IX Item "--verbose"
.PD
デバッグ用の冗長なメッセージを有効にします。
.IP \fB\-V\fR 4
.IX Item "-V"
.PD 0
.IP \fB\-\-version\fR 4
.IX Item "--version"
.PD
バージョン番号を表示して、終了します。
.IP \fB\-\-wrap\fR 4
.IX Item "--wrap"
Wrap error, warning, and informative messages. This is the default when the output is a tty. If the output of the program is redirected to a file, wrapping is disabled unless you use this option.
.IP \fB\-x\fR 4
.IX Item "-x"
libguestfs API 呼び出しのトレースを有効にします。
.ie n .IP "\fB\-\-append\-line\fR FILE:LINE (see ""customize"" below)" 4
.el .IP "\fB\-\-append\-line\fR FILE:LINE (see \f(CWcustomize\fR below)" 4
.IX Item "--append-line FILE:LINE (see customize below)"
Append a single line of text to the \f(CW\*(C`FILE\*(C'\fR. If the file does not already end with a newline, then one is added before the appended line. Also a newline is added to the end of the \f(CW\*(C`LINE\*(C'\fR string automatically.
.Sp
For example (assuming ordinary shell quoting) this command:
.Sp
.Vb 1
\& \-\-append\-line \*(Aq/etc/hosts:10.0.0.1 foo\*(Aq
.Ve
.Sp
will add either \f(CW\*(C`10.0.0.1 foo⏎\*(C'\fR or \f(CW\*(C`⏎10.0.0.1 foo⏎\*(C'\fR to the file, the latter only if the existing file does not already end with a newline.
.Sp
\&\f(CW\*(C`⏎\*(C'\fR represents a newline character, which is guessed by looking at the existing content of the file, so this command does the right thing for files using Unix or Windows line endings. It also works for empty or non\-existent files.
.Sp
To insert several lines, use the same option several times:
.Sp
.Vb 2
\& \-\-append\-line \*(Aq/etc/hosts:10.0.0.1 foo\*(Aq
\& \-\-append\-line \*(Aq/etc/hosts:10.0.0.2 bar\*(Aq
.Ve
.Sp
To insert a blank line before the appended line, do:
.Sp
.Vb 2
\& \-\-append\-line \*(Aq/etc/hosts:\*(Aq
\& \-\-append\-line \*(Aq/etc/hosts:10.0.0.1 foo\*(Aq
.Ve
.ie n .IP "\fB\-\-chmod\fR PERMISSIONS:FILE (see ""customize"" below)" 4
.el .IP "\fB\-\-chmod\fR PERMISSIONS:FILE (see \f(CWcustomize\fR below)" 4
.IX Item "--chmod PERMISSIONS:FILE (see customize below)"
Change the permissions of \f(CW\*(C`FILE\*(C'\fR to \f(CW\*(C`PERMISSIONS\*(C'\fR.
.Sp
\&\fINote\fR: \f(CW\*(C`PERMISSIONS\*(C'\fR by default would be decimal, unless you prefix it with \f(CW0\fR to get octal, ie. use \f(CW0700\fR not \f(CW700\fR.
.ie n .IP "\fB\-\-chown\fR UID:GID:PATH (see ""customize"" below)" 4
.el .IP "\fB\-\-chown\fR UID:GID:PATH (see \f(CWcustomize\fR below)" 4
.IX Item "--chown UID:GID:PATH (see customize below)"
Change the owner user and group ID of a file or directory in the guest. Note:
.RS 4
.IP \(bu 4
Only numeric UIDs and GIDs will work, and these may not be the same inside the guest as on the host.
.IP \(bu 4
This will not work with Windows guests.
.RE
.RS 4
.Sp
例:
.Sp
.Vb 1
\& virt\-customize \-\-chown \*(Aq0:0:/var/log/audit.log\*(Aq
.Ve
.Sp
See also: \fI\-\-upload\fR.
.RE
.ie n .IP "\fB\-\-commands\-from\-file\fR FILENAME (see ""customize"" below)" 4
.el .IP "\fB\-\-commands\-from\-file\fR FILENAME (see \f(CWcustomize\fR below)" 4
.IX Item "--commands-from-file FILENAME (see customize below)"
Read the customize commands from a file, one (and its arguments) each line.
.Sp
Each line contains a single customization command and its arguments, for example:
.Sp
.Vb 3
\& delete /some/file
\& install some\-package
\& password some\-user:password:its\-new\-password
.Ve
.Sp
Empty lines are ignored, and lines starting with \f(CW\*(C`#\*(C'\fR are comments and are ignored as well. Furthermore, arguments can be spread across multiple lines, by adding a \f(CW\*(C`\e\*(C'\fR (continuation character) at the of a line, for example
.Sp
.Vb 2
\& edit /some/file:\e
\& s/^OPT=.*/OPT=ok/
.Ve
.Sp
The commands are handled in the same order as they are in the file, as if they were specified as \fI\-\-delete /some/file\fR on the command line.
.ie n .IP "\fB\-\-copy\fR SOURCE:DEST (see ""customize"" below)" 4
.el .IP "\fB\-\-copy\fR SOURCE:DEST (see \f(CWcustomize\fR below)" 4
.IX Item "--copy SOURCE:DEST (see customize below)"
Copy files or directories recursively inside the guest.
.Sp
Wildcards cannot be used.
.ie n .IP "\fB\-\-copy\-in\fR LOCALPATH:REMOTEDIR (see ""customize"" below)" 4
.el .IP "\fB\-\-copy\-in\fR LOCALPATH:REMOTEDIR (see \f(CWcustomize\fR below)" 4
.IX Item "--copy-in LOCALPATH:REMOTEDIR (see customize below)"
Copy local files or directories recursively into the disk image, placing them in the directory \f(CW\*(C`REMOTEDIR\*(C'\fR (which must exist).
.Sp
Wildcards cannot be used.
.ie n .IP "\fB\-\-delete\fR PATH (see ""customize"" below)" 4
.el .IP "\fB\-\-delete\fR PATH (see \f(CWcustomize\fR below)" 4
.IX Item "--delete PATH (see customize below)"
Delete a file from the guest. Or delete a directory (and all its contents, recursively).
.Sp
You can use shell glob characters in the specified path. Be careful to escape glob characters from the host shell, if that is required. For example:
.Sp
.Vb 1
\& virt\-customize \-\-delete \*(Aq/var/log/*.log\*(Aq.
.Ve
.Sp
See also: \fI\-\-upload\fR, \fI\-\-scrub\fR.
.ie n .IP "\fB\-\-edit\fR FILE:EXPR (see ""customize"" below)" 4
.el .IP "\fB\-\-edit\fR FILE:EXPR (see \f(CWcustomize\fR below)" 4
.IX Item "--edit FILE:EXPR (see customize below)"
Edit \f(CW\*(C`FILE\*(C'\fR using the Perl expression \f(CW\*(C`EXPR\*(C'\fR.
.Sp
表現がシェルにより変更されるのを防ぐために、適切に引用符でくくるよう注意してください。
.Sp
このオプションは Perl 5 がインストールされているときのみ利用可能であることに注意してください。
.Sp
See "NON\-INTERACTIVE EDITING" in \fBvirt\-edit\fR\|(1).
.ie n .IP "\fB\-\-firstboot\fR SCRIPT (see ""customize"" below)" 4
.el .IP "\fB\-\-firstboot\fR SCRIPT (see \f(CWcustomize\fR below)" 4
.IX Item "--firstboot SCRIPT (see customize below)"
Install \f(CW\*(C`SCRIPT\*(C'\fR inside the guest, so that when the guest first boots up, the script runs (as root, late in the boot process).
.Sp
The script is automatically chmod +x after installation in the guest.
.Sp
The alternative version \fI\-\-firstboot\-command\fR is the same, but it conveniently wraps the command up in a single line script for you.
.Sp
You can have multiple \fI\-\-firstboot\fR options. They run in the same order that they appear on the command line.
.Sp
Please take a look at "FIRST BOOT SCRIPTS" in \fBvirt\-builder\fR\|(1) for more information and caveats about the first boot scripts.
.Sp
See also \fI\-\-run\fR.
.ie n .IP "\fB\-\-firstboot\-command\fR \*(AqCMD+ARGS\*(Aq (see ""customize"" below)" 4
.el .IP "\fB\-\-firstboot\-command\fR \*(AqCMD+ARGS\*(Aq (see \f(CWcustomize\fR below)" 4
.IX Item "--firstboot-command 'CMD+ARGS' (see customize below)"
Run command (and arguments) inside the guest when the guest first boots up (as root, late in the boot process).
.Sp
You can have multiple \fI\-\-firstboot\fR options. They run in the same order that they appear on the command line.
.Sp
Please take a look at "FIRST BOOT SCRIPTS" in \fBvirt\-builder\fR\|(1) for more information and caveats about the first boot scripts.
.Sp
See also \fI\-\-run\fR.
.ie n .IP "\fB\-\-firstboot\-install\fR PKG,PKG.. (see ""customize"" below)" 4
.el .IP "\fB\-\-firstboot\-install\fR PKG,PKG.. (see \f(CWcustomize\fR below)" 4
.IX Item "--firstboot-install PKG,PKG.. (see customize below)"
Install the named packages (a comma\-separated list). These are installed when the guest first boots using the guest’s package manager (eg. apt, yum, etc.) and the guest’s network connection.
.Sp
For an overview on the different ways to install packages, see "INSTALLING PACKAGES" in \fBvirt\-builder\fR\|(1).
.ie n .IP "\fB\-\-hostname\fR HOSTNAME (see ""customize"" below)" 4
.el .IP "\fB\-\-hostname\fR HOSTNAME (see \f(CWcustomize\fR below)" 4
.IX Item "--hostname HOSTNAME (see customize below)"
Set the hostname of the guest to \f(CW\*(C`HOSTNAME\*(C'\fR. You can use a dotted hostname.domainname (FQDN) if you want.
.ie n .IP "\fB\-\-inject\-qemu\-ga\fR METHOD (see ""customize"" below)" 4
.el .IP "\fB\-\-inject\-qemu\-ga\fR METHOD (see \f(CWcustomize\fR below)" 4
.IX Item "--inject-qemu-ga METHOD (see customize below)"
Inject the QEMU Guest Agent into a Windows guest. The guest agent communicates with qemu through a socket in order to provide enhanced features (see \fBqemu\-ga\fR\|(8)). This operation also injects a firstboot script so that the Guest Agent is installed when the guest boots.
.Sp
The parameter is the same as used by the \fI\-\-inject\-virtio\-win\fR operation.
.Sp
Note that to do a full conversion of a Windows guest from a foreign hypervisor like VMware (which involves many other operations) you should use the \fBvirt\-v2v\fR\|(1) tool instead of this.
.ie n .IP "\fB\-\-inject\-virtio\-win\fR METHOD (see ""customize"" below)" 4
.el .IP "\fB\-\-inject\-virtio\-win\fR METHOD (see \f(CWcustomize\fR below)" 4
.IX Item "--inject-virtio-win METHOD (see customize below)"
Inject virtio\-win drivers into a Windows guest. These drivers add virtio accelerated drivers suitable when running on top of a hypervisor that supports virtio (such as qemu/KVM). The operation also adjusts the Windows Registry so that the drivers are installed when the guest boots.
.Sp
The parameter can be one of:
.RS 4
.IP ISO 4
.IX Item "ISO"
The path to the ISO image containing the virtio\-win drivers (eg. \fI/usr/share/virtio\-win/virtio\-win.iso\fR).
.IP DIR 4
.IX Item "DIR"
The directory containing the unpacked virtio\-win drivers (eg. \fI/usr/share/virtio\-win\fR).
.IP "\fB""osinfo""\fR" 4
.IX Item """osinfo"""
The literal string \f(CW"osinfo"\fR means to use the libosinfo database to locate the drivers. (See \fBosinfo\-query\fR\|(1).
.RE
.RS 4
.Sp
Note that to do a full conversion of a Windows guest from a foreign hypervisor like VMware (which involves many other operations) you should use the \fBvirt\-v2v\fR\|(1) tool instead of this.
.RE
.ie n .IP "\fB\-\-install\fR PKG,PKG.. (see ""customize"" below)" 4
.el .IP "\fB\-\-install\fR PKG,PKG.. (see \f(CWcustomize\fR below)" 4
.IX Item "--install PKG,PKG.. (see customize below)"
Install the named packages (a comma\-separated list). These are installed during the image build using the guest’s package manager (eg. apt, yum, etc.) and the host’s network connection.
.Sp
For an overview on the different ways to install packages, see "INSTALLING PACKAGES" in \fBvirt\-builder\fR\|(1).
.Sp
See also \fI\-\-update\fR, \fI\-\-uninstall\fR.
.ie n .IP "\fB\-\-keep\-user\-accounts\fR USERS (see ""user\-account"" below)" 4
.el .IP "\fB\-\-keep\-user\-accounts\fR USERS (see \f(CWuser\-account\fR below)" 4
.IX Item "--keep-user-accounts USERS (see user-account below)"
The user accounts to be kept in the guest. The value of this option is a list of user names separated by comma, where specifying an user means it is going to be kept. For example:
.Sp
.Vb 1
\& \-\-keep\-user\-accounts mary
.Ve
.Sp
would keep the user account \f(CW\*(C`mary\*(C'\fR.
.Sp
This option can be specified multiple times.
.ie n .IP "\fB\-\-link\fR TARGET:LINK[:LINK..] (see ""customize"" below)" 4
.el .IP "\fB\-\-link\fR TARGET:LINK[:LINK..] (see \f(CWcustomize\fR below)" 4
.IX Item "--link TARGET:LINK[:LINK..] (see customize below)"
Create symbolic link(s) in the guest, starting at \f(CW\*(C`LINK\*(C'\fR and pointing at \f(CW\*(C`TARGET\*(C'\fR.
.ie n .IP "\fB\-\-mkdir\fR DIR (see ""customize"" below)" 4
.el .IP "\fB\-\-mkdir\fR DIR (see \f(CWcustomize\fR below)" 4
.IX Item "--mkdir DIR (see customize below)"
Create a directory in the guest.
.Sp
This uses \f(CW\*(C`mkdir\ \-p\*(C'\fR so any intermediate directories are created, and it also works if the directory already exists.
.ie n .IP "\fB\-\-move\fR SOURCE:DEST (see ""customize"" below)" 4
.el .IP "\fB\-\-move\fR SOURCE:DEST (see \f(CWcustomize\fR below)" 4
.IX Item "--move SOURCE:DEST (see customize below)"
Move files or directories inside the guest.
.Sp
Wildcards cannot be used.
.ie n .IP "\fB\-\-no\-logfile\fR (see ""customize"" below)" 4
.el .IP "\fB\-\-no\-logfile\fR (see \f(CWcustomize\fR below)" 4
.IX Item "--no-logfile (see customize below)"
Scrub \f(CW\*(C`builder.log\*(C'\fR (log file from build commands) from the image after building is complete. If you don\*(Aqt want to reveal precisely how the image was built, use this option.
.Sp
See also: "LOG FILE".
.ie n .IP "\fB\-\-no\-selinux\-relabel\fR (see ""customize"" below)" 4
.el .IP "\fB\-\-no\-selinux\-relabel\fR (see \f(CWcustomize\fR below)" 4
.IX Item "--no-selinux-relabel (see customize below)"
Do not attempt to correct the SELinux labels of files in the guest.
.Sp
In such guests that support SELinux, customization automatically relabels files so that they have the correct SELinux label. (The relabeling is performed immediately, but if the operation fails, customization will instead touch \fI/.autorelabel\fR on the image to schedule a relabel operation for the next time the image boots.) This option disables the automatic relabeling.
.Sp
The option is a no\-op for guests that do not support SELinux.
.ie n .IP "\fB\-\-password\fR USER:SELECTOR (see ""customize"" below)" 4
.el .IP "\fB\-\-password\fR USER:SELECTOR (see \f(CWcustomize\fR below)" 4
.IX Item "--password USER:SELECTOR (see customize below)"
Set the password for \f(CW\*(C`USER\*(C'\fR. (Note this option does \fInot\fR create the user account).
.Sp
See "USERS AND PASSWORDS" in \fBvirt\-builder\fR\|(1) for the format of the \f(CW\*(C`SELECTOR\*(C'\fR field, and also how to set up user accounts.
.ie n .IP "\fB\-\-password\-crypto\fR md5|sha256|sha512 (see ""customize"" below)" 4
.el .IP "\fB\-\-password\-crypto\fR md5|sha256|sha512 (see \f(CWcustomize\fR below)" 4
.IX Item "--password-crypto md5|sha256|sha512 (see customize below)"
When the virt tools change or set a password in the guest, this option sets the password encryption of that password to \f(CW\*(C`md5\*(C'\fR, \f(CW\*(C`sha256\*(C'\fR or \f(CW\*(C`sha512\*(C'\fR.
.Sp
\&\f(CW\*(C`sha256\*(C'\fR and \f(CW\*(C`sha512\*(C'\fR require glibc ≥ 2.7 (check \fBcrypt\fR\|(3) inside the guest).
.Sp
\&\f(CW\*(C`md5\*(C'\fR will work with relatively old Linux guests (eg. RHEL 3), but is not secure against modern attacks.
.Sp
The default is \f(CW\*(C`sha512\*(C'\fR unless libguestfs detects an old guest that didn\*(Aqt have support for SHA\-512, in which case it will use \f(CW\*(C`md5\*(C'\fR. You can override libguestfs by specifying this option.
.Sp
Note this does not change the default password encryption used by the guest when you create new user accounts inside the guest. If you want to do that, then you should use the \fI\-\-edit\fR option to modify \f(CW\*(C`/etc/sysconfig/authconfig\*(C'\fR (Fedora, RHEL) or \f(CW\*(C`/etc/pam.d/common\-password\*(C'\fR (Debian, Ubuntu).
.ie n .IP "\fB\-\-remove\-user\-accounts\fR USERS (see ""user\-account"" below)" 4
.el .IP "\fB\-\-remove\-user\-accounts\fR USERS (see \f(CWuser\-account\fR below)" 4
.IX Item "--remove-user-accounts USERS (see user-account below)"
The user accounts to be removed from the guest. The value of this option is a list of user names separated by comma, where specifying an user means it is going to be removed. For example:
.Sp
.Vb 1
\& \-\-remove\-user\-accounts bob,eve
.Ve
.Sp
would only remove the user accounts \f(CW\*(C`bob\*(C'\fR and \f(CW\*(C`eve\*(C'\fR.
.Sp
This option can be specified multiple times.
.ie n .IP "\fB\-\-root\-password\fR SELECTOR (see ""customize"" below)" 4
.el .IP "\fB\-\-root\-password\fR SELECTOR (see \f(CWcustomize\fR below)" 4
.IX Item "--root-password SELECTOR (see customize below)"
Set the root password.
.Sp
See "USERS AND PASSWORDS" in \fBvirt\-builder\fR\|(1) for the format of the \f(CW\*(C`SELECTOR\*(C'\fR field, and also how to set up user accounts.
.Sp
Note: In virt\-builder, if you \fIdon\*(Aqt\fR set \fI\-\-root\-password\fR then the guest is given a \fIrandom\fR root password.
.ie n .IP "\fB\-\-run\fR SCRIPT (see ""customize"" below)" 4
.el .IP "\fB\-\-run\fR SCRIPT (see \f(CWcustomize\fR below)" 4
.IX Item "--run SCRIPT (see customize below)"
Run the shell script (or any program) called \f(CW\*(C`SCRIPT\*(C'\fR on the disk image. The script runs virtualized inside a small appliance, chrooted into the guest filesystem.
.Sp
The script is automatically chmod +x.
.Sp
If libguestfs supports it then a limited network connection is available but it only allows outgoing network connections. You can also attach data disks (eg. ISO files) as another way to provide data (eg. software packages) to the script without needing a network connection (\fI\-\-attach\fR). You can also upload data files (\fI\-\-upload\fR).
.Sp
You can have multiple \fI\-\-run\fR options. They run in the same order that they appear on the command line.
.Sp
See also: \fI\-\-firstboot\fR, \fI\-\-attach\fR, \fI\-\-upload\fR.
.ie n .IP "\fB\-\-run\-command\fR \*(AqCMD+ARGS\*(Aq (see ""customize"" below)" 4
.el .IP "\fB\-\-run\-command\fR \*(AqCMD+ARGS\*(Aq (see \f(CWcustomize\fR below)" 4
.IX Item "--run-command 'CMD+ARGS' (see customize below)"
Run the command and arguments on the disk image. The command runs virtualized inside a small appliance, chrooted into the guest filesystem.
.Sp
If libguestfs supports it then a limited network connection is available but it only allows outgoing network connections. You can also attach data disks (eg. ISO files) as another way to provide data (eg. software packages) to the script without needing a network connection (\fI\-\-attach\fR). You can also upload data files (\fI\-\-upload\fR).
.Sp
You can have multiple \fI\-\-run\-command\fR options. They run in the same order that they appear on the command line.
.Sp
See also: \fI\-\-firstboot\fR, \fI\-\-attach\fR, \fI\-\-upload\fR.
.ie n .IP "\fB\-\-script\fR SCRIPT (see ""script"" below)" 4
.el .IP "\fB\-\-script\fR SCRIPT (see \f(CWscript\fR below)" 4
.IX Item "--script SCRIPT (see script below)"
Run the named \f(CW\*(C`SCRIPT\*(C'\fR (a shell script or program) against the guest. The script can be any program on the host. The script’s current directory will be the guest’s root directory.
.Sp
\&\fBNote:\fR If the script is not on the \f(CW$PATH\fR, then you must give the full absolute path to the script.
.ie n .IP "\fB\-\-scriptdir\fR SCRIPTDIR (see ""script"" below)" 4
.el .IP "\fB\-\-scriptdir\fR SCRIPTDIR (see \f(CWscript\fR below)" 4
.IX Item "--scriptdir SCRIPTDIR (see script below)"
The mount point (an empty directory on the host) used when the \f(CW\*(C`script\*(C'\fR operation is enabled and one or more scripts are specified using \fI\-\-script\fR parameter(s).
.Sp
\&\fBNote:\fR \f(CW\*(C`SCRIPTDIR\*(C'\fR \fBmust\fR be an absolute path.
.Sp
If \fI\-\-scriptdir\fR is not specified then a temporary mountpoint will be created.
.ie n .IP "\fB\-\-scrub\fR FILE (see ""customize"" below)" 4
.el .IP "\fB\-\-scrub\fR FILE (see \f(CWcustomize\fR below)" 4
.IX Item "--scrub FILE (see customize below)"
Scrub a file from the guest. This is like \fI\-\-delete\fR except that:
.RS 4
.IP \(bu 4
It scrubs the data so a guest could not recover it.
.IP \(bu 4
It cannot delete directories, only regular files.
.RE
.RS 4
.RE
.ie n .IP "\fB\-\-selinux\-relabel\fR (see ""customize"" below)" 4
.el .IP "\fB\-\-selinux\-relabel\fR (see \f(CWcustomize\fR below)" 4
.IX Item "--selinux-relabel (see customize below)"
This is a compatibility option that does nothing.
.ie n .IP "\fB\-\-sm\-attach\fR SELECTOR (see ""customize"" below)" 4
.el .IP "\fB\-\-sm\-attach\fR SELECTOR (see \f(CWcustomize\fR below)" 4
.IX Item "--sm-attach SELECTOR (see customize below)"
Attach to a pool using \f(CW\*(C`subscription\-manager\*(C'\fR.
.Sp
See "SUBSCRIPTION\-MANAGER" in \fBvirt\-builder\fR\|(1) for the format of the \f(CW\*(C`SELECTOR\*(C'\fR field.
.ie n .IP "\fB\-\-sm\-credentials\fR SELECTOR (see ""customize"" below)" 4
.el .IP "\fB\-\-sm\-credentials\fR SELECTOR (see \f(CWcustomize\fR below)" 4
.IX Item "--sm-credentials SELECTOR (see customize below)"
Set the credentials for \f(CW\*(C`subscription\-manager\*(C'\fR.
.Sp
See "SUBSCRIPTION\-MANAGER" in \fBvirt\-builder\fR\|(1) for the format of the \f(CW\*(C`SELECTOR\*(C'\fR field.
.ie n .IP "\fB\-\-sm\-register\fR (see ""customize"" below)" 4
.el .IP "\fB\-\-sm\-register\fR (see \f(CWcustomize\fR below)" 4
.IX Item "--sm-register (see customize below)"
Register the guest using \f(CW\*(C`subscription\-manager\*(C'\fR.
.Sp
This requires credentials being set using \fI\-\-sm\-credentials\fR.
.ie n .IP "\fB\-\-sm\-remove\fR (see ""customize"" below)" 4
.el .IP "\fB\-\-sm\-remove\fR (see \f(CWcustomize\fR below)" 4
.IX Item "--sm-remove (see customize below)"
Remove all the subscriptions from the guest using \f(CW\*(C`subscription\-manager\*(C'\fR.
.ie n .IP "\fB\-\-sm\-unregister\fR (see ""customize"" below)" 4
.el .IP "\fB\-\-sm\-unregister\fR (see \f(CWcustomize\fR below)" 4
.IX Item "--sm-unregister (see customize below)"
Unregister the guest using \f(CW\*(C`subscription\-manager\*(C'\fR.
.ie n .IP "\fB\-\-ssh\-inject\fR USER[:SELECTOR] (see ""customize"" below)" 4
.el .IP "\fB\-\-ssh\-inject\fR USER[:SELECTOR] (see \f(CWcustomize\fR below)" 4
.IX Item "--ssh-inject USER[:SELECTOR] (see customize below)"
Inject an ssh key so the given \f(CW\*(C`USER\*(C'\fR will be able to log in over ssh without supplying a password. The \f(CW\*(C`USER\*(C'\fR must exist already in the guest.
.Sp
See "SSH KEYS" in \fBvirt\-builder\fR\|(1) for the format of the \f(CW\*(C`SELECTOR\*(C'\fR field.
.Sp
You can have multiple \fI\-\-ssh\-inject\fR options, for different users and also for more keys for each user.
.ie n .IP "\fB\-\-tar\-in\fR TARFILE:REMOTEDIR (see ""customize"" below)" 4
.el .IP "\fB\-\-tar\-in\fR TARFILE:REMOTEDIR (see \f(CWcustomize\fR below)" 4
.IX Item "--tar-in TARFILE:REMOTEDIR (see customize below)"
Copy local files or directories from a local tar file called \f(CW\*(C`TARFILE\*(C'\fR into the disk image, placing them in the directory \f(CW\*(C`REMOTEDIR\*(C'\fR (which must exist). Note that the tar file must be uncompressed (\fI.tar.gz\fR files will not work here)
.ie n .IP "\fB\-\-timezone\fR TIMEZONE (see ""customize"" below)" 4
.el .IP "\fB\-\-timezone\fR TIMEZONE (see \f(CWcustomize\fR below)" 4
.IX Item "--timezone TIMEZONE (see customize below)"
Set the default timezone of the guest to \f(CW\*(C`TIMEZONE\*(C'\fR. Use a location string like \f(CW\*(C`Europe/London\*(C'\fR
.ie n .IP "\fB\-\-touch\fR FILE (see ""customize"" below)" 4
.el .IP "\fB\-\-touch\fR FILE (see \f(CWcustomize\fR below)" 4
.IX Item "--touch FILE (see customize below)"
This command performs a \fBtouch\fR\|(1)\-like operation on \f(CW\*(C`FILE\*(C'\fR.
.ie n .IP "\fB\-\-truncate\fR FILE (see ""customize"" below)" 4
.el .IP "\fB\-\-truncate\fR FILE (see \f(CWcustomize\fR below)" 4
.IX Item "--truncate FILE (see customize below)"
This command truncates \f(CW\*(C`FILE\*(C'\fR to a zero\-length file. The file must exist already.
.ie n .IP "\fB\-\-truncate\-recursive\fR PATH (see ""customize"" below)" 4
.el .IP "\fB\-\-truncate\-recursive\fR PATH (see \f(CWcustomize\fR below)" 4
.IX Item "--truncate-recursive PATH (see customize below)"
This command recursively truncates all files under \f(CW\*(C`PATH\*(C'\fR to zero\-length.
.ie n .IP "\fB\-\-uninstall\fR PKG,PKG.. (see ""customize"" below)" 4
.el .IP "\fB\-\-uninstall\fR PKG,PKG.. (see \f(CWcustomize\fR below)" 4
.IX Item "--uninstall PKG,PKG.. (see customize below)"
Uninstall the named packages (a comma\-separated list). These are removed during the image build using the guest’s package manager (eg. apt, yum, etc.). Dependent packages may also need to be uninstalled to satisfy the request.
.Sp
See also \fI\-\-install\fR, \fI\-\-update\fR.
.ie n .IP "\fB\-\-update\fR (see ""customize"" below)" 4
.el .IP "\fB\-\-update\fR (see \f(CWcustomize\fR below)" 4
.IX Item "--update (see customize below)"
Do the equivalent of \f(CW\*(C`yum update\*(C'\fR, \f(CW\*(C`apt\-get upgrade\*(C'\fR, or whatever command is required to update the packages already installed in the template to their latest versions.
.Sp
See also \fI\-\-install\fR, \fI\-\-uninstall\fR.
.ie n .IP "\fB\-\-upload\fR FILE:DEST (see ""customize"" below)" 4
.el .IP "\fB\-\-upload\fR FILE:DEST (see \f(CWcustomize\fR below)" 4
.IX Item "--upload FILE:DEST (see customize below)"
Upload local file \f(CW\*(C`FILE\*(C'\fR to destination \f(CW\*(C`DEST\*(C'\fR in the disk image. File owner and permissions from the original are preserved, so you should set them to what you want them to be in the disk image.
.Sp
\&\f(CW\*(C`DEST\*(C'\fR could be the final filename. This can be used to rename the file on upload.
.Sp
If \f(CW\*(C`DEST\*(C'\fR is a directory name (which must already exist in the guest) then the file is uploaded into that directory, and it keeps the same name as on the local filesystem.
.Sp
See also: \fI\-\-mkdir\fR, \fI\-\-delete\fR, \fI\-\-scrub\fR.
.ie n .IP "\fB\-\-write\fR FILE:CONTENT (see ""customize"" below)" 4
.el .IP "\fB\-\-write\fR FILE:CONTENT (see \f(CWcustomize\fR below)" 4
.IX Item "--write FILE:CONTENT (see customize below)"
Write \f(CW\*(C`CONTENT\*(C'\fR to \f(CW\*(C`FILE\*(C'\fR.
.SH OPERATIONS
.IX Header "OPERATIONS"
If the \fI\-\-enable\fR/\fI\-\-operations\fR option is \fInot\fR given, then most sysprep operations are enabled.
.PP
Use \f(CW\*(C`virt\-sysprep \-\-list\-operations\*(C'\fR to list all operations for your virt\-sysprep binary. The ones which are enabled by default are marked with a \f(CW\*(C`*\*(C'\fR character. Regardless of the \fI\-\-enable\fR/\fI\-\-operations\fR options, sysprep operations are skipped for some guest types.
.PP
Operations can be individually enabled using the \fI\-\-enable\fR/\fI\-\-operations\fR options. Use a comma\-separated list, for example:
.PP
.Vb 1
\& virt\-sysprep \-\-operations ssh\-hostkeys,udev\-persistent\-net [etc..]
.Ve
.PP
Future versions of virt\-sysprep may add more operations. If you are using virt\-sysprep and want predictable behaviour, specify only the operations that you want to have enabled.
.PP
\&\f(CW\*(C`*\*(C'\fR = enabled by default when no \fI\-\-enable\fR/\fI\-\-operations\fR option is given.
.SS "\fBabrt\-data\fP *"
.IX Subsection "abrt-data *"
ABRT により生成されたクラッシュデータを削除します。
.PP
\&\f(CW\*(C`/var/spool/abrt/\*(C'\fR に自動的に生成された ABRT クラッシュデータを削除します。
.SS "\fBbackup\-files\fP *"
.IX Subsection "backup-files *"
Remove editor backup files from the guest.
.PP
The following files are removed from anywhere in the guest filesystem:
.IP · 4
*.bak
.IP · 4
*~
.PP
On Linux and Unix operating systems, only the following filesystems will be examined:
.IP · 4
/etc
.IP · 4
/root
.IP · 4
/srv
.IP · 4
/tmp
.IP · 4
/var
.SS "\fBbash\-history\fP *"
.IX Subsection "bash-history *"
仮想マシンにおいて bash 履歴を削除します。
.PP
ユーザー "root" および他のあらゆるユーザーのホームディレクトリーに \f(CW\*(C`.bash_history\*(C'\fR ファイルを持つユーザーの bash 履歴を削除します。
.PP
\fINotes on bash\-history\fR
.IX Subsection "Notes on bash-history"
.PP
Currently this only looks in \f(CW\*(C`/root\*(C'\fR and \f(CW\*(C`/home/*\*(C'\fR for home directories, so users with home directories in other locations won\*(Aqt have the bash history removed.
.SS "\fBblkid\-tab\fP *"
.IX Subsection "blkid-tab *"
ゲストにある blkid テーブルを削除します。
.SS \fBca\-certificates\fP
.IX Subsection "ca-certificates"
仮想マシンにおいて CA 証明書を削除します。
.PP
In case any certificate is removed, the system CA store is updated.
.SS "\fBcrash\-data\fP *"
.IX Subsection "crash-data *"
kexec\-tools により生成されたクラッシュデータを削除します。
.PP
自動的に生成された kdump カーネルクラッシュデータを削除します。
.SS "\fBcron\-spool\fP *"
.IX Subsection "cron-spool *"
ユーザーの at ジョブおよび cron ジョブを削除します。
.SS "\fBcustomize\fP *"
.IX Subsection "customize *"
Customize the guest.
.PP
Customize the guest by providing \fBvirt\-customize\fR\|(1) options for installing packages, editing files and so on.
.SS "\fBdhcp\-client\-state\fP *"
.IX Subsection "dhcp-client-state *"
DHCP クライアントのリースを削除します。
.SS "\fBdhcp\-server\-state\fP *"
.IX Subsection "dhcp-server-state *"
DHCP サーバーのリースを削除します。
.SS "\fBdovecot\-data\fP *"
.IX Subsection "dovecot-data *"
Dovecot (メールサーバー) のデータを削除します。
.SS \fBfirewall\-rules\fP
.IX Subsection "firewall-rules"
ファイアウォールルールを削除します。
.PP
This removes custom firewall rules by removing \f(CW\*(C`/etc/sysconfig/iptables\*(C'\fR or custom firewalld configuration in \f(CW\*(C`/etc/firewalld/*/*\*(C'\fR.
.PP
Note this is \fInot\fR enabled by default since it may expose guests to exploits. Use with care.
.SS \fBflag\-reconfiguration\fP
.IX Subsection "flag-reconfiguration"
Flag the system for reconfiguration.
.PP
For Linux guests, this touches \f(CW\*(C`/.unconfigured\*(C'\fR, which causes the first boot to interactively query the user for settings such as the root password and timezone.
.SS \fBfs\-uuids\fP
.IX Subsection "fs-uuids"
Change filesystem UUIDs.
.PP
On guests and filesystem types where this is supported, new random UUIDs are generated and assigned to filesystems.
.PP
\fINotes on fs\-uuids\fR
.IX Subsection "Notes on fs-uuids"
.PP
The fs\-uuids operation is disabled by default because it does not yet find and update all the places in the guest that use the UUIDs. For example \f(CW\*(C`/etc/fstab\*(C'\fR or the bootloader. Enabling this operation is more likely than not to make your guest unbootable.
.PP
参照: https://bugzilla.redhat.com/show_bug.cgi?id=991641
.SS "\fBipa\-client\fP *"
.IX Subsection "ipa-client *"
Remove the IPA files.
.PP
Remove all the files related to an IPA (Identity, Policy, Audit) system. This effectively unenrolls the guest from an IPA server without interacting with it.
.PP
This operation does not run \f(CW\*(C`ipa\-client\*(C'\fR.
.SS \fBkerberos\-data\fP
.IX Subsection "kerberos-data"
仮想マシンにおいて Kerberos のデータを削除します。
.SS "\fBkerberos\-hostkeytab\fP *"
.IX Subsection "kerberos-hostkeytab *"
Remove the Kerberos host keytab file in the guest.
.SS "\fBlogfiles\fP *"
.IX Subsection "logfiles *"
仮想マシンから多くのログファイルを削除します。
.PP
Linux においては以下のファイルが削除されます:
.IP · 4
/etc/Pegasus/*.cnf
.IP · 4
/etc/Pegasus/*.crt
.IP · 4
/etc/Pegasus/*.csr
.IP · 4
/etc/Pegasus/*.pem
.IP · 4
/etc/Pegasus/*.srl
.IP · 4
/root/anaconda\-ks.cfg
.IP · 4
/root/anaconda\-post.log
.IP · 4
/root/initial\-setup\-ks.cfg
.IP · 4
/root/install.log
.IP · 4
/root/install.log.syslog
.IP · 4
/root/original\-ks.cfg
.IP · 4
/var/cache/fontconfig/*
.IP · 4
/var/cache/gdm/*
.IP · 4
/var/cache/man/*
.IP · 4
/var/lib/AccountService/users/*
.IP · 4
/var/lib/fprint/*
.IP · 4
/var/lib/logrotate.status
.IP · 4
/var/log/*.log*
.IP · 4
/var/log/BackupPC/LOG
.IP · 4
/var/log/ConsoleKit/*
.IP · 4
/var/log/anaconda.syslog
.IP · 4
/var/log/anaconda/*
.IP · 4
/var/log/apache2/*_log
.IP · 4
/var/log/apache2/*_log\-*
.IP · 4
/var/log/apt/*
.IP · 4
/var/log/aptitude*
.IP · 4
/var/log/audit/*
.IP · 4
/var/log/btmp*
.IP · 4
/var/log/ceph/*.log
.IP · 4
/var/log/chrony/*.log
.IP · 4
/var/log/cron*
.IP · 4
/var/log/cups/*_log*
.IP · 4
/var/log/debug*
.IP · 4
/var/log/dmesg*
.IP · 4
/var/log/exim4/*
.IP · 4
/var/log/faillog*
.IP · 4
/var/log/firewalld*
.IP · 4
/var/log/gdm/*
.IP · 4
/var/log/glusterfs/*glusterd.vol.log
.IP · 4
/var/log/glusterfs/glusterfs.log
.IP · 4
/var/log/grubby*
.IP · 4
/var/log/httpd/*log
.IP · 4
/var/log/installer/*
.IP · 4
/var/log/jetty/jetty\-console.log
.IP · 4
/var/log/journal/*
.IP · 4
/var/log/lastlog*
.IP · 4
/var/log/libvirt/libvirtd.log
.IP · 4
/var/log/libvirt/libxl/*.log
.IP · 4
/var/log/libvirt/lxc/*.log
.IP · 4
/var/log/libvirt/qemu/*.log
.IP · 4
/var/log/libvirt/uml/*.log
.IP · 4
/var/log/lightdm/*
.IP · 4
/var/log/mail/*
.IP · 4
/var/log/maillog*
.IP · 4
/var/log/messages*
.IP · 4
/var/log/ntp
.IP · 4
/var/log/ntpstats/*
.IP · 4
/var/log/ppp/connect\-errors
.IP · 4
/var/log/rhsm/*
.IP · 4
/var/log/sa/*
.IP · 4
/var/log/secure*
.IP · 4
/var/log/setroubleshoot/*.log
.IP · 4
/var/log/spooler*
.IP · 4
/var/log/squid/*.log
.IP · 4
/var/log/syslog*
.IP · 4
/var/log/tallylog*
.IP · 4
/var/log/tuned/tuned.log
.IP · 4
/var/log/wtmp*
.IP · 4
/var/log/xferlog*
.IP · 4
/var/named/data/named.run
.SS "\fBlvm\-system\-devices\fP *"
.IX Subsection "lvm-system-devices *"
Remove LVM2 system.devices file.
.PP
On Linux guests, LVM2\*(Aqs scanning for physical volumes (PVs) may be restricted to those block devices whose WWIDs are listed in \f(CW\*(C`/etc/lvm/devices/system.devices\*(C'\fR. When cloning VMs, WWIDs may change, breaking \f(CW\*(C`lvm pvscan\*(C'\fR. Remove \f(CW\*(C`/etc/lvm/devices/system.devices\*(C'\fR.
.SS "\fBlvm\-uuids\fP *"
.IX Subsection "lvm-uuids *"
LVM2 の PV および VG の UUID を変更します。
.PP
LVM2 物理ボリューム (PV) またはボリュームグループ (VG) を持つ Linux 仮想マシンにおいて、新しいランダムな UUID が生成され、これらの PV や VG に割り当てられます。
.SS "\fBmachine\-id\fP *"
.IX Subsection "machine-id *"
ローカルマシン ID を削除します。
.PP
The machine ID is usually generated from a random source during system installation and stays constant for all subsequent boots. Optionally, for stateless systems it is generated during runtime at boot if it is found to be empty.
.SS "\fBmail\-spool\fP *"
.IX Subsection "mail-spool *"
ローカルのメールスプールのディレクトリから電子メールを削除します。
.SS "\fBnet\-hostname\fP *"
.IX Subsection "net-hostname *"
Remove HOSTNAME and DHCP_HOSTNAME in network interface configuration.
.PP
Fedora および Red Hat Enterprise Linux に対して、これは \f(CW\*(C`ifcfg\-*\*(C'\fR ファイルから削除されます。
.SS "\fBnet\-hwaddr\fP *"
.IX Subsection "net-hwaddr *"
HWADDR (ハードコードされた MAC アドレス) 設定を削除します。
.PP
Fedora および Red Hat Enterprise Linux に対して、これは \f(CW\*(C`ifcfg\-*\*(C'\fR ファイルから削除されます。
.SS "\fBnet\-nmconn\fP *"
.IX Subsection "net-nmconn *"
Remove system\-local NetworkManager connection profiles (keyfiles).
.PP
On Fedora and Red Hat Enterprise Linux, remove the \f(CW\*(C`/etc/NetworkManager/system\-connections/*.nmconnection\*(C'\fR files.
.SS "\fBpacct\-log\fP *"
.IX Subsection "pacct-log *"
プロセス・アカウンティングのログファイルを削除します。
.PP
プロセス・アカウンティングが有効になっていると、システム全体のプロセス・アカウンティングが pacct ログファイルに保存されます。
.SS "\fBpackage\-manager\-cache\fP *"
.IX Subsection "package-manager-cache *"
パッケージマネージャーのキャッシュを削除します。
.SS "\fBpam\-data\fP *"
.IX Subsection "pam-data *"
ゲストにある PAM データを削除します。
.SS "\fBpasswd\-backups\fP *"
.IX Subsection "passwd-backups *"
Remove /etc/passwd\- and similar backup files.
.PP
Linux においては以下のファイルが削除されます:
.IP · 4
/etc/group\-
.IP · 4
/etc/gshadow\-
.IP · 4
/etc/passwd\-
.IP · 4
/etc/shadow\-
.IP · 4
/etc/subgid\-
.IP · 4
/etc/subuid\-
.SS "\fBpuppet\-data\-log\fP *"
.IX Subsection "puppet-data-log *"
Puppet のデータおよびログファイルを削除します。
.SS "\fBrh\-subscription\-manager\fP *"
.IX Subsection "rh-subscription-manager *"
Remove the RH subscription manager files.
.SS "\fBrhn\-systemid\fP *"
.IX Subsection "rhn-systemid *"
RHN システム ID を削除します。
.SS "\fBrpm\-db\fP *"
.IX Subsection "rpm-db *"
Remove host\-specific RPM database files.
.PP
Remove host\-specific RPM database files and locks. RPM will recreate these files automatically if needed.
.SS "\fBsamba\-db\-log\fP *"
.IX Subsection "samba-db-log *"
Samba のデータベースおよびログファイルを削除します。
.SS "\fBscript\fP *"
.IX Subsection "script *"
仮想マシンに対して任意のスクリプトを実行します。
.PP
The \f(CW\*(C`script\*(C'\fR module lets you run arbitrary shell scripts or programs against the guest.
.PP
Note this feature requires FUSE support. You may have to enable this in your host, for example by adding the current user to the \f(CW\*(C`fuse\*(C'\fR group, or by loading a kernel module.
.PP
Use one or more \fI\-\-script\fR parameters to specify scripts or programs that will be run against the guest.
.PP
The script or program is run with its current directory being the guest’s root directory, so relative paths should be used. For example: \f(CW\*(C`rm etc/resolv.conf\*(C'\fR in the script would remove a Linux guest’s DNS configuration file, but \f(CW\*(C`rm /etc/resolv.conf\*(C'\fR would (try to) remove the host’s file.
.PP
Normally a temporary mount point for the guest is used, but you can choose a specific one by using the \fI\-\-scriptdir\fR parameter.
.PP
\&\fBNote:\fR This is different from \fI\-\-firstboot\fR scripts (which run in the context of the guest when it is booting first time). \fI\-\-script\fR scripts run on the host, not in the guest.
.SS "\fBsmolt\-uuid\fP *"
.IX Subsection "smolt-uuid *"
Smolt ハードウェア UUID を削除します。
.SS "\fBssh\-hostkeys\fP *"
.IX Subsection "ssh-hostkeys *"
仮想マシンの SSH ホストキーを削除します。
.PP
仮想マシンの次回起動時に(異なる) SSH ホストキーが再生成されます。
.PP
クローン後、仮想マシンが同じ IP アドレスを取得すると、ホストキーが変更されたという警告が ssh により表示されます:
.PP
.Vb 4
\& @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
\& @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
\& @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
\& IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
.Ve
.SS "\fBssh\-userdir\fP *"
.IX Subsection "ssh-userdir *"
仮想マシンにある ".ssh" ディレクトリーを削除します。
.PP
ユーザー "root" 、およびホームディレクトリーに \f(CW\*(C`.ssh\*(C'\fR ディレクトリーがある他のすべてのユーザーの、\f(CW\*(C`.ssh\*(C'\fR ディレクトリーを削除します。
.PP
\fINotes on ssh\-userdir\fR
.IX Subsection "Notes on ssh-userdir"
.PP
Currently this only looks in \f(CW\*(C`/root\*(C'\fR and \f(CW\*(C`/home/*\*(C'\fR for home directories, so users with home directories in other locations won\*(Aqt have the ssh files removed.
.SS "\fBsssd\-db\-log\fP *"
.IX Subsection "sssd-db-log *"
SSSD のデータベースとログファイルを削除します。
.SS "\fBtmp\-files\fP *"
.IX Subsection "tmp-files *"
一時ファイルを削除します。
.PP
これは \f(CW\*(C`/tmp\*(C'\fR と \f(CW\*(C`/var/tmp\*(C'\fR の中にある一時ファイルを削除します。
.SS "\fBudev\-persistent\-net\fP *"
.IX Subsection "udev-persistent-net *"
udev persistent net ルールを削除します。
.PP
Remove udev persistent net rules which map the guest’s existing MAC address to a fixed ethernet device (eg. eth0).
.PP
仮想マシンをクローンした後、通常 MAC アドレスは変わります。古い MAC アドレスは古い名前(たとえば eth0)を占有するため、このことは新しい MAC アドレスが新しい名前(たとえば eth1)に割り当てられることを意味します。それは、一般的に好ましくありません。 udev の永続的な net ルールを削除することにより、これを避けます。
.SS \fBuser\-account\fP
.IX Subsection "user-account"
仮想マシンにあるユーザーアカウントを削除します。
.PP
By default remove all the user accounts and their home directories. The "root" account is not removed.
.PP
See the \fI\-\-remove\-user\-accounts\fR parameter for a way to specify how to remove only some users, or to not remove some others.
.SS "\fButmp\fP *"
.IX Subsection "utmp *"
utmp ファイルを削除します。
.PP
This file records who is currently logged in on a machine. In modern Linux distros it is stored in a ramdisk and hence not part of the virtual machine’s disk, but it was stored on disk in older distros.
.SS "\fByum\-uuid\fP *"
.IX Subsection "yum-uuid *"
yum UUID を削除します。
.PP
yum は元々の UUID が削除されたことを通知するとき、次の実行時に新しい UUID を作成します。
.SH コピー方法およびクローン方法
.IX Header "コピー方法およびクローン方法"
virt\-sysprep は仮想マシンをクローンするプロセスの一部として使用できます。もしくは、クローンされた仮想マシンからテンプレートを準備するために使用できます。仮想化ツールを使用してこれを実現する他の方法がいろいろとあります。このセクションは単に概要を説明します。
.PP
仮想マシン(停止状態の場合)は 2 つの部分からなります:
.IP \fIconfiguration\fR 4
.IX Item "configuration"
仮想マシンの設定または説明。 例: libvirt XML (\f(CW\*(C`virsh dumpxml\*(C'\fR 参照) 、仮想マシンの実行中の設定、または OVF のような他の外部形式。
.Sp
いくつかの設定項目は変更する必要があるかもしれません:
.RS 4
.IP \(bu 4
名前
.IP \(bu 4
UUID
.IP \(bu 4
ブロックデバイスへのパス
.IP \(bu 4
ネットワークカードの MAC アドレス
.RE
.RS 4
.RE
.IP \fIブロックデバイス\fR 4
.IX Item "ブロックデバイス"
One or more hard disk images, themselves containing files, directories, applications, kernels, configuration, etc.
.Sp
Some things inside the block devices that might need to be changed:
.RS 4
.IP \(bu 4
ホスト名および他のネットワーク設定
.IP \(bu 4
UUID
.IP \(bu 4
SSH ホストキー
.IP \(bu 4
Windows の一意なセキュリティ ID (SID)
.IP \(bu 4
Puppet の登録
.RE
.RS 4
.RE
.SS ブロックデバイスのコピー法
.IX Subsection "ブロックデバイスのコピー法"
Starting with an original guest, you probably wish to copy the guest block device and its configuration to make a template. Then once you are happy with the template, you will want to make many clones from it.
.PP
.Vb 7
\& virt\-sysprep
\& |
\& v
\& 元のゲスト \-\-\-\-\-\-\-\-> テンプレート \-\-\-\-\-\-\-\-\-\->
\& \e\-\-\-\-\-\-> クローン
\& \e\-\-\-\-\-> 済みゲスト
\& \e\-\-\-\->
.Ve
.PP
もちろん、ホストにおいて \fBcp\fR\|(1) または \fBdd\fR\|(1) を使用してブロックデバイスをコピーできます。
.PP
.Vb 5
\& dd dd
\& 元のゲスト \-\-\-\-\-\-\-\-> テンプレート \-\-\-\-\-\-\-\-\-\->
\& \e\-\-\-\-\-\-> クローン
\& \e\-\-\-\-\-> 済みゲスト
\& \e\-\-\-\->
.Ve
.PP
よりスマート(かつ高速)な方法もあります:
.PP
.Vb 5
\& snapshot
\& テンプレート \-\-\-\-\-\-\-\-\-\->
\& \e\-\-\-\-\-\-> クローン
\& \e\-\-\-\-\-> 済みゲスト
\& \e\-\-\-\->
.Ve
.PP
You may want to run virt\-sysprep twice, once to reset the guest (to make a template) and a second time to customize the guest for a specific user:
.PP
.Vb 6
\& virt\-sysprep virt\-sysprep
\& (リセット) (ユーザー、キー、ロゴの追加)
\& | |
\& dd v dd v
\& 元の仮想マシン \-\-\-\-> テンプレート \-\-\-\-> コピー済み \-\-\-\-\-\-> カスタム
\& テンプレート 仮想マシン
.Ve
.IP \(bu 4
Create a snapshot using qemu\-img:
.Sp
.Vb 1
\& qemu\-img create \-f qcow2 \-o backing_file=original snapshot.qcow
.Ve
.Sp
The advantage is that you don’t need to copy the original (very fast) and only changes are stored (less storage required).
.Sp
Note that writing to the backing file once you have created guests on top of it is not possible: you will corrupt the guests.
.IP \(bu 4
\&\f(CW\*(C`lvcreate \-\-snapshot\*(C'\fR を使用してスナップショットを作成します。
.IP \(bu 4
Other ways to create snapshots include using filesystems\-level tools (for filesystems such as btrfs).
.Sp
Most Network Attached Storage (NAS) devices can also create cheap snapshots from files or LUNs.
.IP \(bu 4
Get your NAS to duplicate the LUN. Most NAS devices can also duplicate LUNs very cheaply (they copy them on\-demand in the background).
.IP \(bu 4
\&\fBvirt\-sparsify\fR\|(1) を使用してテンプレートを準備します。以下を参照してください。
.SS virt\-clone
.IX Subsection "virt-clone"
A separate tool, \fBvirt\-clone\fR\|(1), can be used to duplicate the block device and/or modify the external libvirt configuration of a guest. It will reset the name, UUID and MAC address of the guest in the libvirt XML.
.PP
\&\fBvirt\-clone\fR\|(1) does not use libguestfs and cannot look inside the disk image. This was the original motivation to write virt\-sysprep.
.SS スパース化
.IX Subsection "スパース化"
.Vb 2
\& virt\-sparsify
\& 元のゲスト \-\-\-\-\-\-\-\-> テンプレート
.Ve
.PP
\&\fBvirt\-sparsify\fR\|(1) can be used to make the cloning template smaller, making it easier to compress and/or faster to copy.
.PP
Notice that since virt\-sparsify also copies the image, you can use it to make the initial copy (instead of \f(CW\*(C`dd\*(C'\fR).
.SS 容量変更
.IX Subsection "容量変更"
.Vb 5
\& virt\-resize
\& テンプレート \-\-\-\-\-\-\-\-\-\->
\& \e\-\-\-\-\-\-> クローン
\& \e\-\-\-\-\-> 済みゲスト
\& \e\-\-\-\->
.Ve
.PP
If you want to give people cloned guests, but let them pick the size of the guest themselves (eg. depending on how much they are prepared to pay for disk space), then instead of copying the template, you can run \fBvirt\-resize\fR\|(1). Virt\-resize performs a copy and resize, and thus is ideal for cloning guests from a template.
.SH "FIRSTBOOT VS SCRIPT"
.IX Header "FIRSTBOOT VS SCRIPT"
The two options \fI\-\-firstboot\fR and \fI\-\-script\fR both supply shell scripts that are run against the guest. However these two options are significantly different.
.PP
\&\fI\-\-firstboot script\fR uploads the file \f(CW\*(C`script\*(C'\fR into the guest and arranges that it will run, in the guest, when the guest is next booted. (The script will only run once, at the "first boot").
.PP
\&\fI\-\-script script\fR runs the shell \f(CW\*(C`script\*(C'\fR \fIon the host\fR, with its current directory inside the guest filesystem.
.PP
If you needed, for example, to \f(CW\*(C`yum install\*(C'\fR new packages, then you \fImust not\fR use \fI\-\-script\fR for this, since that would (a) run the \f(CW\*(C`yum\*(C'\fR command on the host and (b) wouldn\*(Aqt have access to the same resources (repositories, keys, etc.) as the guest. Any command that needs to run on the guest \fImust\fR be run via \fI\-\-firstboot\fR.
.PP
On the other hand if you need to make adjustments to the guest filesystem (eg. copying in files), then \fI\-\-script\fR is ideal since (a) it has access to the host filesystem and (b) you will get immediate feedback on errors.
.PP
Either or both options can be used multiple times on the command line.
.SH セキュリティ
.IX Header "セキュリティ"
Virtual machines that employ full disk encryption \fIinternally to the guest\fR should not be considered for cloning and distribution, as it provides multiple parties with the same internal volume key, enabling any one such party to decrypt all the other clones. Refer to the LUKS FAQ for details.
.PP
Although virt\-sysprep removes some sensitive information from the guest, it does not pretend to remove all of it. You should examine the "OPERATIONS" above and the guest afterwards.
.PP
Sensitive files are simply removed. The data they contained may still exist on the disk, easily recovered with a hex editor or undelete tool. The \fI\-\-scrub\fR option can be used to scrub files instead of just deleting them. \fBvirt\-sparsify\fR\|(1) is another way to remove this content. See also the \fBscrub\fR\|(1) command to get rid of deleted content in directory entries and inodes.
.SS 乱数の種
.IX Subsection "乱数の種"
\&\fI(このセクションは Linux 仮想マシンのみに適用します)\fR
.PP
For supported guests, virt\-sysprep writes a few bytes of randomness from the host into the guest’s random seed file.
.PP
If this is just done once and the guest is cloned from the same template, then each guest will start with the same entropy, and things like SSH host keys and TCP sequence numbers may be predictable.
.PP
Therefore you should arrange to add more randomness \fIafter\fR cloning from a template too, which can be done by enabling just the customize module:
.PP
.Vb 2
\& cp template.img newguest.img
\& virt\-sysprep \-\-enable customize \-a newguest.img
.Ve
.SH SELinux
.IX Header "SELinux"
For guests which make use of SELinux, special handling for them might be needed when using operations which create new files or alter existing ones.
.PP
For further details, see "SELINUX" in \fBvirt\-builder\fR\|(1).
.SH "WINDOWS 8"
.IX Header "WINDOWS 8"
Windows 8 "fast startup" can prevent virt\-sysprep from working. See "WINDOWS HIBERNATION AND WINDOWS 8 FAST STARTUP" in \fBguestfs\fR\|(3).
.SH 終了ステータス
.IX Header "終了ステータス"
このプログラムは、成功すると 0 を返します。または、エラーが起きると 1 を返します。
.SH 環境変数
.IX Header "環境変数"
.ie n .IP """VIRT_TOOLS_DATA_DIR""" 4
.el .IP \f(CWVIRT_TOOLS_DATA_DIR\fR 4
.IX Item "VIRT_TOOLS_DATA_DIR"
This can point to the directory containing data files used for Windows firstboot installation.
.Sp
Normally you do not need to set this. If not set, a compiled\-in default will be used (something like \fI/usr/share/virt\-tools\fR).
.Sp
This directory may contain the following files:
.RS 4
.IP \fIrhsrvany.exe\fR 4
.IX Item "rhsrvany.exe"
This is the RHSrvAny Windows binary, used to install a "firstboot" script in Windows guests. It is required if you intend to use the \fI\-\-firstboot\fR or \fI\-\-firstboot\-command\fR options with Windows guests.
.Sp
See also: \f(CW\*(C`https://github.com/rwmjones/rhsrvany\*(C'\fR
.IP \fIpvvxsvc.exe\fR 4
.IX Item "pvvxsvc.exe"
This is a Windows binary shipped with SUSE VMDP, used to install a "firstboot" script in Windows guests. It is required if you intend to use the \fI\-\-firstboot\fR or \fI\-\-firstboot\-command\fR options with Windows guests.
.RE
.RS 4
.RE
.PP
他の環境変数は "環境変数" in \fBguestfs\fR\|(3) を参照してください。
.SH 関連項目
.IX Header "関連項目"
\&\fBguestfs\fR\|(3), \fBguestfish\fR\|(1), \fBvirt\-builder\fR\|(1), \fBvirt\-clone\fR\|(1), \fBvirt\-customize\fR\|(1), \fBvirt\-rescue\fR\|(1), \fBvirt\-resize\fR\|(1), \fBvirt\-sparsify\fR\|(1), \fBvirsh\fR\|(1), \fBlvcreate\fR\|(8), \fBqemu\-img\fR\|(1), \fBscrub\fR\|(1), http://libguestfs.org/, http://libvirt.org/.
.SH 著者
.IX Header "著者"
Richard W.M. Jones http://people.redhat.com/~rjones/
.PP
Wanlong Gao, Fujitsu Ltd.
.SH COPYRIGHT
.IX Header "COPYRIGHT"
Copyright (C) 2011\-2023 Red Hat Inc.
.PP
Copyright (C) 2012 Fujitsu Ltd.
.SH LICENSE
.IX Header "LICENSE"
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
.PP
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
.PP
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110\-1301 USA.
.SH BUGS
.IX Header "BUGS"
To get a list of bugs against libguestfs, use this link:
https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools
.PP
To report a new bug against libguestfs, use this link:
https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools
.PP
When reporting a bug, please supply:
.IP \(bu 4
The version of libguestfs.
.IP \(bu 4
Where you got libguestfs (eg. which Linux distro, compiled from source, etc)
.IP \(bu 4
Describe the bug accurately and give a way to reproduce it.
.IP \(bu 4
Run \fBlibguestfs\-test\-tool\fR\|(1) and paste the \fBcomplete, unedited\fR
output into the bug report.
|