PVE虚拟化 命令大全

qm <命令> <vmid> [选项]
qm [create|set] <vmid>  # 创建虚拟机
    --memory  <MBYTES>    memory in MB (64 - 8192)
    --sockets <N>         set number of CPU sockets <N>
    --cores <N>           set cores per socket to <N>
    --ostype NAME         specify OS type
    --onboot [yes|no]     start at boot
    --keyboard XX         set vnc keyboard layout
    --cpuunits <num>      CPU weight for a VM
    --name <text>         set a name for the VM
    --description <text>  set VM description
    --boot [a|c|d|n]      specify boot order
    --bootdisk <disk>     enable booting from <disk>
    --acpi (yes|no)       enable/disable ACPI
    --kvm (yes|no)        enable/disable KVM
    --tdf (yes|no)        enable/disable time drift fix
    --localtime (yes|no)  set the RTC to local time
    --vga (gd5446|vesa)   specify VGA type
    --vlan[0-9u]          MODEL=XX:XX:XX:XX:XX:XX[,MODEL=YY:YY:YY:YY:YY:YY]
    --ide<N>              [volume=]volume,[,media=cdrom|disk]
                          [,cyls=c,heads=h,secs=s[,trans=t]]
                          [,cache=none|writethrough|writeback]
                          [,snapshot=on|off][,cache=on|off][,format=f]
                          [,werror=enospc|ignore|report|stop]
                          [,rerror=ignore|report|stop]
                          [,backup=no|yes]
    --ide<N> <GBYTES>     create new disk
    --ide<N> delete       remove drive - destroy image
    --ide<N> undef        remove drive - keep image
    --cdrom <file>        is an alias for --ide2 <file>,media=cdrom
    --scsi<N>             [volume=]volume,[,media=cdrom|disk]
                          [,cyls=c,heads=h,secs=s[,trans=t]]
                          [,snapshot=on|off][,format=f]
                          [,cache=none|writethrough|writeback]
                          [,werror=enospc|ignore|report|stop]
                          [,backup=no|yes]
    --scsi<N> <GBYTES>    create new disk
    --scsi<N> delete      remove drive - destroy image
    --scsi<N> undef       remove drive - keep image
    --virtio<N>           [volume=]volume,[,media=cdrom|disk]
                          [,cyls=c,heads=h,secs=s[,trans=t]]
                          [,snapshot=on|off][,format=f]
                          [,cache=none|writethrough|writeback]
                          [,werror=enospc|ignore|report|stop]
                          [,rerror=ignore|report|stop]
                          [,backup=no|yes]
    --virtio<N> <GBYTES>  create new disk
    --virtio<N> delete    remove drive - destroy image
    --virtio<N> undef     remove drive - keep image
qm monitor <vmid>         # 连接到虚拟机控制监视器
qm start <vmid>               # 启动实例
qm shutdown <vmid>      # 优雅停止实例 发送关机命令
qm wait <vmid> [time]   wait until vm is stopped
qm stop <vmid>               # 停止实例 强制停止
qm reset <vmid>              # 重启实例 相当于stop然后再start
qm suspend <vmid>        # 暂停实例
qm resume <vmid>         # 恢复实例
qm cad <vmid>               #发送按键 ctrl-alt-delete
qm destroy <vmid>        # 销毁实例(删除所有已使用/拥有的卷)
qm unlock <vmid>         # 清除迁移/备份锁
qm status <vmid>          # 显示实例状态
qm cdrom <vmid> [<device>] <path>  set cdrom path. <device is ide2 by default>
qm cdrom <vmid> [<device>] eject   eject cdrom
qm unlink <vmid> <volume>  delete unused disk images
qm vncproxy <vmid> <ticket>  open vnc proxy
qm vnc <vmid>           start (X11) vncviewer (experimental)
qm showcmd <vmid>     # 显示命令行(调试信息)
qm list                             # 列出所有虚拟机
qm startall                       # 启动所有虚拟机 当onboot=1时
qm stopall [timeout]       # 停止所有虚拟机(默认超时为3分钟)

集群命令:

pvesr list                   # 列出存储复制作业
ha-manager status   # 查看HA状态
pvecm nodes    # 查看集群节点
pvecm status    # 查看集群状态
pveperf
pve-firewall compile  # 查看防火墙规则
pve-firewall localnet  # 输出本地网络信息
pve-firewall restart    # 重启防火墙
pve-firewall stop        # 停止防火墙
pve-firewall start        # 启动防火墙

发表回复