1 | <?xml version='1.0' encoding='UTF-8'?>
|
---|
2 | <!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
|
---|
3 | <topic xml:lang="en-us" id="cpuhotplug">
|
---|
4 | <title>CPU Hot-Plugging</title>
|
---|
5 |
|
---|
6 | <body>
|
---|
7 | <p>
|
---|
8 | With virtual machines running modern server operating systems,
|
---|
9 | <ph conkeyref="vbox-conkeyref-phrases/product-name"/> supports CPU hot-plugging.
|
---|
10 | </p>
|
---|
11 | <p>
|
---|
12 | On a physical computer CPU hot-plugging would mean that a CPU can
|
---|
13 | be added or removed while the machine is running. <ph conkeyref="vbox-conkeyref-phrases/product-name"/>
|
---|
14 | supports adding and removing of virtual CPUs while a virtual
|
---|
15 | machine is running.
|
---|
16 | </p>
|
---|
17 | <p>
|
---|
18 | CPU hot-plugging works only with guest operating systems that
|
---|
19 | support the feature. So far this applies only to Linux and Windows
|
---|
20 | Server. Windows supports only hot-add, while Linux supports
|
---|
21 | hot-add and hot-remove. To use this feature with more than 8 CPUs,
|
---|
22 | a 64-bit Linux guest is required.
|
---|
23 | </p>
|
---|
24 | <p>
|
---|
25 | CPU hot-plugging is done using the <userinput>VBoxManage</userinput>
|
---|
26 | command-line interface. First, hot-plugging needs to be enabled
|
---|
27 | for a virtual machine:
|
---|
28 | </p>
|
---|
29 | <pre xml:space="preserve">$ VBoxManage modifyvm <varname>VM-name</varname> --cpu-hotplug on</pre>
|
---|
30 | <p>
|
---|
31 | The <codeph>--cpus</codeph> option is used to specify the maximum
|
---|
32 | number of CPUs that the virtual machine can have:
|
---|
33 | </p>
|
---|
34 | <pre xml:space="preserve">$ VBoxManage modifyvm <varname>VM-name</varname> --cpus 8</pre>
|
---|
35 | <p>
|
---|
36 | When the VM is off, you can then add and remove virtual CPUs with
|
---|
37 | the <userinput>VBoxManage modifyvm --plug-cpu</userinput> and
|
---|
38 | <userinput>VBoxManage modifyvm --unplug-cpu</userinput> commands,
|
---|
39 | which take the number of the virtual CPU as a parameter, as
|
---|
40 | follows:
|
---|
41 | </p>
|
---|
42 | <pre xml:space="preserve">$ VBoxManage modifyvm <varname>VM-name</varname> --plug-cpu 3
|
---|
43 | $ VBoxManage modifyvm <varname>VM-name</varname> --unplug-cpu 3</pre>
|
---|
44 | <p>
|
---|
45 | Note that CPU 0 can never be removed.
|
---|
46 | </p>
|
---|
47 | <p>
|
---|
48 | While the VM is running, CPUs can be added and removed with the
|
---|
49 | <userinput>VBoxManage controlvm plugcpu</userinput> and
|
---|
50 | <userinput>VBoxManage controlvm unplugcpu</userinput> commands
|
---|
51 | instead, as follows:
|
---|
52 | </p>
|
---|
53 | <pre xml:space="preserve">$ VBoxManage controlvm <varname>VM-name</varname> plugcpu 3
|
---|
54 | $ VBoxManage controlvm <varname>VM-name</varname> unplugcpu 3</pre>
|
---|
55 | <p>
|
---|
56 | See <xref href="vboxmanage-modifyvm.dita">VBoxManage modifyvm</xref> and
|
---|
57 | <xref href="vboxmanage-controlvm.dita">VBoxManage controlvm</xref> for details.
|
---|
58 | </p>
|
---|
59 | <p>
|
---|
60 | With Linux guests, the following applies:
|
---|
61 | </p>
|
---|
62 | <p>
|
---|
63 | To prevent ejection while the CPU is still used it has to be
|
---|
64 | ejected from within the guest before. The Linux Guest Additions
|
---|
65 | contain a service which receives hot-remove events and ejects the
|
---|
66 | CPU. Also, after a CPU is added to the VM it is not automatically
|
---|
67 | used by Linux. The Linux Guest Additions service will take care of
|
---|
68 | that if installed. If not a CPU can be started with the following
|
---|
69 | command:
|
---|
70 | </p>
|
---|
71 | <pre xml:space="preserve">$ echo 1 > /sys/devices/system/cpu/cpu<id>/online</pre>
|
---|
72 | </body>
|
---|
73 |
|
---|
74 | </topic>
|
---|