在lvm分区中用clone的方法创建新的kvm guest vm

virsh list --all virsh shutdown boe 复制vm定义文件 ============== virsh dumpxml boe > /tmp/platform.xml 需要修改的内容:uuid (uuidgen)、 name、 disk、 mac uuidgen : 4d4e9ccf-4bcc-46e3-be37-63f932875072 http://www.miniwebtool.com/mac-address-generator/ : 50:a0:6d:17:bb:5b 路由器ARP绑定 ============== 192.168.0.11 50:a0:6d:17:bb:5b 复制分区(目标分区大于源分区) ============================= lvdisplay lvcreate -L 2.5G -n platform LVM_1 virt-filesystems -lh -a /dev/LVM_1/boe virt-resize --expand /dev/sda1 /dev/LVM_1/boe /dev/LVM_1/platform 需要修改的内容: /etc/sysconfig/network (主机名)、/etc/hosts(本地dns)、 /etc/sysconfig/network-scripts/ifcfg-eth0(ip地址,主机名,mac地址(启动前修改) ) guestfish -i -a /dev/LVM_1/platform 创建swap分区 ============ lvcreate -L 1024M -n platform-swap LVM_1 ******************* virsh define /tmp/platform.xml virsh autostart platform virsh start platform 初始化swap分区 fdisk /dev/sdb Command (m for help): n Command action p Partition number (1-4): 1 ............. Command (m for help): t Partition number (1-4): 1 Hex code (type L to list codes): L Hex code (type L to list codes): 82 Command (m for help): w mkswap /dev/sdb1 swapon /dev/sdb1 cat /proc/swaps

你可能感兴趣的:(kvm,lvm,virsh)