Wednesday, May 29, 2019

Virtualizing my Original Homelab

Remember that high school home lab that I had set up many years ago? Well, most if it is coming down. After graduation I'm moving to my own place and for some odd and inexplicable reason my parents don't want those horribly outdated computers in their basement. Well, I certainly don't have room for them in the place I'm moving. So why don't we take what we can and virtualize it? That way we can still have the computers without the bulk.

We're going to look at virtualizing three of the machines on the rack. I really need to virtualize four, but at the time of writing I don't have the disk space to do that. Don't worry, I will soon enough. Right now, I want to focus on a Ubuntu 12.04 LTS machine, a Windows XP machine, and a Damn Small Linux machine. These three are not very powerful machines. One of them runs on an Intel Celeron processor roughly equivalent to a Pentium III. All together they have about 2GB of RAM. It's safe to say that I can have all of these running simultaneously on my main server. Without impacting much of anything, really.

There are several ways you can go about doing this. I have VirtualBox installed on the host server, but that was there back before I knew anything about KVM and Virt-Manager. From the first day I used it, I knew that was the VM platform for me. Sadly, there is no Virt-Manager implementation for Windows, but with X Windows, anything is possible. I'll be doing this from an Ubuntu install, but this process is client agnostic over SSH.

The first thing I did was to clone the drives of the physical drives. I did this in one of two ways. The first time is to copy them the regular way: unplug the hard drive and copy it over that way. This was all well and good for SATA based hard drives because I had an adapter. But I did not have an adapter for IDE drives.

So, in a fit of rapid problem solving, I booted these machines to a Live CD of Linux and literally netcat'd the contents of /dev/sda over to the VM Host. I'm proud of the problem solving, not the solution. This generally took forever, but yielded a perfect copy every time.

So, now that we have the disks imaged, what's next? Well, at this point, we have massive drive images that are mostly blank. Wouldn't it be great if we could turn these into sparse QCOW2 disks? Luckily, that's what virt-sparsify is supposed to do. On my older VM host (using a i7-3770K), using the compression option makes it take much, much longer. But it pays off. My Windows XP computer had a 75GB raw disk image, but only 28GB compressed and sparsified. I understand that compressing these images will make them run slower, but given these are low use machines, I'm willing to take that tradeoff.

Finally, we get to turn these on. So far, I've only run into two problems with my machines. Across the ones that ran with IDE drives, I had to specifically tell libvirt to emulate them as IDE drives, otherwise they wouldn't boot. I'm not exactly sure why that is, but it is an important step. Also, my Windows XP VM became deactivated, but that was easy to redo. I haven't done it yet, but it's doable.


All in all, I'm now able to repurpose or get rid of these older computers. Which is nice, because they're power hungry and they take up space and, as I said before, I do not want to move them with me.

No comments:

Post a Comment