Proxmox VE 4.x 中文初階學習手冊
qm(1) Proxmox Documentation qm(1)
NAME
qm - qemu/kvm virtual machine manager
SYNOPSIS
qm <COMMAND> [ARGS] [OPTIONS]
qm clone <vmid> <newid> [OPTIONS]
Create a copy of virtual machine/template.
<vmid> integer (1 - N)
The (unique) ID of the VM.
<newid> integer (1 - N)
VMID for the clone.
-description string
Description for the new VM.
-format (qcow2 | raw | vmdk)
Target format for file storage.
Requires option(s): full
-full boolean (default=0)
Create a full copy of all disk. This is always done when you
clone a normal VM. For VM templates, we try to create a linked
clone by default.
-name string
Set a name for the new VM.
-pool string
Add the new VM to the specified pool.
-snapname string
The name of the snapshot.
Requires option(s): full
-storage string
Target storage for full clone.
Requires option(s): full
-target string
Target node. Only allowed if the original VM is on shared
storage.
qm config <vmid>
Get virtual machine configuration.
<vmid> integer (1 - N)
The (unique) ID of the VM.
qm create <vmid> [OPTIONS]
Create or restore a virtual machine.
<vmid> integer (1 - N)
The (unique) ID of the VM.
-acpi boolean (default=1)
Enable/disable ACPI.
-agent boolean (default=0)
Enable/disable Qemu GuestAgent.
-archive string
The backup file.
-args string
Note: this option is for experts only. It allows you to pass
arbitrary arguments to kvm, for example:
args: -no-reboot -no-hpet
-autostart boolean (default=0)
Automatic restart after crash (currently ignored).
-balloon integer (0 - N)
Amount of target RAM for the VM in MB. Using zero disables the
ballon driver.
-boot [acdn]{1,4} (default=cdn)
Boot on floppy (a), hard disk (c), CD-ROM (d), or network (n).
-bootdisk (ide|sata|scsi|virtio)\d+
Enable booting from specified disk.
-cdrom volume
This is an alias for option -ide2
-cores integer (1 - N) (default=1)
The number of cores per socket.
-cpu (486 | Conroe | Haswell | Nehalem | Opteron_G1 | Opteron_G2 |
Opteron_G3 | Opteron_G4 | Opteron_G5 | Penryn | SandyBridge |
Westmere | athlon | core2duo | coreduo | host | kvm32 | kvm64
| pentium | pentium2 | pentium3 | phenom | qemu32 | qemu64)
(default=kvm64)
Emulated CPU type.
-cpulimit integer (0 - N) (default=0)
Limit of CPU usage in per cent. Note if the computer has 2
CPUs, it has total of 200% CPU time. Value '0' indicates no
CPU limit.
NOTE: This option is currently ignored.
-cpuunits integer (0 - 500000) (default=1000)
CPU weight for a VM. Argument is used in the kernel fair
scheduler. The larger the number is, the more CPU time this VM
gets. Number is relative to weights of all the other running
VMs.
NOTE: You can disable fair-scheduler configuration by setting
this to 0.
-description string
Description for the VM. Only used on the configuration web
interface. This is saved as comment inside the configuration
file.
-force boolean
Allow to overwrite existing VM.
Requires option(s): archive
-freeze boolean
Freeze CPU at startup (use 'c' monitor command to start
execution).
-hostpci[n] [host=]HOSTPCIDEVICE [,driver=kvm|vfio] [,rombar=on|off]
Map host pci devices. HOSTPCIDEVICE syntax is:
'bus:dev.func' (hexadecimal numbers)
You can us the 'lspci' command to list existing pci devices.
The 'rombar' option determines whether or not the device's ROM
will be visible in the guest's memory map (default is 'on').
The 'driver' option is currently ignored.
Note: This option allows direct access to host hardware. So it
is no longer possible to migrate such machines - use with
special care.
Experimental: user reported problems with this option.
-hotplug boolean (default=0)
Allow hotplug for disk and network device
-ide[n] [volume=]volume,] [,media=cdrom|disk]
[,cyls=c,heads=h,secs=s[,trans=t]] [,snapshot=on|off]
[,cache=none|writethrough|writeback|unsafe|directsync]
[,format=f] [,backup=yes|no] [,rerror=ignore|report|stop]
[,werror=enospc|ignore|report|stop] [,aio=native|threads]
[,discard=ignore|on]
Use volume as IDE hard disk or CD-ROM (n is 0 to 3).
-keyboard (da | de | de-ch | en-gb | en-us | es | fi | fr | fr-be |
fr-ca | fr-ch | hu | is | it | ja | lt | mk | nl | no | pl |
pt | pt-br | sl | sv | tr) (default=en-us)
Keybord layout for vnc server. Default is read from the
datacenter configuration file.
-kvm boolean (default=1)
Enable/disable KVM hardware virtualization.
-localtime boolean
Set the real time clock to local time. This is enabled by
default if ostype indicates a Microsoft OS.
-lock (backup | migrate | rollback | snapshot)
Lock/unlock the VM.
-machine (pc|pc(-i440fx)?-\d+\.\d+|q35|pc-q35-\d+\.\d+)
Specific the Qemu machine type.
-maxcpus integer (1 - N) (default=1)
Maximum cpus for hotplug.
-memory integer (16 - N) (default=512)
Amount of RAM for the VM in MB. This is the maximum available
memory when you use the balloon device.
-migrate_downtime number (0 - N) (default=0.1)
Set maximum tolerated downtime (in seconds) for migrations.
-migrate_speed integer (0 - N) (default=0)
Set maximum speed (in MB/s) for migrations. Value 0 is no
limit.
-name string
Set a name for the VM. Only used on the configuration web
interface.
-net[n] MODEL=XX:XX:XX:XX:XX:XX
[,bridge=<dev>][,rate=<mbps>][,tag=<vlanid>]
Specify network devices.
MODEL is one of: e1000 i82551 i82557b i82559er ne2k_isa
ne2k_pci pcnet rtl8139 virtio vmxnet3
XX:XX:XX:XX:XX:XX should be an unique MAC address. This is
automatically generated if not specified.
The bridge parameter can be used to automatically add the
interface to a bridge device. The Proxmox VE standard bridge
is called 'vmbr0'.
Option 'rate' is used to limit traffic bandwidth from and to
this interface. It is specified as floating point number, unit
is 'Megabytes per second'.
If you specify no bridge, we create a kvm 'user' (NATed)
network device, which provides DHCP and DNS services. The
following addresses are used:
10.0.2.2 Gateway
10.0.2.3 DNS Server
10.0.2.4 SMB Server
The DHCP server assign addresses to the guest starting from
10.0.2.15.
-onboot boolean (default=0)
Specifies whether a VM will be started during system bootup.
-ostype (l24 | l26 | other | solaris | w2k | w2k3 | w2k8 | win7 | win8
| wvista | wxp)
Used to enable special optimization/features for specific
operating systems:
other => unspecified OS
wxp => Microsoft Windows XP
w2k => Microsoft Windows 2000
w2k3 => Microsoft Windows 2003
w2k8 => Microsoft Windows 2008
wvista => Microsoft Windows Vista
win7 => Microsoft Windows 7
win8 => Microsoft Windows 8/2012
l24 => Linux 2.4 Kernel
l26 => Linux 2.6/3.X Kernel
solaris => solaris/opensolaris/openindiania kernel
other|l24|l26|solaris ... no special
behaviour
wxp|w2k|w2k3|w2k8|wvista|win7|win8 ... use --localtime switch
-parallel[n] /dev/parport\d+|/dev/usb/lp\d+
Map host parallel devices (n is 0 to 2).
Note: This option allows direct access to host hardware. So it
is no longer possible to migrate such machines - use with
special care.
Experimental: user reported problems with this option.
-pool string
Add the VM to the specified pool.
-reboot boolean (default=1)
Allow reboot. If set to '0' the VM exit on reboot.
-sata[n] [volume=]volume,] [,media=cdrom|disk]
[,cyls=c,heads=h,secs=s[,trans=t]] [,snapshot=on|off]
[,cache=none|writethrough|writeback|unsafe|directsync]
[,format=f] [,backup=yes|no] [,rerror=ignore|report|stop]
[,werror=enospc|ignore|report|stop] [,aio=native|threads]
[,discard=ignore|on]
Use volume as SATA hard disk or CD-ROM (n is 0 to 5).
-scsi[n] [volume=]volume,] [,media=cdrom|disk]
[,cyls=c,heads=h,secs=s[,trans=t]] [,snapshot=on|off]
[,cache=none|writethrough|writeback|unsafe|directsync]
[,format=f] [,backup=yes|no] [,rerror=ignore|report|stop]
[,werror=enospc|ignore|report|stop] [,aio=native|threads]
[,discard=ignore|on]
Use volume as SCSI hard disk or CD-ROM (n is 0 to 13).
-scsihw (lsi | lsi53c810 | megasas | pvscsi | virtio-scsi-pci)
(default=lsi)
scsi controller model
-serial[n] (/dev/ttyS\d+|socket)
Create a serial device inside the VM (n is 0 to 3), and pass
through a host serial device, or create a unix socket on the
host side (use 'qm terminal' to open a terminal connection).
Note: This option allows direct access to host hardware. So it
is no longer possible to migrate such machines - use with
special care.
Experimental: user reported problems with this option.
-shares integer (0 - 50000) (default=1000)
Amount of memory shares for auto-ballooning. The larger the
number is, the more memory this VM gets. Number is relative to
weights of all other running VMs. Using zero disables
auto-ballooning
-smp integer (1 - N) (default=1)
The number of CPUs. Please use option -sockets instead.
-sockets integer (1 - N) (default=1)
The number of CPU sockets.
-startdate (now | YYYY-MM-DD | YYYY-MM-DDTHH:MM:SS) (default=now)
Set the initial date of the real time clock. Valid format for
date are: 'now' or '2006-06-17T16:01:21' or '2006-06-17'.
-startup [[order=]\d+] [,up=\d+] [,down=\d+]
Startup and shutdown behavior. Order is a non-negative number
defining the general startup order. Shutdown in done with
reverse ordering. Additionally you can set the 'up' or 'down'
delay in seconds, which specifies a delay to wait before the
next VM is started or stopped.
-storage string
Default storage.
-tablet boolean (default=1)
Enable/disable the usb tablet device. This device is usually
needed to allow absolute mouse positioning with VNC. Else the
mouse runs out of sync with normal VNC clients. If you're
running lots of console-only guests on one host, you may
consider disabling this to save some context switches. This is
turned of by default if you use spice (vga=qxl).
-tdf boolean (default=0)
Enable/disable time drift fix.
-template boolean (default=0)
Enable/disable Template.
-unique boolean
Assign a unique random ethernet address.
Requires option(s): archive
-unused[n] string
Reference to unused volumes.
-usb[n] host=HOSTUSBDEVICE|spice
Configure an USB device (n is 0 to 4). This can be used to
pass-through usb devices to the guest. HOSTUSBDEVICE syntax
is:
'bus-port(.port)*' (decimal numbers) or
'vendor_id:product_id' (hexadeciaml numbers)
You can use the 'lsusb -t' command to list existing usb
devices.
Note: This option allows direct access to host hardware. So it
is no longer possible to migrate such machines - use with
special care.
The value 'spice' can be used to add a usb redirection devices
for spice.
-vga (cirrus | qxl | qxl2 | qxl3 | qxl4 | serial0 | serial1 |
serial2 | serial3 | std | vmware)
Select VGA type. If you want to use high resolution modes (>=
1280x1024x16) then you should use option 'std' or 'vmware'.
Default is 'std' for win8/win7/w2k8, and 'cirrur' for other OS
types. Option 'qxl' enables the SPICE display sever. You can
also run without any graphic card using a serial devive as
terminal.
-virtio[n] [volume=]volume,] [,media=cdrom|disk]
[,cyls=c,heads=h,secs=s[,trans=t]] [,snapshot=on|off]
[,cache=none|writethrough|writeback|unsafe|directsync]
[,format=f] [,backup=yes|no] [,rerror=ignore|report|stop]
[,werror=enospc|ignore|report|stop] [,aio=native|threads]
[,discard=ignore|on]
Use volume as VIRTIO hard disk (n is 0 to 15).
-watchdog [[model=]i6300esb|ib700]
[,[action=]reset|shutdown|poweroff|pause|debug|none]
Create a virtual hardware watchdog device. Once enabled (by a
guest action), the watchdog must be periodically polled by an
agent inside the guest or else the guest will be restarted (or
execute the action specified)
qm delsnapshot <vmid> <snapname> [OPTIONS]
Delete a VM snapshot.
<vmid> integer (1 - N)
The (unique) ID of the VM.
<snapname> string
The name of the snapshot.
-force boolean
For removal from config file, even if removing disk snapshots
fails.
qm destroy <vmid> [OPTIONS]
Destroy the vm (also delete all used/owned volumes).
<vmid> integer (1 - N)
The (unique) ID of the VM.
-skiplock boolean
Ignore locks - only root is allowed to use this option.
qm list
Virtual machine index (per node).
qm migrate <vmid> <target> [OPTIONS]
Migrate virtual machine. Creates a new migration task.
<vmid> integer (1 - N)
The (unique) ID of the VM.
<target> string
Target node.
-force boolean
Allow to migrate VMs which use local devices. Only root may
use this option.
-online boolean
Use online/live migration.
qm move_disk <vmid> <disk> <storage> [OPTIONS]
Move volume to different storage.
<vmid> integer (1 - N)
The (unique) ID of the VM.
<disk> (ide0 | ide1 | ide2 | ide3 | sata0 | sata1 | sata2 | sata3 |
sata4 | sata5 | scsi0 | scsi1 | scsi10 | scsi11 | scsi12 |
scsi13 | scsi2 | scsi3 | scsi4 | scsi5 | scsi6 | scsi7 | scsi8
| scsi9 | virtio0 | virtio1 | virtio10 | virtio11 | virtio12 |
virtio13 | virtio14 | virtio15 | virtio2 | virtio3 | virtio4 |
virtio5 | virtio6 | virtio7 | virtio8 | virtio9)
The disk you want to move.
<storage> string
Target Storage.
-delete boolean (default=0)
Delete the original disk after successful copy. By default the
original disk is kept as unused disk.
-digest string
Prevent changes if current configuration file has different
SHA1 digest. This can be used to prevent concurrent
modifications.
-format (qcow2 | raw | vmdk)
Target Format.
qm reset <vmid> [OPTIONS]
Reset virtual machine.
<vmid> integer (1 - N)
The (unique) ID of the VM.
-skiplock boolean
Ignore locks - only root is allowed to use this option.
qm resize <vmid> <disk> <size> [OPTIONS]
Extend volume size.
<vmid> integer (1 - N)
The (unique) ID of the VM.
<disk> (ide0 | ide1 | ide2 | ide3 | sata0 | sata1 | sata2 | sata3 |
sata4 | sata5 | scsi0 | scsi1 | scsi10 | scsi11 | scsi12 |
scsi13 | scsi2 | scsi3 | scsi4 | scsi5 | scsi6 | scsi7 | scsi8
| scsi9 | virtio0 | virtio1 | virtio10 | virtio11 | virtio12 |
virtio13 | virtio14 | virtio15 | virtio2 | virtio3 | virtio4 |
virtio5 | virtio6 | virtio7 | virtio8 | virtio9)
The disk you want to resize.
<size> \+?\d+(\.\d+)?[KMGT]?
The new size. With the '+' sign the value is added to the
actual size of the volume and without it, the value is taken
as an absolute one. Shrinking disk size is not supported.
-digest string
Prevent changes if current configuration file has different
SHA1 digest. This can be used to prevent concurrent
modifications.
-skiplock boolean
Ignore locks - only root is allowed to use this option.
qm resume <vmid> [OPTIONS]
Resume virtual machine.
<vmid> integer (1 - N)
The (unique) ID of the VM.
-skiplock boolean
Ignore locks - only root is allowed to use this option.
qm rollback <vmid> <snapname>
Rollback VM state to specified snapshot.
<vmid> integer (1 - N)
The (unique) ID of the VM.
<snapname> string
The name of the snapshot.
qm sendkey <vmid> <key> [OPTIONS]
Send key event to virtual machine.
<vmid> integer (1 - N)
The (unique) ID of the VM.
<key> string
The key (qemu monitor encoding).
-skiplock boolean
Ignore locks - only root is allowed to use this option.
qm set <vmid> [OPTIONS]
Set virtual machine options (synchrounous API) - You should consider
using the POST method instead for any actions involving hotplug or
storage allocation.
<vmid> integer (1 - N)
The (unique) ID of the VM.
-acpi boolean (default=1)
Enable/disable ACPI.
-agent boolean (default=0)
Enable/disable Qemu GuestAgent.
-args string
Note: this option is for experts only. It allows you to pass
arbitrary arguments to kvm, for example:
args: -no-reboot -no-hpet
-autostart boolean (default=0)
Automatic restart after crash (currently ignored).
-balloon integer (0 - N)
Amount of target RAM for the VM in MB. Using zero disables the
ballon driver.
-boot [acdn]{1,4} (default=cdn)
Boot on floppy (a), hard disk (c), CD-ROM (d), or network (n).
-bootdisk (ide|sata|scsi|virtio)\d+
Enable booting from specified disk.
-cdrom volume
This is an alias for option -ide2
-cores integer (1 - N) (default=1)
The number of cores per socket.
-cpu (486 | Conroe | Haswell | Nehalem | Opteron_G1 | Opteron_G2 |
Opteron_G3 | Opteron_G4 | Opteron_G5 | Penryn | SandyBridge |
Westmere | athlon | core2duo | coreduo | host | kvm32 | kvm64
| pentium | pentium2 | pentium3 | phenom | qemu32 | qemu64)
(default=kvm64)
Emulated CPU type.
-cpulimit integer (0 - N) (default=0)
Limit of CPU usage in per cent. Note if the computer has 2
CPUs, it has total of 200% CPU time. Value '0' indicates no
CPU limit.
NOTE: This option is currently ignored.
-cpuunits integer (0 - 500000) (default=1000)
CPU weight for a VM. Argument is used in the kernel fair
scheduler. The larger the number is, the more CPU time this VM
gets. Number is relative to weights of all the other running
VMs.
NOTE: You can disable fair-scheduler configuration by setting
this to 0.
-delete string
A list of settings you want to delete.
-description string
Description for the VM. Only used on the configuration web
interface. This is saved as comment inside the configuration
file.
-digest string
Prevent changes if current configuration file has different
SHA1 digest. This can be used to prevent concurrent