How to use the command qm guest cmd (with examples)
The qmguest cmd
command allows users to execute specific QEMU Guest Agent commands on a virtual machine in Proxmox. The QEMU Guest Agent is a daemon that runs inside the virtual machine and provides various management and monitoring functions.
Use case 1: Execute a specific QEMU Guest Agent command
Code:
qm guest cmd virtual_machine_id command
Motivation: The motivation behind using this command is to execute a specific QEMU Guest Agent command on a virtual machine. This can be useful for tasks such as freezing or thawing file systems, running file system trimming, getting file system information, and more.
Explanation:
virtual_machine_id
: This is the ID of the virtual machine where the command will be executed.command
: This is the specific QEMU Guest Agent command to be executed.
Example output:
qm guest cmd 100 fsfreeze-freeze
The above command will execute the fsfreeze-freeze
command on the virtual machine with ID 100, which will freeze the file systems in the virtual machine.
Use case 2: Execute a different QEMU Guest Agent command
Code:
qm guest cmd virtual_machine_id command
Motivation: This use case is similar to the previous one but with a different QEMU Guest Agent command. It can be used to perform various actions on the virtual machine, such as checking the status of frozen file systems, trimming file systems, getting file system information, and more.
Explanation:
virtual_machine_id
: This is the ID of the virtual machine where the command will be executed.command
: This is the specific QEMU Guest Agent command to be executed.
Example output:
qm guest cmd 100 get-fsinfo
The above command will execute the get-fsinfo
command on the virtual machine with ID 100, which will retrieve the file system information for the virtual machine.
Use case 3: Execute multiple QEMU Guest Agent commands
Code:
qm guest cmd virtual_machine_id command1; qm guest cmd virtual_machine_id command2; qm guest cmd virtual_machine_id command3
Motivation: This use case demonstrates how to execute multiple QEMU Guest Agent commands sequentially on the same virtual machine. It can be useful for performing a series of actions or collecting various information from the virtual machine.
Explanation:
virtual_machine_id
: This is the ID of the virtual machine where the commands will be executed.command1
,command2
,command3
: These are the specific QEMU Guest Agent commands to be executed.
Example output:
qm guest cmd 100 fsfreeze-freeze; qm guest cmd 100 get-fsinfo; qm guest cmd 100 fsfreeze-thaw
The above command will execute three QEMU Guest Agent commands, fsfreeze-freeze
, get-fsinfo
, and fsfreeze-thaw
, in sequence on the virtual machine with ID 100. This can be used, for example, to freeze file systems, retrieve file system information, and then thaw the file systems.
Conclusion:
The qm guest cmd
command provides a convenient way to execute specific QEMU Guest Agent commands on virtual machines. By using this command, users can perform a wide range of management and monitoring tasks on their virtual machines in Proxmox.