本文基于【完结】Virtual DSM 逆向笔记 (基于libvirt的安装及升级) (jxcn.org)
感谢chk-jxcn的分享!
安装镜像的准备
链接:https://pan.baidu.com/s/16I89NHPTW6TDx7ACh67yiA
提取码:7hkq
下载下来的镜像是原作者chk-jxcn(jxcn.org)从 DSM 中提取出的 VDSM 7.0 的安装镜像,未做任何修改。感谢chk-jxcn的无私分享!
该镜像比较大,两个都是20g,不太方便复制,所以自己提取安装镜像
在实体机或者虚拟机安装的DSM系统中,安装Virtual Machine Manager套件
在下载中心 - VirtualDSM | Synology 群晖科技 中,下载7.1.1-42962-up1映像到本地
打开VMM套件,点映像-DSM映像-新增-从计算机-选择下载好的VDSM映像,之后一直点下一步,最后显示状态良好就说明映像安装成功了
点虚拟机-新增-Synology Virtual DSM-下一步
名称、CPU、内存自定义
新建一个虚拟盘,容量填10GB,后面点下一步,等待虚拟机创建好
点击操作-导出-选择一个文件夹,导出模式默认是常规OVA,导出成功后,可以得到一个ova文件:
将该文件下载到本地计算机,使用解压软件解压,可得到vdsm-disk1.vmdk、vdsm-disk2.vmdk、vdsm-disk3.vmdk、vdsm-disk4.vmdk 4个Virtual Disk文件,将vdsm-disk1.vmdk、vdsm-disk2.vmdk 这2个文件上传到UNRAID目录中(自定义)
打开UNRAID终端,cd到存放vmdk的目录下,执行
qemu-img info vdsm-disk1.vmdk
得到如下输出,所以需将该文件转换为qcow2文件
image: vdsm-disk1.vmdk
file format: vmdk
virtual size: 10 GiB (10737418240 bytes)
disk size: 18.5 MiB
cluster_size: 65536
Format specific information:
cid: 3271625478
parent cid: 4294967295
create type: streamOptimized
extents:
[0]:
compressed: true
virtual size: 10737418240
filename: vdsm-disk1.vmdk
cluster size: 65536
format:
输入如下命令,将vmdk文件转换成qcow2文件
qemu-img convert -c -O qcow2 vdsm-disk1.vmdk vdsm-disk1.qcow2
qemu-img convert -c -O qcow2 vdsm-disk2.vmdk vdsm-disk2.qcow2
创建用户数据盘
truncate -s 100G /opt/vdsm/user_data.img
导入xml
将vdsm_template.xml复制到该目录下,执行如下命令:
virsh define vdsm_template.xml
vdsm_template.xml内容如下:值得注意的是,引入vdsm-disk1.qcow2的时候,需要修改format=qcow2
<qemu:arg value='file=/mnt/user/domains/VDSM/vdsm-disk1.qcow2,if=none,id=drive-synoboot,format=qcow2,cache=none,aio=native,detect-zeroes=on'/>
<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm' id='28' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
<name>VDSM</name>
<uuid>45b0c861-2ca3-4717-aee0-0d5255d23eed</uuid>
<title>DSM instance: test</title>
<memory unit='KiB'>1048576</memory>
<currentMemory unit='KiB'>1048576</currentMemory>
<vcpu placement='static'>1</vcpu>
<resource>
<partition>/machine</partition>
</resource>
<os>
<type arch='x86_64' machine='pc-i440fx-2.2'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
<hap state='on'/>
</features>
<cpu mode='host-passthrough' check='none' migratable='on'>
<topology sockets='1' dies='1' cores='1' threads='1'/>
</cpu>
<clock offset='variable' adjustment='-13' basis='utc'>
<timer name='rtc' tickpolicy='catchup' track='guest'/>
<timer name='pit' tickpolicy='delay'/>
<timer name='hpet' present='no'/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<controller type='usb' index='0' model='piix3-uhci'>
<alias name='usb'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pci-root'>
<alias name='pci.0'/>
</controller>
<controller type='virtio-serial' index='0'>
<alias name='virtio-serial0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</controller>
<interface type='bridge'>
<mac address='52:54:00:18:1c:84'/>
<source bridge='br0'/>
<target dev='vnet27'/>
<model type='virtio'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</interface>
<serial type='pty'>
<source path='/dev/pts/23'/>
<target type='isa-serial' port='0'>
<model name='isa-serial'/>
</target>
<alias name='serial0'/>
</serial>
<console type='pty' tty='/dev/pts/23'>
<source path='/dev/pts/23'/>
<target type='serial' port='0'/>
<alias name='serial0'/>
</console>
<channel type='tcp'>
<source mode='connect' host='127.0.0.1' service='12345' tls='no'>
<reconnect enabled='yes' timeout='10'/>
</source>
<protocol type='raw'/>
<target type='virtio' name='vchannel' state='connected'/>
<alias name='channel0'/>
<address type='virtio-serial' controller='0' bus='0' port='1'/>
</channel>
<input type='mouse' bus='ps2'>
<alias name='input0'/>
</input>
<input type='keyboard' bus='ps2'>
<alias name='input1'/>
</input>
<audio id='1' type='none'/>
<memballoon model='virtio'>
<alias name='balloon0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</memballoon>
<rng model='virtio'>
<backend model='random'>/dev/random</backend>
<alias name='rng0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x1c' function='0x0'/>
</rng>
</devices>
<seclabel type='dynamic' model='dac' relabel='yes'>
<label>+0:+100</label>
<imagelabel>+0:+100</imagelabel>
</seclabel>
<qemu:commandline>
<qemu:arg value='-device'/>
<qemu:arg value='virtio-scsi-pci,id=hw-synoboot,bus=pci.0,addr=0xa'/>
<qemu:arg value='-drive'/>
<qemu:arg value='file=/mnt/user/domains/VDSM/vdsm-disk1.qcow2,if=none,id=drive-synoboot,format=qcow2,cache=none,aio=native,detect-zeroes=on'/>
<qemu:arg value='-device'/>
<qemu:arg value='scsi-hd,bus=hw-synoboot.0,channel=0,scsi-id=0,lun=0,drive=drive-synoboot,id=synoboot0,bootindex=1'/>
<qemu:arg value='-device'/>
<qemu:arg value='virtio-scsi-pci,id=hw-synosys,bus=pci.0,addr=0xb'/>
<qemu:arg value='-drive'/>
<qemu:arg value='file=/mnt/user/domains/VDSM/vdsm-disk2.qcow2,if=none,id=drive-synosys,format=qcow2,cache=none,aio=native,detect-zeroes=on'/>
<qemu:arg value='-device'/>
<qemu:arg value='scsi-hd,bus=hw-synosys.0,channel=0,scsi-id=0,lun=0,drive=drive-synosys,id=synosys0,bootindex=2'/>
<qemu:arg value='-device'/>
<qemu:arg value='virtio-scsi-pci,id=hw-userdata,bus=pci.0,addr=0xc'/>
<qemu:arg value='-drive'/>
<qemu:arg value='file=/mnt/user/domains/VDSM/user_data.img,if=none,id=drive-userdata,format=raw,cache=none,aio=native,detect-zeroes=on'/>
<qemu:arg value='-device'/>
<qemu:arg value='scsi-hd,bus=hw-userdata.0,channel=0,scsi-id=0,lun=0,drive=drive-userdata,id=userdata0,bootindex=3'/>
</qemu:commandline>
</domain>
启动虚拟机
virsh start VDSM
暂无评论内容