brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: qemu-img convert turns an old physical disk into an Unraid vdisk

Unraid
~/tips/tip-unraid-qemu-img-convert-disk

qemu-img convert -p -O raw /dev/sdX /mnt/user/domains/oldpc/vdisk1.img

Move an old physical Linux or Windows install into a VM on Unraid.

An old PC with a Linux or Windows install you still need now and then doesn’t have to keep a spot on the shelf. Unraid’s docs show how to turn its disk into a virtual disk image with one command.

Connect the old disk to the server over SATA or USB, start the array and find it under Unassigned Devices on the Main tab. Note the device letter and the size, because you need at least that much free space on the array or a pool. Then, in a terminal as root:

qemu-img convert -p -O raw /dev/sdX /mnt/user/domains/oldpc/vdisk1.img

-p shows the progress as a percentage and -O raw writes the raw format that Unraid uses by default. /dev/sdX is the source disk and the last path is the new image; here I used the default domains share and a made-up VM name. The resulting .img becomes the primary disk of a new VM, for which the docs recommend OVMF as the BIOS and a pool over the array for performance.

Windows needs one more step. It doesn’t have VirtIO drivers yet, so the docs have you edit the VM’s XML, change the disk’s bus from virtio to ide and remove its <address> line. Boot, install the drivers and the guest agent from the VirtIO ISO, shut down and switch the bus back to virtio.

The caveat is the device letter. Check it twice in Unassigned Devices and back up anything important first, as the docs ask, because sdb and sdc look very much alike at the end of a long day.

Further reading: Unraid docs: VM conversion and migration

More Unraid tips Change the RAID profile of a Unraid BTRFS pool with Balance Replace a disk in a redundant Unraid pool from the Main tab Test every Unraid drive with the DiskSpeed container See the XML behind a VM with the inline XML view in Unraid 7 Choose where a new VM's disk image is created with Unraid's storage override All Unraid tips (77) All topics

Link