之前黑群晖都是用物理机,各种调参数。实测还是虚拟机用黑群晖更舒服。
本社区版qemu虚拟化黑群晖已经稳定运行2星期没有宕机,理论上可以永久使用了。
准备
1.根据教程编译最新的qemu5.0.
2.了解到二进制文件路径为:
/usr/libexec/qemu-system-x86_64
3.了解当前编译的qemu的machine
[root@node01 qemu]# /usr/libexec/qemu-system-x86_64 -machine help
Supported machines are:
microvm microvm (i386)
pc Standard PC (i440FX + PIIX, 1996) (alias of pc-i440fx-5.0)
pc-i440fx-5.0 Standard PC (i440FX + PIIX, 1996) (default)
4.获取引导镜像:DS3615xs+LSI阵列卡_7.0.1-42218(引导文件).img
,这个可以前往各论坛获取,后面我会编译驱动再进行描述。
5.创建文件夹,将引导移入该文件夹,重命名为boot.img,储存路径为/qemu/ds3615/boot.img
6.准备unraid生成的xml配置,对其进行修改。
<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm' id='12'>
<name>ds3615</name>
<memory unit='GiB'>8</memory>
<currentMemory unit='GiB'>8</currentMemory>
<memoryBacking>
<nosharepages/>
</memoryBacking>
<vcpu placement='static'>8</vcpu>
<iothreads>4</iothreads>
<cputune>
<vcpupin vcpu='0' cpuset='4'/>
<vcpupin vcpu='1' cpuset='12'/>
<vcpupin vcpu='2' cpuset='5'/>
<vcpupin vcpu='3' cpuset='13'/>
<vcpupin vcpu='4' cpuset='6'/>
<vcpupin vcpu='5' cpuset='14'/>
<vcpupin vcpu='6' cpuset='7'/>
<vcpupin vcpu='7' cpuset='15'/>
</cputune>
<resource>
<partition>/machine</partition>
</resource>
<os>
<type arch='x86_64' machine='pc-i440fx-5.0'>hvm</type>
</os>
<features>
<acpi/>
<apic/>
</features>
<cpu mode='host-passthrough' check='none' migratable='on'>
<topology sockets='1' dies='1' cores='4' threads='2'/>
<cache mode='passthrough'/>
</cpu>
<clock offset='utc'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
<timer name='hpet' present='no'/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/libexec/qemu-system-x86_64</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='writeback'/>
<source file='/qemu/ds3615/boot.img' index='0'/>
<backingStore/>
<target dev='hdz' bus='usb'/>
<boot order='1'/>
<alias name='usb-disk2'/>
<address type='usb' bus='0' port='1'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='writeback'/>
<source file='/qemu/ds3615/vdisk1.raw' index='1'/>
<backingStore/>
<target dev='hda' bus='scsi'/>
<alias name='scsi0-0-0-3'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='writeback'/>
<source file='/qemu/ds3615/vdisk2.raw' index='2'/>
<backingStore/>
<target dev='hdb' bus='sata'/>
<alias name='sata0-0-4'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<controller type='usb' index='0' model='ich9-ehci1'>
<alias name='usb'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x7'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci1'>
<alias name='usb'/>
<master startport='0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0' multifunction='on'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci2'>
<alias name='usb'/>
<master startport='2'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci3'>
<alias name='usb'/>
<master startport='4'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x2'/>
</controller>
<controller type='scsi' index='0' model='virtio-scsi'>
<alias name='scsi0'/>
<driver iothread='4'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</controller>
<controller type='pci' index='0' model='pci-root'>
<alias name='pci.0'/>
</controller>
<controller type='sata' index='0'>
<alias name='sata0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</controller>
<controller type='virtio-serial' index='0'>
<alias name='virtio-serial0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</controller>
<interface type='bridge'>
<mac address='00:11:32:12:34:56'/>
<source bridge='br0'/>
<target dev='vnet2'/>
<model type='virtio'/>
<alias name='net0'/>
<driver name='vhost' txmode='iothread' ioeventfd='on' event_idx='off' queues='4'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<source path='/dev/pts/2'/>
<target type='isa-serial' port='0'>
<model name='isa-serial'/>
</target>
<alias name='serial0'/>
</serial>
<console type='pty' tty='/dev/pts/2'>
<source path='/dev/pts/2'/>
<target type='serial' port='0'/>
<alias name='serial0'/>
</console>
<channel type='unix'>
<source mode='bind' path='/var/lib/libvirt/qemu/channel/target/domain-12-dsm3615/org.qemu.guest_agent.0'/>
<target type='virtio' name='org.qemu.guest_agent.0' state='disconnected'/>
<alias name='channel0'/>
<address type='virtio-serial' controller='0' bus='0' port='1'/>
</channel>
<input type='tablet' bus='usb'>
<alias name='input0'/>
<address type='usb' bus='0' port='2'/>
</input>
<input type='mouse' bus='ps2'>
<alias name='input1'/>
</input>
<input type='keyboard' bus='ps2'>
<alias name='input2'/>
</input>
<graphics type='vnc' port='5902' autoport='yes' websocket='5702' listen='0.0.0.0' keymap='en-us'>
<listen type='address' address='0.0.0.0'/>
</graphics>
<video>
<model type='vmvga' vram='16384' heads='1' primary='yes'/>
<alias name='video0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<alias name='balloon0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</memballoon>
</devices>
<seclabel type='dynamic' model='dac' relabel='yes'>
<label>+0:+100</label>
<imagelabel>+0:+100</imagelabel>
</seclabel>
</domain>
7.创建硬盘,一块1T主硬盘,一块100G备用
qemu-img create -f raw vdisk1.raw 1024G
qemu-img create -f raw vdisk2.raw 120G
使用
部署
由于本引导无法驱动virtio-blk,以及第二块virtio-scsi的smart信息无法欺骗,因此换成了sata模式。(群晖不支持第二个硬盘使用另一个scsi控制器)
virsh define ds3615-scsi+sata.xml
virsh start ds3615
120G硬盘在前面,为备用硬盘,用来扩容。
1T硬盘在后面,为主数据盘。
扩容
将使用120G作为中转,理论上可以用群晖的无损迁移功能,但我没试过,因此我不在这里误人子弟了。
测试硬盘性能
volume1/ 是virtio-scsi
volume2/ 是sata
ash-4.4# dd if=/dev/zero of=test bs=1M count=10240 oflag=direct
10240+0 records in
10240+0 records out
10737418240 bytes (11 GB, 10 GiB) copied, 149.063 s, 72.0 MB/s
ash-4.4# cd ../
ash-4.4# cd volume
volume1/ volume2/
ash-4.4# cd volume2/
ash-4.4# dd if=/dev/zero of=test bs=1M count=10240 oflag=direct
10240+0 records in
10240+0 records out
10737418240 bytes (11 GB, 10 GiB) copied, 234.938 s, 45.7 MB/s
90G文件用时
virtio-scsi+4队列:群晖smb读4分0秒-4分19秒 群晖smb写:3分42秒-4分08秒 (不稳定)
virtio-scsi:群晖smb读4分02秒-5分15秒 群晖smb写 3分11秒-3分26秒 (稳定不动)
sata 群晖smb读:4分0秒-5分27秒-3分59秒 群晖smb写:2分39秒-3分04秒-3分41秒 (稳定上升)
因此我原计划是使用sata控制器,但实际使用过程中,sata控制器可能会出现故障导致虚拟机死机,因此我后面又取消为只使用scsi控制器。
注意
使用
virsh console ds3615 --safe
报错:[268833.033777] cdb[0]=0x28: 28 00 00 07 fc 40 00 00 08 00
[268833.035301] ata1.00: configured for UDMA/33
[268833.036769] ata1.00: cmd c8/00:08:50:fc:07/00:00:00:00:00/e0 tag 22 dma 4096 in
[268833.036769] res 41/04:08:50:fc:07/00:00:00:00:00/e0 Emask 0x1 (device error)
[268833.038737] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
[268833.039760] ata1.00: configured for UDMA/33
[268833.041531] ata1.00: irq_stat 0x40000001
[268833.041839] sd 0:0:0:0: [sda]
[268833.042134] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
[268833.043146] ata1.00: configured for UDMA/33
搜索exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
,与sata控制器出错的问题强相关。
因此建议平常使用还是用virtio-scsi
参考:
【11月1日更新DS3615阵列卡驱动】黑群晖DS918和DS3615的7.X引导
版权属于:寒夜方舟
本文链接:https://www.wnark.com/archives/174.html
本站所有原创文章采用署名-非商业性使用 4.0 国际 (CC BY-NC 4.0)。 您可以自由地转载和修改,但请注明引用文章来源和不可用于商业目的。声明:本博客完全禁止任何商业类网站转载,包括但不限于CSDN,51CTO,百度文库,360DOC,AcFun,哔哩哔哩等网站。
1 条评论
还有个反向的,群晖安装 kvm qume 环境 配合webvirtmgr管理,也是有点意思,解决了没有vt的处理器使用虚拟机的问题,就是DSM7没法用了