给kvm虚拟机增加磁盘

本文详细介绍了如何在KVM虚拟机中使用virsh attach-disk命令添加新的磁盘设备,包括命令参数解析及实际操作步骤。首先通过virsh attach-disk命令的选项解释,如--targetbus、--driver和--subdriver等。接着展示了创建新磁盘(qcow2格式)并将其附加到虚拟机的过程,强调了--persistent参数使更改持久化。最后,通过fdisk -l命令验证虚拟机已成功添加新的磁盘设备。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一,virsh attach-disk子命令

[root@localhost src]# virsh help attach-disk

NAME

attach-disk - attach disk device

 

SYNOPSIS

attach-disk <domain> <source> <target> [--targetbus <string>] [--driver <string>] [--subdriver <string>] [--iothread <string>] [--cache <string>] [--type <string>] [--mode <string>] [--so

urcetype <string>] [--serial <string>] [--wwn <string>] [--rawio] [--address <string>] [--multifunction] [--print-xml] [--persistent] [--config] [--live] [--current]

DESCRIPTION

Attach new disk device.

 

OPTIONS

[--domain] <string> domain name, id or uuid

[--source] <string> source of disk device

[--target] <string> target of disk device

--targetbus <string> target bus of disk device

--driver <string> driver of disk device

--subdriver <string> subdriver of disk device

--iothread <string> IOThread to be used by supported device

--cache <string> cache mode of disk device

--type <string> target device type

--mode <string> mode of device reading and writing

--sourcetype <string> type of source (block|file)

--serial <string> serial of disk device

--wwn <string> wwn of disk device

--rawio needs rawio capability

--address <string> address of disk device

--multifunction use multifunction pci under specified address

--print-xml print XML document rather than attach the disk

--persistent make live change pers

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值