Alex Sokolsky's Notes on Computers and Programming
ProxMox CLI
Description|Command
———–|——-
Restart web GUI|service pveproxy restart
.|Physical Volumes
List all PVs|pvs
Create a PV|pvcreate <disk-device-name>
Remove a PV|pvremove <disk-device-name>
.|Volume Groups
List|vgs
Create a VG|vgcreate <vg-name> <disk-device-name>
Remove a VG|vgremove <vg-name>
.|Logical Volumes
List|lvs
Create|lvcreate -L <lv-size> -n <lv-name> <vg-name>
Remove a LV|lvremove <vg-name>/<lv-name>
.|Storage Management
Create a new storage|pvesm add <type> <storage> [OPTIONS]
Allocate disk images|pvesm alloc [OPTIONS]`
Delete volume|`pvesm free [OPTIONS]`
Delete storage configuration|`pvesm remove `
List storage content|`pvesm list [OPTIONS]`
An alias for pvesm scan lvm|`pvesm lvmscan`
An alias for pvesm scan lvmthin|`pvesm lvmthinscan`
List local LVM volume groups|`pvesm scan lvm`
List local LVM Thin Pools|`pvesm scan lvmthin `
Get status for all datastores|`pvesm status [OPTIONS]`
.|Template Management
list all templates|`pveam available`
list all templates|`pveam list `
Download appliance templates|`pveam download `
Remove a template|`pveam remove `
Update Container Template Database|`pveam update`
.|VM Query
Show VMs|`cat /etc/pve/.vmlist`
Show VMs|`qm list`
Show VM status|`qm status `
Show VMs command line|`qm showcmd [OPTIONS]`
.|VM Manipulation
Create or restore a VM|`qm create `
Start a VM|`qm start `
Suspend virtual machine|`qm suspend `
Shutdown a VM|`qm shutdown `
Reboot a VM|`qm reboot `
Reset a VM|`qm reset `
Stop a VM|`qm stop `
Destroy the VM and all used/owned volumes, permissions and firewall rules|`qm destroy `
If the above fails because the machine is locked|`qm unlock `
Enter Qemu Monitor interface|`qm monitor `
Get the VM config (both current and pending)|`qm pending `
Send key event to virtual machine|`qm sendkey [OPTIONS]`
Clone a VM|`qm clone `
Migrate a VM|`qm migrate `
Clean up resources for a VM|`qm cleanup `
Create a Template|`qm template [OPTIONS]`
Set virtual machine options (synchronous)|`qm set [OPTIONS]`
.|VM Disk Manipulation
Import a disk image (supported by qemu-img(1)) as an unused disk in a VM|`qm disk import `
Move volume to different storage or to a different VM|`qm disk move [] [OPTIONS]`
Rescan to update disk sizes and unused disk images|`qm disk rescan [OPTIONS]`
Extend volume size|`qm disk resize [OPTIONS]`
Unlink/delete disk images|`qm disk unlink --idlist [OPTIONS]`
rescan volumes|`qm rescan`
.|VM Snapshot
List all snapshots|`qm listsnapshot `
Snapshot a VM|`qm snapshot `
Delete a snapshot|`qm delsnapshot `
Rollback a snapshot|`qm rollback `
.|Guest VM Ops
Execute Qemu Guest Agent commands|`qm guest cmd `
Executes the given command via the guest agent|`qm guest exec [] [OPTIONS]`
Gets the status of the given pid started by the guest-agent|`qm guest exec-status `
Sets the password for the given user to the given password|`qm guest passwd [OPTIONS]`
.|VM CloudInit
Get an auto-generated cloudinit config|`qm cloudinit dump `
Get the cloudinit config with both current and pending values|`qm cloudinit pending `
Regenerate and change cloudinit config drive|`qm cloudinit update `
.|Misc VM Ops
Open a terminal using a serial device. The VM need to have a serial device configured, e.g., serial0: socket|`qm terminal [OPTIONS]`
Proxy VM VNC traffic to stdin/stdout|`qm vncproxy `
.|Container Query
List containers|`pct list`
Show CT status|`pct status [OPTIONS]`
Get container config|`pct config [OPTIONS]`
Print the list of assigned CPU sets|`pct cpusets`
Get the container config, including pending changes|`pct pending `
.|Container Manipulation
Create or restore a container|`pct create [OPTIONS]`
Start the container|`pct start [OPTIONS]`
Create a container clone/copy|`pct clone [OPTIONS]`
Suspend the container (experimental)|`pct suspend `
Resume the container|`pct resume `
Stop the container|`pct stop `
Stop all the processes in the container|`pct stop [OPTIONS]`
Clean shutdown of the container, see lxc-stop(1)|`pct shutdown [OPTIONS]`
Destroy the container|`pct destroy [OPTIONS]`
Migrate the container to another node. Creates a new migration task.|`pct migrate [OPTIONS]`
Reboot the container, apply the pending changes|`pct reboot [OPTIONS]`
Create or restore a container|`pct restore [OPTIONS]`
Set container options|`pct set [OPTIONS]`
Create a Template|`pct template `
Unlock the container|`pct unlock `
Enter into a container (without password)|`pct enter `
.|Container Disk Manipulation
Get the current disk usage|`pct df `
Run a fsck on a container volume|`pct fsck [OPTIONS]`
Run fstrim on a chosen CT and its mountpoints|`pct fstrim [OPTIONS]`
Mount the container's filesystem on the host. This will hold a lock on the container. For emergency only as it will prevent further operations on the container other than start and stop.|`pct mount `
Move a rootfs-/mp-volume to a different storage or to a different container.|`pct move-volume [] [] [] [OPTIONS]`
Unmount the container's filesystem|`pct unmount `
Resize a container mount point|`pct resize [OPTIONS]`
Rescan to update disk sizes and unused disk images|`pct rescan [OPTIONS]`
Connect to container|`pct enter `
Launch a console for the specified container.
pct console [OPTIONS]
Launch a shell for the specified container.
pct enter
Launch a command inside the specified container.
pct exec []
Copy a file from the container to the local system.
pct pull [OPTIONS]
Copy a local file to the container.
pct push [OPTIONS]
## Container Snapshot Manipulation
```sh
# Snapshot a container.
pct snapshot <vmid> <snapname> [OPTIONS]
# List all snapshots.
pct listsnapshot <vmid>
# Rollback LXC state to specified snapshot.
pct rollback <vmid> <snapname> [OPTIONS]
# Delete a LXC snapshot.
pct delsnapshot <vmid> <snapname> [OPTIONS]
Container Templates
pveam update
pveam available
pveam download local ubuntu-18.10-standard_18.10-2_amd64.tar.gz