zoukankan      html  css  js  c++  java
  • 为虚拟机添加磁盘

    virsh attach-disk子命令

    attach-disk <domain> <source> <target>
    [--targetbus <string>]
    [--driver <string>]
    [--subdriver <string>]
    [--iothread <string>]
    [--cache <string>]
    [--type <string>]
    [--mode <string>]
    [--sourcetype <string>]
    [--serial <string>]
    [--wwn <string>]
    [--rawio]
    [--address <string>]
    [--multifunction]
    [--print-xml]
    [--persistent]
    [--config]
    [--live]
    [--current]

    OPTIONS

    [--domain] <string>        domain name, id or uuid
    [--source] <string>         source of disk device,--source后面必须跟绝对路径
    [--target] <string>          target of disk device,设定在虚拟机中此设备的设备文件名称,最好在添加硬盘之前到虚拟机中先查看确认一下磁盘设备名称;然后此处设置名称顺延,比如我的虚拟机中原来只有一块盘,其设备文件名为vda,所以我这里设定为vdb
    --targetbus <string>         target bus of disk device,用来设定客户机磁盘的总线类型
    --driver <string>          driver of disk device,根据模拟器而定,如果模拟器是qemu则此处的值只能是qemu;
    --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),磁盘源的大类,这里用的是file,也可以使用block
    --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 persistent,会让此操作同时对运行的虚拟机以及虚拟机的xml文件都会生效
    --config             affect next boot
    --live              affect running domain
    --current              affect current domain


    创建新的虚拟磁盘:
    qemu-img    create    -f qcow2         /kvm/os/add_test02.qcow2       10G

    添加虚拟磁盘到指定的虚拟机:
    virsh attach-disk    --domain test02    --source /kvm/os/add_test.qcow2    --target vdb    --targetbus virtio   --driver qemu   --subdriver qcow2    --sourcetype file    --cache none   --persistent --live

    virsh domblklist test02

    登录到test02虚拟节点

  • 相关阅读:
    HDU 2852 KiKi's K-Number (主席树)
    HDU 2089 不要62
    Light oj 1140 How Many Zeroes?
    Bless You Autocorrect!
    HDU 6201 transaction transaction transaction
    HDU1561 The more ,The better (树形背包Dp)
    CodeForces 607B zuma
    POJ 1651 Mulitiplication Puzzle
    CSUOJ 1952 合并石子
    Uva 1599 Ideal path
  • 原文地址:https://www.cnblogs.com/wyzhou/p/9947998.html
Copyright © 2011-2022 走看看