Windows on DigitalOcean droplets - Part 1
A while back I signed up to DigitalOcean and setup a droplet (DO speak for VPS) and was happy to have a service that will allow me to deploy Linux test machines in a matter of seconds. I’m not entirely sure why, but I needed a Windows machine to test something and was frustrated that DO do not supply Windows images. That’s how he quest for Windows on DO begun.
The first thing I had to do is to determine how the droplet boots. From poking around on the system and listing the PCI devices, I CPU info and more it was clear that the system uses KVM as the hypervisor. The next thing that had to be checked was whether the hard drive had a bootsector and if the system used UEFI or a legacy MBR. Running hexdump -Cn512 /dev/vda
reveals that there is a GRUB bootloader installed and ls -lsah /sys/firmware/
shows that no efi
directory exists, which suggest the system indeed uses BIOS (leagcy mode) to boot.
After I knew the systems bootstrapping method, I decided to try the simplest and naive approach of directly overwriting the disk. Since this was just a boot test experiment there was no need to write a full Windows image to the disk and I settled with MSDOS 7.0 image. The small size of the image meant that the write time was fast and any corruption to the current running Linux system was minimal as the overwritten area was mostly spare space ^[The spare space is caused by the first partition starting at an offset 2048 sectors on the disk, hence 2048*512=1MB “free space”]. The first test was a complete success, in fact, it was so successful that I ended up wasting my time playing DOOM on the droplet’s web console.
The next experiment was to get something more useful on the droplet. I decided early on that everything must work on a 5$/mo droplet which only has 1vCPU, 512mb RAM and 20GB disk, so this was a bit of a challenge. After some more test of overwriting the disk with an image files, I decided that the overwriting approach will not work anymore. By now, I was writing tens of images to the disk and corrupting multiple droplets. The process was unreliable and either caused the running OS to crash, or had written corrupt data to the disk (duh!). I had to come up with some other plan. The images I attempted to write in full were Windows 95/98/XP images, WinPE images and other variants with partial success.
In the next part, I’ll discuss my new approach to tackle the corruption problem with the disks and hopefully will have a POC Windows environment.