LVM-逻辑卷管理

  • 查看当前系统已存在物理卷

    pvdisplay

  • 查看当前系统已存在卷组

    vgdisplay

  • 查看当前系统存在的逻辑卷

    lvdisplay

  • 查看系统块设备

    lsblk -l

  • 删除逻辑卷

    lvremove /dev/vg9/lv9c2016

  • 创建逻辑卷

    lvcreate -L 30G -n lv0-windows10 vg0

  • 逻辑卷扩容

    lvextend -L +20G /dev/vg0/lv0-windows10

  • 指定逻辑卷安装windows10

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    virt-install \
    --virt-type kvm \
    --name windows10 \
    --ram 8192 \
    --cdrom=/uni/windows10/cn_windows_10_enterprise_version_1607_x64_dvd_9057083.iso \
    --boot cdrom \
    --cpu core2duo \
    --network bridge=br0,model='e1000' \
    --graphics vnc,listen=0.0.0.0 \
    --disk path=/dev/mapper/vg0-lv0--windows10,bus='ide' \
    --noautoconsole \
    --os-type=windows

  • windows10 扩容磁盘

    lvcreate -L 50G -n lv9-windows10 vg9

    virsh edit windows10

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    <disk type='block' device='disk'>
        <driver name='qemu' type='raw' cache='none' io='native'/>
        <source dev='/dev/mapper/vg0-lv0--windows10'/>
        <target dev='hda' bus='ide'/>
        <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
        <driver name='qemu' type='raw'/>
        <source file='/uni/windows10/cn_windows_10_enterprise_version_1607_updated_jul_2016_x64_dvd_9057083.iso'/>
        <target dev='hdb' bus='ide'/>
        <readonly/>
        <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>

    <!-- 以下为新加 -->
    <disk type='block' device='disk'>
        <driver name='qemu' type='raw' cache='none' io='native'/>
        <source dev='/dev/mapper/vg9-lv9--windows10'/>
        <target dev='hdc' bus='ide'/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
    </disk>

参考资料:
fdisk-磁盘分区与分区扩容
LVM基本介绍与常用命令