Imaging a laptop to VirtualBox
My old laptop is looking a little worse for wear. Its battery has decided life is not worth living, and it’s stuck with a developer preview of Windows 10 on it, which means it will never see another update. Microsoft offers no migration path for this, I’m supposed to reinstall Windows freshly, but there is software on there for ODB2 purposes which has an utterly bullshit license which states that I cannot reinstall it without purchasing the software again.
Out of spite, my plan is to reverse engineer it and put all the Holden-specific stuff into my own, open source software, but unfortunately energy and time and motivation all conspire against me and that hasn’t happened for some years now.
But I also want the SSD it’s on out of that laptop for the Longhorn cluster. I was going to just buy another one, but because Sam Altman is a fucking shithead, that’s not reasonably going to happen any time soon.
So I decided to dd the disk to an image on my desktop, which is unfortunately Windows again. However this works fine:
dd bs=4096 if="\\.\physicaldrive2" of="d:\laptop.dsk"
It was ridiculously slow. I don’t know if a 4KB blocksize is optimal, maybe it would have gone faster, but I think the issue was my 4TB beyblade that I dropped the 480GB image on to because my NVME drive doesn’t have that much space on it. It may also have been the fact that I was using a USB 3.0 SATA dock, but I feel like it should be faster than this. Anyway, it took about 3 hours at an average of about 50MB/sec.
I was rooting around for a hard drive I could write the image back to, when an idea occurred to me that I could just use VirtualBox and not have to run it on real hardware. After some Googling, I learned that yeah, it’s pretty easy to convert a disk image to a VBox image:
'C:\Program Files\Oracle\VirtualBox\VBoxManage.exe' convertfromraw D:\laptop.dsk d:\laptop.vdi
More waiting, but it eventually finished, and after I gave it sufficient RAM + CPU the VM booted fine, so I’m content. I still cannot reduce the primary partition below 250GB for some reason (I will almost guarantee that as it’s almost exactly half the size of the original partition that there is some magic block there which cannot be moved and thus prevents the shrink), but the resulting VBox image is a dynamic/sparse image anyway so the whole thing only weighs less than 100GB anyway, so maybe I don’t care any more?
