CHBMB Posted December 7, 2015 Share Posted December 7, 2015 So we were talking the other day in #linuxserver.io about how a test rig would be useful to try out docker containers, compile mediabuild etc etc. I have been experimenting with trying to get Unraid running on Unraid KVM... Have got to the stage where I can boot up a copy of Unraid, used a vmdk posted somewhere on the forums. Converted it to an .img file and then mounted that in a Win10VM and updated it to 6.1.6. Passthrough a 2nd USB Key (my backup key) initially didn't work. Turns out for some reason that the make of USB key I use doesn't get recognised by Unraid as able to be passed through. This may be a problem with the specific model I was using, but it may be that I essentially had two identical USB Keys plugged into one machine. Swapping the key for an old SanDisk one I had on my desk worked and I was able to download a trial licence to get Unraid going. I've hit a wall at this point though.. Even creating virtual disks in KVM and passing them to unraid they aren't able to be assigned as they are not visible. This I assume is lack of drivers in Unraid?? Given that in reality for testing purposes a solitary cache disk would be sufficient, I wondered whether if I could passthrough a disk to Unraid to allow it to be assigned as a cache disk... My current XML is this <domain type='kvm' id='3'> <name>Unraid</name> <uuid>c8cdc054-0f64-fea2-40d3-d37c789146fa</uuid> <metadata> <vmtemplate name="Custom" icon="slackware.png" os="slackware"/> </metadata> <memory unit='KiB'>4194304</memory> <currentMemory unit='KiB'>4194304</currentMemory> <memoryBacking> <nosharepages/> <locked/> </memoryBacking> <vcpu placement='static'>1</vcpu> <cputune> <vcpupin vcpu='0' cpuset='0'/> </cputune> <resource> <partition>/machine</partition> </resource> <os> <type arch='x86_64' machine='pc-i440fx-2.3'>hvm</type> </os> <features> <acpi/> <apic/> </features> <cpu mode='host-passthrough'> <topology sockets='1' cores='1' threads='1'/> </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/bin/qemu-system-x86_64</emulator> <disk type='file' device='disk'> <driver name='qemu' type='raw' cache='writeback'/> <source file='/mnt/virtualisation/vm/UR.img'/> <backingStore/> <target dev='hda' bus='virtio'/> <boot order='1'/> <alias name='virtio-disk0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </disk> <disk type='file' device='disk'> <driver name='qemu' type='raw' cache='writeback'/> <source file='/mnt/virtualisation/vm/Unraid/vdisk2.img'/> <backingStore/> <target dev='hdb' bus='virtio'/> <alias name='virtio-disk1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </disk> <disk type='block' device='disk'> <driver name='qemu' type='raw'/> <source dev='/dev/disk/by-id/ata-OCZ-VERTEX3_OCZ-W02R60UNR99A384T'/> <backingStore/> <target dev='hdc' bus='virtio'/> <alias name='virtio-disk2'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> </disk> <controller type='usb' index='0'> <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='0x04' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:36:33:3a'/> <source bridge='vm0'/> <target dev='vnet0'/> <model type='virtio'/> <alias name='net0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> <serial type='pty'> <source path='/dev/pts/2'/> <target port='0'/> <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/Unraid.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'/> </input> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='5900' autoport='yes' websocket='5700' listen='0.0.0.0' keymap='en-gb'> <listen type='address' address='0.0.0.0'/> </graphics> <video> <model type='vmvga' vram='16384' heads='1'/> <alias name='video0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <hostdev mode='subsystem' type='usb' managed='yes'> <source> <vendor id='0x0781'/> <product id='0x5530'/> <address bus='1' device='2'/> </source> <alias name='hostdev0'/> </hostdev> <memballoon model='virtio'> <alias name='balloon0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> </memballoon> </devices> </domain> But again no disk is visible in Unraid.... Any ideas? Quote Link to comment
itimpi Posted December 7, 2015 Share Posted December 7, 2015 Have you tried changing the disk type so it does not use the virtio interface? It would probably result in lower performance, but I assume that is not a key factor in this setup? Quote Link to comment
peter_sm Posted December 7, 2015 Share Posted December 7, 2015 Yes, you need to change to sata, and if you boot your server with 2 unraid USB:s, you need to "hide" the one that would be used in a VM in syslinux.cfg, you can see more here http://lime-technology.com/forum/index.php?topic=42975.msg410173#msg410173 //Peter Quote Link to comment
CHBMB Posted December 7, 2015 Author Share Posted December 7, 2015 Yes, you need to change to sata, and if you boot your server with 2 unraid USB:s, you need to "hide" the one that would be used in a VM in syslinux.cfg, you can see more here http://lime-technology.com/forum/index.php?topic=42975.msg410173#msg410173 //Peter Thanks Peter, that works beautifully and was easy to setup as I've already done similar in a MacOS VM. Have you tried changing the disk type so it does not use the virtio interface? It would probably result in lower performance, but I assume that is not a key factor in this setup? I've tried unsuccessfully to pass through the disk as SATA. Here's my SATA devices. [0:0:0:0] disk USB DISK 3.0 PMAP /dev/sda [1:0:0:0] disk ATA WDC WD40EFRX-68W 0A82 /dev/sdj [1:0:1:0] disk ATA OCZ-VERTEX3 2.25 /dev/sdk [1:0:2:0] disk ATA SAMSUNG HD204UI 0001 /dev/sdl [1:0:3:0] disk ATA WDC WD40EFRX-68W 0A82 /dev/sdm [1:0:4:0] disk ATA WDC WD40EFRX-68W 0A82 /dev/sdn [2:0:0:0] disk ATA Samsung SSD 840 BB0Q /dev/sdb [3:0:0:0] disk ATA ST4000DM000-1F21 CC52 /dev/sdc [4:0:0:0] disk ATA ST4000DM000-1F21 CC52 /dev/sdd [5:0:0:0] disk ATA ST4000DM000-1F21 CC52 /dev/sde [6:0:0:0] disk ATA ST4000DM000-1F21 CC52 /dev/sdf [7:0:0:0] disk ATA WDC WD40EFRX-68W 0A80 /dev/sdg [8:0:0:0] disk ATA ST4000DM000-1F21 CC52 /dev/sdh [9:0:0:0] disk ATA ST4000DM000-1F21 CC52 /dev/sdi Tried this technique.. It's the OCZ disk I want to passthrough so using this <controller type='scsi' model='virtio-scsi'/> <hostdev mode='subsystem' type='scsi' rawio='yes'> <source> <adapter name='scsi_host01'/> <address bus='0' target='0' unit='1'/> </source> <readonly/> </hostdev> Gives me an error internal error: Failed to open /sys/bus/scsi/devices/1:0:0:1/scsi_generic Undeterred I tried <disk type='block' device='disk'> <driver name='qemu' type='raw' cache='writeback'/> <source dev='/dev/disk/by-id/ata-OCZ-VERTEX3_OCZ-W02R60UNR99A384T'/> <target dev='hdb' bus='scsi'/> </disk> This results in the disk being seen in the Unraid webui... Frustratingly I can't start the array to fully test as the disk I'm using actually has stuff on it that I need to keep (My Dad's PC backup after I nuked and paved Win7 to upgrade him to Win10) So I'm going to find a disk I can use to fully test.... Quote Link to comment
saarg Posted December 7, 2015 Share Posted December 7, 2015 rmance, but I assume that is not a key factor in this setup? Here's my SATA devices. [[color=red]1:0:1:0[/color]] disk ATA OCZ-VERTEX3 2.25 /dev/sdk Tried this technique.. It's the OCZ disk I want to passthrough so using this <controller type='scsi' model='virtio-scsi'/> <hostdev mode='subsystem' type='scsi' rawio='yes'> <source> <adapter name='scsi_host01'/> <address bus='0' target='0' unit='1'/> </source> <readonly/> </hostdev> Gives me an error internal error: Failed to open /sys/bus/scsi/devices/[color=red]1:0:0:1[/color]/scsi_generic Can't help much, but noticed there is a typo in the hostdev tag regarding the scsi number. Compare the red text Quote Link to comment
CHBMB Posted December 7, 2015 Author Share Posted December 7, 2015 Can't help much, but noticed there is a typo in the hostdev tag regarding the scsi number. Compare the red text Thanks Saarg, now I've got two different working configs.... Quote Link to comment
CHBMB Posted December 7, 2015 Author Share Posted December 7, 2015 So my next problem is I'm trying to work out how to create the unraid.img file I need to boot from I have an unraid.img file that I converted from a .vmdk I found on the forums, but decided that it would be better to be able to create one from scratch, because, well science.. So far this is how far I've got... ##Create 1GB image dd if=/dev/zero of=/path/to/unraid.img bs=1 count=0 seek=1G ##Partition image fdisk /path/to/unraid.img ##Then in fdisk 1. Add a new partition - press n 2. Select Primary partition - press p 3. Partition number - press 1 4. First sector - press return 5. Last sector - press return 6. Make bootable - press a 7. Partition number - press 1 8. Change a partition's system id - press t 9. Select b (W95 FAT32) 10.Write the partition - press w Now at this point this is what I have... With fdisk -l /path/to/unraid.img I get: Disk unraid.img: 1073 MB, 1073741824 bytes 139 heads, 8 sectors/track, 1885 cylinders, total 2097152 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xefed6b89 Device Boot Start End Blocks Id System unraid.img1 * 2048 2097151 1047552 b W95 FAT32 Which looks identical to the output I get from running fdisk -l convertedunraid.img (The image I converted from the vmdk... Now at this point I can mount the converted image by doing this.. ##Make mount point mkdir -p /path/to/convertedunraid ##Mount image mount -o rw,loop,offset=1048576 /path/to/convertedunraid.img /path/to/convertedunraid I can browse the mounted image and copy and paste stuff from it no problems. But I cannot get the same result using the unraid.img I have created from scratch. Tried to format it with mkfs fat32 -F /path/to/unraid.img Output mke2fs 1.42.8 (20-Jun-2013) Discarding device blocks: done Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 65536 inodes, 262144 blocks 13107 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=268435456 8 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376 Allocating group tables: done Writing inode tables: done Writing superblocks and filesystem accounting information: done But when I try and mount in with a new mount point mkdir -p /path/to/unraid mount -o rw,loop,offset=1048576 /path/to/unraid.img /path/to/unraid I get an error... mount: block device /mnt/virtualisation/vm/unraid.img is write-protected, mounting read-only mount: you must specify the filesystem type I'm almost certain that the problem lies with the formatting as the partition looks ok, but I'd be really grateful is anyone can give some advice.. Quote Link to comment
saarg Posted December 7, 2015 Share Posted December 7, 2015 Can't help much, but noticed there is a typo in the hostdev tag regarding the scsi number. Compare the red text Thanks Saarg, now I've got two different working configs.... And I failed miserably to make the text red So the lesson is, for me though, no colors in quotes! Quote Link to comment
jonp Posted December 7, 2015 Share Posted December 7, 2015 Try mkfs vfat instead of fat32. Quote Link to comment
CHBMB Posted December 7, 2015 Author Share Posted December 7, 2015 Try mkfs vfat instead of fat32. Tried that jonp, seems whatever I try when I run any variation og mkfs I seem to lose the partition on the .img file.. Quote Link to comment
CHBMB Posted December 7, 2015 Author Share Posted December 7, 2015 This seems to be what I'm seeing. Unfortunately I don't seem to be having much luck using losetup.. But at least it may be progress. Quote Link to comment
CHBMB Posted December 8, 2015 Author Share Posted December 8, 2015 Using a loop device I managed to get a .raw disk formatted, but it's not bootable.... Anyone got any ideas on how to make this bootable because then I think it'll work, I really do, I want to believe... Quote Link to comment
itimpi Posted December 8, 2015 Share Posted December 8, 2015 When you were trying to create the file system did you remember to include the partition number? If not then you would end up overwriting the partition table. Quote Link to comment
CHBMB Posted December 8, 2015 Author Share Posted December 8, 2015 When you were trying to create the file system did you remember to include the partition number? If not then you would end up overwriting the partition table. In Fdisk yes. Honestly with the mkfs command I'm not sure so I'm happy to hear suggestions. I did get a partition formatted and mounted last night but couldn't boot from it unfortunately. Quote Link to comment
CHBMB Posted December 9, 2015 Author Share Posted December 9, 2015 Got this figured out now... Will do a HOW-TO in the next week or so.. Quote Link to comment
CHBMB Posted December 14, 2015 Author Share Posted December 14, 2015 As promised... Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.