Update docs/tech_docs/proxmox_virtualmachines.md

This commit is contained in:
2024-04-19 06:07:06 +00:00
parent a364a1ab99
commit c115c0f3ea

View File

@@ -56,4 +56,68 @@ Changes made:
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.
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:
1. Creating a VM:
Use the `qm create` command 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
```
2. Configuring VM Hardware:
Use the `qm set` command 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`
3. 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`
4. 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"`
5. 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`
6. Migrating VMs:
- Offline migration: `qm migrate 100 pve2 --online 0`
- Online migration: `qm migrate 100 pve2 --online 1`
7. 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`
8. Monitoring VM Performance:
- Show VM status: `qm status 100`
- Show VM configuration: `qm config 100`
- Show VM usage statistics: `qm monitor 100`
9. Accessing VM Console:
- Access VM console: `qm terminal 100`
10. 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`
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.