I’ve recently decommissioned a (not so old) laptop to make room. The laptop’s old hard drive (actually a NVMe) was removed and put into an external enclosure, so I didn’t have to deal with moving all data from it, wiping the drive, and realizing I left something in an obscure hidden folder that is now unrecoverable. Why wipe drives these days? Storage is cheaper than ever.
One day I realized I did have data in that drive that I need to retrieve, and I needed to boot the OS installed on that drive. I didn’t want to open up a computer to put the drive in - can I run it off a virtual machine from the external drive? Yes I could!
You can do this with a trial of VMware Workstation. Once you have created the VM you can use the free VMware player to launch it.
This guide assumes some familiarity with Linux and Virtual Machines.
Setting up the physical disk
Throw the disk into an external enclosure and plug it in. Find it through
➜ ~ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 931.5G 0 disk ├─sda1 8:1 0 300M 0 part ├─sda2 8:2 0 922.4G 0 part └─sda3 8:3 0 8.8G 0 part nvme0n1 259:0 0 477G 0 disk ├─nvme0n1p1 259:1 0 999M 0 part /boot/efi ├─nvme0n1p2 259:2 0 128M 0 part ├─nvme0n1p3 259:3 0 xxx.xG 0 part ├─nvme0n1p4 259:4 0 xx.xG 0 part ├─nvme0n1p5 259:5 0 xxx.xG 0 part │ └─luks-xxxxxxxx-aaaa-bbbb-cccc-xxxxxxxxxxxx 253:0 0 xxx.xG 0 crypt / └─nvme0n1p6 259:6 0 x.xG 0 part
Locate it by looking at the sizes - do not mount the drive. Mine is in
/dev/sda and the EFI boot partition is in
/dev/sda1, my data partition is in
/dev/sda2, and the swap space is in
/dev/sda3. If you have a Windows install it could be different, but it doesn’t matter.
- Start VMware as
sudo vmware. Or, you can add yourself to the
diskgroup - I do not recommend that as this means anything running as you would have raw access to disks and can potentially trash all your data.
- Go to VMware and set up a virtual machine. Choose “Custom”, and in advanced options for the disk, choose Use Physical Disk. Put the appropriate device path in there (
/dev/sda). You can choose to use the whole disk, but if using by partition, make sure to select the EFI boot partition. (If you’re on Windows it’s on
\\PHYSICALDRIVE0or something like that; check
- Configure the rest of the VM as normal.
It’s falling into PXE Boot!
This means that your drive had EFI boot. VMware VMs seem to be set up with BIOS by default. Go to
VM > Settings > Options > Advanced and set
Firmware Type to
Still not working? Try using SuperGrub2 or another bootable ISO to kick start it.
Never ever suspend the VM when using a physical disk. This will cause all sorts of corruptions. And use common sense, never remove the “portable” drive when you’re using the VM.
Running the VM in the future
You can use VMware player for free and still launch the VM (assuming the physical drive is still in the right path):
sudo vmplayer will do instead of
sudo vmware. If you use VMs often it may also be worth buying VMware workstation.