Successfully migrated a x86_64 Linux OS from a PC to a virtual machine which can be ran on ARM64 M1 MacBook Pro

I did it.

Words in short.

I turned the x86_64 Linux OS of my laptop into a file and it can be run as a virtual machine on the ARM64 M1 Macbook Pro.

In plain words: I turned my laptop into a file which can be run on any computer!

----

With some help of my research and many tries, it works.

Here are some articles I wrote:

Planing on converting physical disk to a VMware image, then convert to qemu(kvm) image for booting on M1 mac

And

 

----

I did these work and I get a file called "universe.qcow2" converted from "universe.vmdk" which was derived from VMware ESXi.

This file can be run as a virtual machine in qemu.

 

I downloaded a Qemu manager which runs on M1 Macbook Pro, it is called "UTM". It comes with ARM64 qemu binaries which is neat for my project.

1. create a virtual machine , say simple x86_64 linux virtual machine (use mouse click)

2. create a virtual disk. For example it will be saved as "linux.qcow2" (use mouse click)

3. replace the "linux.qcow2" file with a simple readable link pointed to the "universe.qcow2" which was located in my 8T drive.

(commands in terminal)

# for UTM's version higher than 2.0.20
# the virtual machine's name is called "Virtual Machine" in my case
cd ~/Library/Containers/com.utmapp.UTM/Data/Documents/Virtual Machine.utm/Images

# remove the unused images
rm linux.qcow2

# create a readable link pointed the file (lie to the MacOS), save more space for Mac
ln -sf /Volume/disk8t/vmware_exported/universe/universe.qcow2 linux.qcow2

# then, start the Virtual Machine in UTM and it should work!

 

If the graphics is too laggy. Try virtio-vga in the UTM settings, it's less laggy.

My qemu arguments

qemu-system-x86_64 -L /Applications/UTM.app/Contents/Resources/qemu -S -qmp tcp:127.0.0.1:4444,server,nowait -vga none -spice port=5930,addr=127.0.0.1,disable-ticketing,image-compression=off,playback-compression=off,streaming-video=off -device virtio-vga -smp cpus=1,sockets=1,cores=1,threads=1 -machine q35, -accel tcg,tb-size=128 -global PIIX4_PM.disable_s3=1 -global ICH9-LPC.disable_s3=1 -boot order=d -m 512 -device AC97 -name "Virtual Machine" -device usb-ehci -device usb-tablet -device usb-mouse -device usb-kbd -drive "if=ide,media=disk,id=drive0,file=/Users/alex/Library/Containers/com.utmapp.UTM/Data/Documents/Virtual Machine.utm/Images/linux.qcow2,cache=writethrough" -device e1000,netdev=net0 -netdev user,id=net0 -device virtio-serial -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 -chardev spicevmc,id=vdagent,debug=0,name=vdagent -uuid 20629A90-85C7-4762-A159-B06592159F24 -rtc base=localtime

 

 

My settings

OS: Linux

Architecture: x86_64

Destro: Ubuntu 18.04

Display Manager: SDDM

Desktop Environment: XFCE4 and KDE

Boot Partition: /boot on /dev/sda1

Swap Partition: on /dev/sda2

System Partition: / on /dev/sda3

Disk Space: 256GB

 

posted @ 2021-03-08 22:46  spaceship9  阅读(3)  评论(0编辑  收藏  举报