Skip to content

Instantly share code, notes, and snippets.

@bp2008
Last active December 22, 2023 09:05
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bp2008/b703edfdecdf78fa89dd2e41db10470f to your computer and use it in GitHub Desktop.
Save bp2008/b703edfdecdf78fa89dd2e41db10470f to your computer and use it in GitHub Desktop.
unRAID tips

Network

I prefer to bond multiple network interfaces for redundancy, however viewing and configuring the bond interface can be a bit tricky.

Bonding mode: active-backup

Multiple network links can be bonded using "active-backup" mode so that if one NIC goes down, another will take its place. This mode does not require a managed switch, however it has trouble prioritizing one interface over another. For example if you have a 1 Gbps NIC and a 10 Gbps NIC, unRAID is not smart enough to prefer the 10 Gbps NIC.

Viewing Network Interface Status

View overall bond status: cat /proc/net/bonding/bond0 Get the active NIC:

cat /sys/class/net/bond0/bonding/active_slave

Set the active NIC: (replace eth0 with the desired interface name)

echo eth0 > /sys/class/net/bond0/bonding/active_slave

Setting a Primary Interface

At the time of this writing, unRAID's GUI does not provide the ability to set the primary interface, however it is possible to do via the command line. The primary interface will be preferred as long as it is online, according to https://wiki.linuxfoundation.org/networking/bonding#Switch_Configuration

Bonding configuration can be found in /sys/class/net/bond0/bonding

One of the "files" here is called primary. To set the primary, use: (replace eth0 with the desired interface name)

echo eth0 > /sys/class/net/bond0/bonding/primary

After setting the primary interface, you can check the active NIC to verify that it worked.

This setting is lost when the server reboots.

To make this setting "stick" between server reboots, install the "User Scripts" plugin and create a script that runs the command at array startup.

CPU Pinning

To run a VM without core pinning, you must edit the VM in XML VIEW and follow these steps:

  1. Set the desired number of cores in the vcpu element: <vcpu placement='static'>6</vcpu>.
  2. Delete the cputune element.
  3. Ensure that the CPU topology is compatible with the chosen number of cores. E.g.
  <cpu mode='host-passthrough' check='none'>
    <topology sockets='1' cores='3' threads='2'/>
    …
  </cpu>

Tip: If you edit the VM using the GUI, your core count will get reduced to 1 and you'll need to edit the XML again.
Tip: If you try <vcpu placement='auto' and the VM won't start because of something NUMAD, change placement back to static and delete the numatune element.

Miscellaneous

Trial Expiration

When the unRAID trial expires, unRAID remains fully functional until the next time you want to start the pool (at which point you must license it).

Disk Debugging

List Disks

https://wiki.unraid.net/Console_commands_for_hard_drives

ls -l /dev/disk/by-id

List PCI Devices (SATA Controllers, etc)

lspci

Migrating Virtual Machines from VMware ESXi

These instructions are for converting a single-disk ESXi VM to an unraid VM.

  1. Create an NFS share in unraid (e.g. /mnt/user/esxishare/), and mount it in ESXi. The command showmount -e 127.0.0.1 may help (in unraid terminal) to give you the full absolute path of the share.
  2. Shut down a VM in ESXi.
  3. Delete all the VM's snapshots (optional. I didn't test with a VM that has snapshots).
  4. Using ESXi's file manager GUI, move the VM's folder to the NFS share on the unraid server.
  5. In unraid terminal, make a directory for your VM image to be kept permanently.
mkdir /mnt/user/vm/virtualmachines/VirtualMachineName
  1. In unraid terminal, convert the vmdk disk image (-f vmdk) to raw (-O raw) thin provisioned (-o preallocation=off) and put it in your new directory:
qemu-img convert -p -f vmdk -O raw -o preallocation=off /mnt/user/esxishare/VirtualMachineName/VirtualMachineName.vmdk /mnt/user/vm/virtualmachines/VirtualMachineName/VirtualMachineName.img
  1. In unraid GUI, create a new VM (with the same name you used when creating the directory above), and add the .img file from above as an existing disk. To make the VM bootable, it may be necessary to use SeaBIOS instead of OVMF BIOS, and/or change the Machine type.

Resizing raw disks

The following example command adds 100 gigabytes (+100G) to the available size of a raw (-f raw) disk image:

qemu-img resize -f raw /mnt/user/vm/virtualmachines/VirtualMachineName/DiskName.img +100G

You can check the current virtual size via:

qemu-img info /mnt/user/vm/virtualmachines/VirtualMachineName/DiskName.img

It is also possible to do a resize operation with an additional size of 0. You might want to do this if you forgot to specify the format, like in the following:

> qemu-img resize /mnt/user/vm/virtualmachines/VirtualMachineName/DiskName.img +100G
WARNING: Image format was not specified for '/mnt/user/vm/virtualmachines/VirtualMachineName/DiskName.img' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
Image resized.
> qemu-img resize -f raw /mnt/user/vm/virtualmachines/VirtualMachineName/DiskName.img +0G
Image resized.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment