4

ipxe远程启动iscsi上面的克隆卷

 7 months ago
source link: https://bajie.dev/posts/20240118-ipxe_iscsi/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Ipxe远程启动iscsi上面的克隆卷

2024-01-18 1 分钟阅读

按上一篇所说,我们已经弄了个iscsi上面的win7卷,其实就是把萝卜花园的win7 clone到了一个10G的文件卷上。

引申问题: 大家其实可以用qcow2的文件格式保存的:

qemu-img create -f qcow2 /export/iscsi/windows7.qcow2 60G  
vi /etc/tgt/targets.conf

<target iqn.2016-07.com.renhe:renhe-16-8-6.disk03>  
    backing-store /export/iscsi/disk03.img
    backing-store /export/iscsi/windows7.qcow2
    write-cache off
</target>

tgt-admin --execute  

那么,我们如何让ipxe直接起动这个iscsi卷呢? 还是编辑boot2.php即可:

  case '\52:54:00:d9:fe:43':
    echo "sanboot iscsi:172.16.8.6::3260:1:iqn.2016-07.iscsi:disk03\n";
    break;

注意啊,查遍很多网上资料: sanboot的参数都是iscsi:ip::::iqn,实际无论是实体机的pxe,还是kvm虚拟机的pxe,都无法启动。以下格式才是正确的: iscsi:ip::3260:1:iqn

这样装个win7就简单了,拷贝一下disk03.img这个模板,启动pxe即可

#!/bin/bash
virt-install \  
--name=pxe-16-11-8 \
--vcpu=2 \
--ram=4096 \
--nodisks \
--boot network \
--os-type=windows  \
--os-variant=win7 \
--network bridge=br0 \
--vnc --vnclisten=0.0.0.0 --vncport=5910

以后就可以用这个办法瞬间弄出一堆win虚机了,用完就删除


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK