Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the filesystem corruption on Linux VMs #675

Merged
merged 2 commits into from
Dec 1, 2023

Conversation

amalchuk
Copy link
Contributor

Working on Linux virtual machine for a long-time causes to disk corruption:

bash: /usr/bin/ls: Input/output error

Same issues in another projects:

These changes:

  • Uses NVMe as the default for Linux VMs on macOS 14+
  • On macOS 12+ hosts, the caching mode for virtio drives in Linux VMs is changed to .cached

@CLAassistant
Copy link

CLAassistant commented Nov 30, 2023

CLA assistant check
All committers have signed the CLA.

@edigaryev
Copy link
Collaborator

Hello Andrew 👋 Thanks for spotting the issue and providing a fix!

I've looked at the links you've provided, and it seems that the lima project got this fixed by just forcing the cached mode for the VirtIO disk.

It also looks like the NVMe device is actually slower than the VirtIO device, and glancing at the 172-page spec of NVM Express it should be more complex too (compare this to 16-pages of the VirtIO specification for block devices).

What do you think about skipping the NVMe part for now?

@amalchuk
Copy link
Contributor Author

amalchuk commented Dec 1, 2023

I think it's not just enough.
The primary point of view is that virtio device is shutting down too, even with a disabled cache and full sync set:

What about the decreased performance of NVMe, I think we should choose stability over speed.
For now, Linux VMs are always corrupting on the macOS 14 Sonoma hosts.

edigaryev
edigaryev previously approved these changes Dec 1, 2023
Sources/tart/VM.swift Outdated Show resolved Hide resolved
Sources/tart/VM.swift Outdated Show resolved Hide resolved
@fkorotkov fkorotkov enabled auto-merge (squash) December 1, 2023 15:52
@fkorotkov fkorotkov merged commit 35377a3 into cirruslabs:main Dec 1, 2023
4 checks passed
@wpiekutowski
Copy link

From my testing, and other users of UTM, .cached + virtio are stable and no corruption happens. No need to slow things down by additionally enabling NVMe. NVMe is mostly useful if you don't want to use .cached.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants