KVM管理

基本命令
virsh list --all #列出当前宿主机上所有的虚拟机
virsh start testvm #开启testvm虚拟机
virsh shutdown testvm #关闭一台虚拟机
virsh snapshot-create-as --name centos-init testvm --description 20230930 #创建一个名为centos-init的快照
virsh snapshot-list testvm #查看testvm虚拟机拥有的快照

启用console登录,虚拟机中
vi /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quit console=ttyS0"
update-grub2
init 6

add a serial ttyS1 serial port which can be accessed via telnet, save the following XML fragment to "serial.xml"
<serial type='tcp'>
<source mode='bind' host='127.0.0.1' service='5000' tls='no'/>
<protocol type='telnet'/>
<target port='1'/>
</serial>

virsh attach-device --config debian12 serial.xml --persistent

在虚拟机内
systemctl start getty@ttyS1.service
systemctl enable getty@ttyS1.service

Console Size

When using virsh console to connect via serial to machines managed by libvirtd, console size is stuck at the standard 80x24.

https://www.nodinrogers.com/post/2022-05-01-kvm-and-vm-consol...

评论

暂无评论