Virtual Unraid

Unraid as a VM guest on an Unraid host

Please read our disclaimer https://docs.ibracorp.io/#disclaimer.

Prerequisites

  • This guide is using Unraid version 6.9.2 (the latest stable version at the time of writing August 2021)

  • Working Unraid Server with HVM and IOMMU enabled

    • You can verify that by clicking the info button top right on your server

  • PC with Windows, MacOS or Linux to prepare the USB Stick

  • Spare USB Stick

  • Unraid license for the virtual Unraid server (trial license will work)

  • A good editor like Notepad++

DANGER!

Risk of data loss! Make backups - including your USB Flash drive.

Follow these instructions exactly as directed.

Unraid does not react kindly with two USB drives called Unraid on the same system. It can and will cause serious unprecedented issues.

We have tested this procedure and confirmed it works for us. However, this is experimental and we are not responsible or liable for any damage that might occur.

Before we start

There is a lot of information packed into this guide. Follow it step by step. If you feel lost or something does not work as intended, go back and trace your steps within this guide.

Preparations

New USB Stick

Prepare the new USB Stick - We will be using the manual method to have maximum control

If you are using a USB Stick with an existing license, backup the *.key file(s) in the config folder. Follow the process below and at the end, put the *.key file back into the config folder.

  • Format the new USB Stick with FAT32 and name it anything other than UNRAID, we will be using

