5.2 KiB
Here are the updated VM creation commands with recommended settings:
Debian 12 VM (ID: 500):
qm create 500 --name debian-12 --memory 2048 --cores 2 --net0 virtio,bridge=vmbr0 --net1 virtio,bridge=vmbr1
qm importdisk 500 debian-12-genericcloud-amd64.qcow2 local-lvm
qm set 500 --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-500-disk-0
qm set 500 --boot c --bootdisk scsi0
qm set 500 --serial0 socket --vga serial0
qm set 500 --agent enabled=1
qm resize 500 scsi0 +8G
qm set 500 --ipconfig0 ip=dhcp
qm set 500 --ipconfig1 ip=dhcp
qm set 500 --onboot 1
qm set 500 --startup order=1
Ubuntu 22.04 Desktop VM (ID: 600):
qm create 600 --name ubuntu-22-04-desktop --memory 4096 --cores 2 --net0 virtio,bridge=vmbr0 --net1 virtio,bridge=vmbr1
qm importdisk 600 ubuntu-22.04-desktop-amd64.qcow2 local-lvm
qm set 600 --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-600-disk-0
qm set 600 --boot c --bootdisk scsi0
qm set 600 --serial0 socket --vga qxl
qm set 600 --agent enabled=1,fstrim_cloned_disks=1
qm resize 600 scsi0 +32G
qm set 600 --ipconfig0 ip=dhcp
qm set 600 --ipconfig1 ip=dhcp
qm set 600 --onboot 1
qm set 600 --startup order=2
Rocky Linux 9 VM (ID: 700):
qm create 700 --name rocky-linux-9 --memory 2048 --cores 2 --net0 virtio,bridge=vmbr0 --net1 virtio,bridge=vmbr1
qm importdisk 700 rocky-linux-9-genericcloud-amd64.qcow2 local-lvm
qm set 700 --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-700-disk-0
qm set 700 --boot c --bootdisk scsi0
qm set 700 --serial0 socket --vga serial0
qm set 700 --agent enabled=1
qm resize 700 scsi0 +8G
qm set 700 --ipconfig0 ip=dhcp
qm set 700 --ipconfig1 ip=dhcp
qm set 700 --onboot 1
qm set 700 --startup order=3
Changes made:
- Increased memory for all VMs to accommodate desktop environments and applications.
- Added
--agent enabled=1to enable the QEMU Guest Agent for better VM management and performance. - Added
fstrim_cloned_disks=1for the Ubuntu VM to optimize disk space usage on cloned disks. - Increased disk size for the Ubuntu VM to 32GB to accommodate desktop applications and user data.
- Set
--vga qxlfor the Ubuntu VM to provide better graphics performance for the desktop environment. - Added
--onboot 1to enable automatic start on boot for all VMs. - Set startup order for the VMs using
--startup order=Xto control the boot sequence.
Remember to replace the paths to the disk images (debian-12-genericcloud-amd64.qcow2, ubuntu-22.04-desktop-amd64.qcow2, and rocky-linux-9-genericcloud-amd64.qcow2) with the actual paths to your respective VM disk images.
These updated commands create VMs with recommended settings for memory, cores, disk size, guest agent, graphics, and boot options to ensure optimal performance and management capabilities in a Proxmox VE environment.
Here's a guide to help you manage your VMs using the qm command-line tool in Proxmox VE:
-
Creating a VM: Use the
qm createcommand to create a new VM. Specify the VM ID, OS type, disk size, and other parameters. Example:qm create 100 --memory 1024 --net0 virtio,bridge=vmbr0 --bootdisk sata0 --ostype l26 --sockets 1 --cores 2 --sata0 local-lvm:32,format=qcow2 -
Configuring VM Hardware: Use the
qm setcommand to modify VM hardware settings such as CPU, memory, network, and disk. Examples:- Set CPU cores:
qm set 100 --cores 4 - Set memory:
qm set 100 --memory 2048 - Add a network device:
qm set 100 --net1 virtio,bridge=vmbr1 - Add a disk:
qm set 100 --sata1 local-lvm:64,format=qcow2
- Set CPU cores:
-
Starting and Stopping VMs:
- Start a VM:
qm start 100 - Stop a VM:
qm stop 100 - Shutdown a VM gracefully:
qm shutdown 100 - Reset a VM:
qm reset 100
- Start a VM:
-
Cloning and Templating:
- Clone a VM:
qm clone 100 101 - Create a template from a VM:
qm template 100 - Create a new VM from a template:
qm clone 100 102 --name "New VM"
- Clone a VM:
-
Managing Snapshots:
- Create a snapshot:
qm snapshot 100 snap1 - List snapshots:
qm listsnapshot 100 - Restore a snapshot:
qm rollback 100 snap1 - Delete a snapshot:
qm delsnapshot 100 snap1
- Create a snapshot:
-
Migrating VMs:
- Offline migration:
qm migrate 100 pve2 --online 0 - Online migration:
qm migrate 100 pve2 --online 1
- Offline migration:
-
Backup and Restore:
- Backup a VM:
vzdump 100 --storage local --compress lzo - Restore a VM:
qmrestore 100 vzdump-qemu-100-2023_05_20-14_30_00.vma.lzo --storage local-lvm
- Backup a VM:
-
Monitoring VM Performance:
- Show VM status:
qm status 100 - Show VM configuration:
qm config 100 - Show VM usage statistics:
qm monitor 100
- Show VM status:
-
Accessing VM Console:
- Access VM console:
qm terminal 100
- Access VM console:
-
Managing VM Disks:
- Move a VM disk to a different storage:
qm move-disk 100 scsi0 local-lvm - Resize a VM disk:
qm resize 100 scsi0 +10G
- Move a VM disk to a different storage:
Remember to replace 100 with the actual VM ID you want to manage.
These are just a few examples of what you can do with the qm command. For a complete list of available options and commands, refer to the qm manual page by running man qm.
Always make sure to have proper backups of your VMs before performing any major operations. Regularly monitor your VMs' resource usage and performance to ensure optimal operation.
Feel free to explore and experiment with different commands and options to effectively manage your VMs in Proxmox VE.