Use cached mode for block storage device on Linux guest #332
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As described in the following UTM issue, Linux guest sometimes crashes randomly with I/O error.
In my own experience, this is quite hard to reproduce deliberately, but often happens when I am doing heavy I/O operations with large amounts of small files, such as OS install, installing development tools from package manager, compiling native programs (which creates a lot of intermediary
.o
files), etc. File system doesn't matter, I've seen this crash onext4
andxfs
. Interestingly, I could not reproduce this usingstress-ng
iomix
, even when using btrfs with data checksum enabled and flushed the file system several times. These crashes happen on macOS Sonoma all versions (from the early 14.0 up until 14.4.1) and on pretty much all Linux kernel versions across various distros thatVirtualization.framework
can run. I haven't used VirtualBuddy to run Linux on Ventura, so can't comment on that.This crash will happen on any disk attached to the VM, whether it is the boot drive or not. Also interestingly, I am yet to reproduce such crashes when the disk image resides on a
tmpfs
file system. But on any APFS file system, internal drive or external drive (Samsung T1 USB 3 = no TRIM on macOS), this kind of I/O crash is always bound to happen.After using a private build with this change for almost 2 weeks, I am yet to experience any I/O errors, and my files are intact. This is an example of one instance where I managed to run the Linux VM with over 1 day uptime in total and with heavy I/O usage (and the laptop was repeatedly put to sleep as I carry this MacBook Pro everywhere I go = I am a public transport user!):