UNRAIDVM
  • Download the zip archive for the Unraid version you want to use from https://unraid.net/download. For this guide we used unRAIDServer-6.9.2-x86_64.zip .

  • Copy the entire content of the zip archive (not the archive itself) into the root of your freshly formatted USB stick

  • Rename the folder EFI- in the root of the USB Stick to EFI (remove the hyphen)

  • Now we need to make sure that the virtual Unraid server has a different name than the host Unraid server (can't have two servers named Tower on the same LAN). Edit the file config/ident.cfg to change the name in line 2 NAME="servername".

  • Edit the syslinux/syslinux.cfg file on the new USB Stick. Add

unraidlabel=UNRAIDVM
  • to the append line of each label block. Your file should look like this:

default menu.c32
menu title Lime Technology, Inc.
prompt 0
timeout 50
label Unraid OS
  menu default
  kernel /bzimage
  append unraidlabel=UNRAIDVM initrd=/bzroot
label Unraid OS GUI Mode
  kernel /bzimage
  append unraidlabel=UNRAIDVM initrd=/bzroot,/bzroot-gui
label Unraid OS Safe Mode (no plugins, no GUI)
  kernel /bzimage
  append unraidlabel=UNRAIDVM initrd=/bzroot unraidsafemode
label Unraid OS GUI Safe Mode (no plugins)
  kernel /bzimage
  append unraidlabel=UNRAIDVM initrd=/bzroot,/bzroot-gui unraidsafemode
label Memtest86+
  kernel /memtest
  • (optional) If you want to use nested virtualization, in the label Unraid OS section, add

kvm_intel.nested=1

at the end of the append line, after initrd=/bzroot, separated by a space. The block should look like this:

label Unraid OS
  menu default
  kernel /bzimage
  append unraidlabel=UNRAIDVM initrd=/bzroot kvm_intel.nested=1
  • Create a new file called

startup.nsh

in the root of the new USB Stick. Put a single line into the file that reads

\EFI\boot\bootx64.efi
  • Edit the make_bootable.bat (or the appropriate version for your OS) in the root of the USB stick and change the line (32) set tag=UNRAID to

set tag=UNRAIDVM
  • Execute the make_bootable.bat (if you are not using Windows, choose the Mac or Linux version for your OS) as administrator and follow the instructions on your screen

  • Close all editor windows and use the Eject function on the USB Stick drive. Remove the USB Stick from your PC.

  • Insert the new USB Stick into the Unraid server and reboot the Unraid server. We want to make sure it boots from the correct USB Stick and not the new one.

NOTE Once you rebooted your Unraid server, check that your Unraid server looks and behaves normally. Does the license and name in the top right corner show correctly?

Preparing the Unraid server (host)

USB Plugin

Install the plugin USB Manager from CA Apps

No additional steps or setup are needed for now.

Custom Icons (optional)

To have the Unraid icon available for the VM:

  • Install vm_custom_icons from Community Apps. Leave all settings at default.

  • Keep the checkmark Start Container After Install checked and click APPLY .

  • You can set this docker container to auto start.

The container will pull the icons and will automatically shut down after a while. You don't have to wait for it.

Setting up a VM for Unraid

  • Ensure the VM service is enabled. If not, go to Settings / VM and enable it.

  • Go to the VMs tab and click ADD VM

  • Choose the Linux template for Slackware

  • (optional) Click on the Slackware icon. A window with a lot of icons will open. Choose the Unraid icon. (If you don't see a long list of icons, do the optional step Custom Icons above)

  • Change the name of the VM to something like UNRAIDVM

  • Set the logical CPUs to a minimum of 2 or more

  • Set the initial memory to at least 3GB or more, match the number for max memory

  • Choose the highest Q35 Machine (at time of writing Q35-5.1)

  • Leave the Bios at OVMF

  • Leave the USB Controller Setting at 2.0 (EHCI).

  • Adjust the vDisk settings:

    • Primary Location: Leave on Auto or change it, if you know what you are doing

    • Size: Choose the size you want in either xxG for GigaByte or xxT for TeraByte

    • Type:

      • raw for if you have the space and want to get the highest speed

      • qcow2 will only be as big as the data stored on it. It can grow to the maximum you specified. Preferred for testing VMs

    • Bus: Select SATA

  • Leave everything as is in the Graphics Card section, adjust your keyboard layout as needed

  • Sound Card: None

  • Network section: Leave everything at default

WARNING

DO NOT select the USB Stick under USB Devices!

  • Uncheck the Start VM after creation Checkbox

  • Click CREATE to save your new VM

    • Toggle the AUTO CONNECT TO VM AT VM START switch to on and in the Virtual Machine field choose your virtual Unraid server VM. Click Done.

    • This will connect the USB Stick to the VM at startup so that your server can boot from it. This method also works with USB Sticks from the same make/manufacturer as the USB Stick for your host Unraid server.

Start the Unraid VM

Go back to the VMS page and start the Unraid VM like any other VM. Open VNC Remote to watch the boot process.

With the USB Manager attaching the USB Stick to the vm and the changes to enable EFI boot, your server should boot straight into Unraid.

After your virtual Unraid server completed the boot process and presents you with the login prompt, you can use the IP address on the screen to access it.

Everything will behave just like any other Unraid server.

At this point it is a good idea to go into SETTINGS, SMB, scroll down to the Workgroup Settings and set Local Master to No.

Have fun!

Troubleshooting

If for some reason your server does not boot, here are some helpful tips:

The Unraid server does not boot

If you are presented with the EFI Shell

something is missing to allow Unraid to boot from the USB Stick. To find out do the following:

On the EFI prompt type exit and press enter. You will get into the bios menu. Go to Boot Manager and check the available options.

If you see your USB Stick, move the selection to your USB Stick and press enter. Your Unraid VM server will boot now. Check that you have a startup.nsh in your USB Stick root and retrace the steps in the preparations section above.

If you don't see your USB Stick, check in the USB Menu that the USB Stick is assigned to the VM at startup. Also check if your USB Stick shows up, if you change the USB Controller Setting to 3.0 (qemu XHCI) in the VM template.

If all else fails, put the USB Stick back into your PC and check each step from the beginning.

The IPv4 address starts with 169.254.x.x

Force shutdown your Unraid VM, take the USB Stick out and put it back into your PC. Carefully check all USB Stick preparations steps again, especially the changes to the files and that everywhere you used the same UNRAIDVM name.

Changing the boot order in the VM template

For some exotic scenarios, here is another way to boot. This will only work with a USB Stick from another manufacturer as the USB Stick the host Unraid server is using.

To change the boot order, we need to edit the XML of the Unraid VM.

Edit the Unraid VM. In the form view (toggle is in the top right corner) scroll down to the USB devices. Make note of the identifier at the end of that line (xxxx:xxxx).

Change into the XML view.

Locate the block for your virtual disk. The first line reads <disk type='file' device='disk'> and in that block copy and remove the line that reads <boot order='1'>.

Towards the bottom, locate the hostdev block. In there you will find a block with vendor/product id's matching your USB Stick. In between </source> and <address> enter the copied line from above <boot order='1'>.

Click UPDATE to save the changes.

Any manual change in the XML editor will be overwritten if you make changes in the form view, like adding drives, RAM, CPU cores, etc.

If you need to make changes: save them, go back into edit, switch to XML view, and redo the above change.

Final Words

We hope you enjoyed this guide. It was conceptualized, written, and implemented by our Community Leader DiscDuck.

Support Us

Our work sometimes takes months to research and develop. If you want to help support us please consider:

Thank you for being part of our community!

Last updated