generated from cotes2020/chirpy-starter
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add post 2023-08-13-vms on m2 pro2.md
Having virtual machines on Apple M2 Pro - even better
- Loading branch information
Showing
2 changed files
with
102 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
--- | ||
title: Having virtual machines on Apple M2 Pro - even better | ||
date: 2023-08-13 18:10:00 +/-0000 | ||
categories: [Virtualization, UTM] | ||
tags: [devops] # TAG names should always be lowercase | ||
--- | ||
# VMware Fusion on M2 Pro | ||
VMware Fusion does run well on Apple M2 Pro. Nevertheless, it suffers from a performance issue. Certain write-to-disc operations take very long. It happens quite often, that you, e.g. clone a repository and have to wait for about 30 seconds, after the operation finished, until your prompt returns. This is nothing specific to `git`, but happens to all kind of actions. | ||
It looks, as if there is a problem in writing data to the virtual disc or using the attached cache or whatsoever. | ||
And it happened with different guest OSes. | ||
|
||
I could not find out, what it is. As this is closed source, there is no reasonable way to find the root cause. I updated Fusion to the **Public Tech Preview 2023**, that was released a couple of weeks ago, hoping, that this would fix the issue. It went better, but the issue was still there. | ||
|
||
# An even better alternative | ||
Searching for an alternative, I found **[UTM ](https://mac.getutm.app/)**, a virtualization tool for macOS and iOS, that employs Apple's Hypervisor virtualization framework to run ARM64 operating systems on Apple Silicon at near native speeds. That sounds good and is good! | ||
|
||
# Getting the App from the App Store | ||
It's unbelievable, but the app is free! You can get it from the link above or at the **App Store**. I recommend, to buy it at the App Store for only 10 Eur, which supports further development and ensures, that you'll be noticed about updates of the app, once installed. | ||
|
||
# Retrieving your VM | ||
UTM even provides pre-defined VMs, ready to download and install on your computer. That's fantastic - even an **ARM64 Arch Linux** VM is available. The only thing that needs to be noticed is, that you should use the **download** link to get the VM. There is a second option in the UTM app gallery - a web page that lists available VMs for your platform - for the VM to start: "open in UTM". This lets you start the VM, but it is only available within UTM until the next reboot of your host. | ||
|
||
As we want a permanent VM, that is stored on the SSD, we go for the first option. | ||
|
||
# Configuring the VM | ||
The pre-defined Arch Linux VM has a disc space of **10 GB** and **2 GB** of RAM configured. I need an Arch system, that runs a desktop environment, so these need to be changed. | ||
|
||
So let's alter the preferences of the VM: | ||
## RAM | ||
The RAM setting can be changed directly in the VMs settings in the `System` tab. | ||
|
||
## Display | ||
Same with the display settings. The display settings are missing in the VMs settings, but can easily be added in the `Devices` tab > New ... . | ||
I've chosen `virtio-ramfb-gl (GPU supported)`, that gives me a fast display of the VM in the native **Retina** resolution of the host. Also check, that the display size gets adjusted to the window size and enable the `Retina-Mode`. | ||
|
||
## Virtual disc | ||
The disc has a size of 10 GB, which is too less for a non-server OS. We need to increase it. The instructions to do so are taken from Siytek's blog[^footnote]. Many thanks to Simon Ogden. | ||
|
||
- [ ] Increase virtual disc | ||
+ [x] Resize in the UI | ||
+ [ ] Resize the partition | ||
+ [ ] Resize the file system | ||
|
||
First, you choose the `VirtIO` drive in the VMs settings and resize the drive with the `Resize` button. As this increases the virtual disc, the Linux partition on the virtual disc needs to be increased too. | ||
|
||
- [ ] Increase virtual disc | ||
+ [ ] Resize in the UI | ||
+ [x] Resize the partition | ||
+ [ ] Resize the file system | ||
|
||
To do this, start the VM and, on the CLI, enter: | ||
```shell | ||
fdisk -l | ||
``` | ||
|
||
This lists your discs, attached to your VM and informs you with a `size mismatch error`, that the virtual disc was increased. That's good and what we did. | ||
|
||
The output above also shows us, that the partition `/dev/vda2` still has its old size. So let us change this too. | ||
|
||
We start the disc partitioning tool by entering: | ||
```shell | ||
fdisk /dev/vda | ||
``` | ||
|
||
Hit `p` to print the partitions. Partition `/dev/vda2` is the second in the list, so we can delete it with `d 2`. Never mind: the data of the installed Arch OS gets preserved. | ||
|
||
Next, type `n` at the prompt to create a new partition. We will recreate the primary partition, filling the entire free space. Enter the primary partition number, it's `2` again. | ||
> Important: when prompted to remove the signature, enter `N` to keep the installed Arch OS data. | ||
{: .prompt-danger } | ||
|
||
When you type `p` now, it shows that the partition takes all remaining space of the virtual drive. We are nearly done. | ||
> Don't forget to hit `w` to write your changes to disc. | ||
{: .prompt-tip } | ||
|
||
Exit fdisk and reboot your VM. | ||
|
||
The last necessary step is to resize the file system. | ||
|
||
- [x] Increase virtual disc | ||
+ [x] Resize in the UI | ||
+ [x] Resize the partition | ||
+ [x] Resize the file system | ||
|
||
On the CLI, enter: | ||
```shell | ||
resize2fs /dev/vda2 | ||
``` | ||
|
||
Now, when you check the free disc space, the primary root partition has been expanded into the newly created disk space: | ||
|
||
```shell | ||
df -h | ||
``` | ||
|
||
# Some obstacles, that need to be circumvented | ||
t.b.c. | ||
## Footnotes | ||
[^footnote]: [How To Increase a UTM Virtual Machine Disk Size](https://siytek.com/increase-utm-virtual-machine-disk-size/) |