-
-
Notifications
You must be signed in to change notification settings - Fork 176
feat: Disk resize #593
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
base: main
Are you sure you want to change the base?
feat: Disk resize #593
Conversation
074ccc3 to
4a0c580
Compare
|
Thanks, @gabefair for the review comments! Current status: Tested this with Tahoe VM, currently works with non-FileVault enabled disks, working on a way to make it work with FileVault enabled disks as well |
|
Any update about this? I've love to be able to resize the disk size of a macOS VM |
VirtualCore/Source/Models/Configuration/VBManagedDiskImage+Resize.swift
Outdated
Show resolved
Hide resolved
VirtualCore/Source/Models/Configuration/ConfigurationModels.swift
Outdated
Show resolved
Hide resolved
|
@giladgd Thanks for pinging me, I'll try to find some time to check on this tomorrow |
VirtualBuddy/Config/Signing.xcconfig
Outdated
| @@ -1,5 +1,5 @@ | |||
| CODE_SIGN_IDENTITY = Apple Development | |||
| VB_BUNDLE_ID_PREFIX = | |||
| VB_BUNDLE_ID_PREFIX = com.yourname. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an unnecessary change.
| VB_BUNDLE_ID_PREFIX = com.yourname. | |
| VB_BUNDLE_ID_PREFIX = |
| "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer"; | ||
| CODE_SIGN_IDENTITY = "Apple Development"; | ||
| CODE_SIGN_STYLE = Automatic; | ||
| COMBINE_HIDPI_IMAGES = YES; | ||
| DEVELOPMENT_ASSET_PATHS = "\"VirtualBuddy/Preview Content\""; | ||
| DEVELOPMENT_TEAM = 8C7439RJLG; | ||
| "DEVELOPMENT_TEAM[sdk=macosx*]" = 8C7439RJLG; | ||
| DEVELOPMENT_TEAM = ""; | ||
| ENABLE_HARDENED_RUNTIME = YES; | ||
| ENABLE_PREVIEWS = YES; | ||
| GENERATE_INFOPLIST_FILE = YES; | ||
| INFOPLIST_FILE = VirtualBuddy/Info.plist; | ||
| INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.developer-tools"; | ||
| INFOPLIST_KEY_NSHumanReadableCopyright = "© 2023 Buddy Software LTD"; | ||
| INFOPLIST_KEY_NSMicrophoneUsageDescription = "Enable audio input for your virtual machines. Without this permission, virtual machines won't be able to record any audio."; | ||
| LD_RUNPATH_SEARCH_PATHS = "$(VB_APP_RUNPATH_SEARCH_PATHS)"; | ||
| OTHER_LDFLAGS = ""; | ||
| PRODUCT_BUNDLE_IDENTIFIER = "$(VB_BUNDLE_ID_PREFIX)codes.rambo.VirtualBuddy"; | ||
| PROVISIONING_PROFILE_SPECIFIER = ""; | ||
| SWIFT_EMIT_LOC_STRINGS = YES; | ||
| SWIFT_OPTIMIZATION_LEVEL = "-Onone"; | ||
| SWIFT_VERSION = 5.0; | ||
| }; | ||
| name = Beta_Debug; | ||
| }; | ||
| F40A1E892C1869680033E47D /* Beta_Debug */ = { | ||
| isa = XCBuildConfiguration; | ||
| buildSettings = { | ||
| ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||
| ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; | ||
| CLANG_ENABLE_MODULES = YES; | ||
| CODE_SIGN_ENTITLEMENTS = VirtualBuddyGuest/VirtualBuddyGuest.entitlements; | ||
| "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; | ||
| CODE_SIGN_STYLE = Automatic; | ||
| COMBINE_HIDPI_IMAGES = YES; | ||
| DEVELOPMENT_ASSET_PATHS = "\"VirtualBuddyGuest/Preview Content\""; | ||
| DEVELOPMENT_TEAM = 8C7439RJLG; | ||
| DEVELOPMENT_TEAM = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of these changes need to be reverted.
| "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; | ||
| CODE_SIGN_STYLE = Automatic; | ||
| COMBINE_HIDPI_IMAGES = YES; | ||
| DEVELOPMENT_TEAM = 8C7439RJLG; | ||
| DEVELOPMENT_TEAM = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These too 😄
| "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer"; | ||
| CODE_SIGN_IDENTITY = "Apple Development"; | ||
| CODE_SIGN_STYLE = Automatic; | ||
| COMBINE_HIDPI_IMAGES = YES; | ||
| DEVELOPMENT_ASSET_PATHS = "\"VirtualBuddy/Preview Content\""; | ||
| DEVELOPMENT_TEAM = 8C7439RJLG; | ||
| "DEVELOPMENT_TEAM[sdk=macosx*]" = 8C7439RJLG; | ||
| DEVELOPMENT_TEAM = ""; | ||
| ENABLE_HARDENED_RUNTIME = YES; | ||
| ENABLE_PREVIEWS = YES; | ||
| GENERATE_INFOPLIST_FILE = YES; | ||
| INFOPLIST_FILE = VirtualBuddy/Info.plist; | ||
| INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.developer-tools"; | ||
| INFOPLIST_KEY_NSHumanReadableCopyright = "© 2023 Buddy Software LTD"; | ||
| INFOPLIST_KEY_NSMicrophoneUsageDescription = "Enable audio input for your virtual machines. Without this permission, virtual machines won't be able to record any audio."; | ||
| LD_RUNPATH_SEARCH_PATHS = "$(VB_APP_RUNPATH_SEARCH_PATHS)"; | ||
| OTHER_LDFLAGS = ""; | ||
| PRODUCT_BUNDLE_IDENTIFIER = "$(VB_BUNDLE_ID_PREFIX)codes.rambo.VirtualBuddy"; | ||
| PROVISIONING_PROFILE_SPECIFIER = ""; | ||
| SWIFT_EMIT_LOC_STRINGS = YES; | ||
| SWIFT_VERSION = 5.0; | ||
| }; | ||
| name = Beta_Release; | ||
| }; | ||
| F40A1E922C18697B0033E47D /* Beta_Release */ = { | ||
| isa = XCBuildConfiguration; | ||
| buildSettings = { | ||
| ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||
| ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; | ||
| CLANG_ENABLE_MODULES = YES; | ||
| CODE_SIGN_ENTITLEMENTS = VirtualBuddyGuest/VirtualBuddyGuest.entitlements; | ||
| "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; | ||
| CODE_SIGN_STYLE = Automatic; | ||
| COMBINE_HIDPI_IMAGES = YES; | ||
| DEVELOPMENT_ASSET_PATHS = "\"VirtualBuddyGuest/Preview Content\""; | ||
| DEVELOPMENT_TEAM = 8C7439RJLG; | ||
| DEVELOPMENT_TEAM = ""; | ||
| ENABLE_HARDENED_RUNTIME = YES; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And these 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You get the picture — all of the build config changes you've made need to be reverted before this could be merged.
Adding the files to the project is fine (although perhaps we should consider converting these to proper folders in a future PR).
b38f02f to
ae14dd2
Compare
|
@giladgd, so sorry, but I barely had time to check this, and unfortunately, I run out of space on my machine to host VMs. I'm looking into some cheap solutions right now, thank you for your patience with me again! |
- Add comprehensive disk image resizing support for RAW, DMG, and sparse image formats - Implement two resize strategies: in-place expansion and create-larger-image - Add robust error handling with detailed error messages - Include disk space validation and backup mechanisms - Support for both hdiutil and raw file operations
- Add canBeResized property for format compatibility checking - Add resize method with validation and error handling - Add displayName properties for better UI representation - Add resizeDisk method to VBStorageDevice for high-level operations
- Enable size editing for resizable existing disk images - Add resize confirmation dialog with detailed information - Show loading indicator during resize operations - Add informational messages for resizable disk formats - Handle resize errors with proper user feedback
- Add resize icon indicator for resizable disk images - Add context menu with resize option for storage devices - Fix canBeResized method to properly check disk image existence - Add remove device option to context menu for non-boot devices
- Add displayName property directly to VBManagedDiskImage.Format - Add canBeResized property directly to VBManagedDiskImage and VBStorageDevice - Fix method calls in ManagedDiskImageEditor to use proper disk image URL resolution - Simplify resize indicator checks in StorageConfigurationView
- Fix canBeResized to use pattern matching on backing property - Resolve 'managedImage' not in scope compilation error
- Remove direct VBDiskResizer call from UI to fix compilation - Add VBVirtualMachine+DiskResize extension for resize operations - Hook resize check into VMController.start() method - Show informational dialog when resize is scheduled - Handle resize operations automatically when VM starts
- Move checkAndResizeDiskImages to VBVirtualMachine+Metadata.swift - Remove separate VBVirtualMachine+DiskResize.swift file - Ensures methods are compiled with VirtualCore target - Resolves 'no member' compilation error
- Remove unnecessary guard let for non-optional configuration - Comment out VBDiskResizer call to avoid scope issues - Add TODO for actual resize implementation - Log resize requirement for future implementation
- Re-enable VBDiskResizer.resizeDiskImage call in VBVirtualMachine+Metadata.swift - Fix Timer-based slider confirmation to prevent popup spam - Add 0.5s delay before showing resize confirmation dialog - Complete disk resize feature implementation with actual system tools
- Fix temporary file creation in createRawImage function - Prevent FileHandle error for non-existent temporary files - Consolidate RAW image resize logic in createLargerImage - Properly handle file creation before ftruncate operations - Remove redundant createRawImage helper function call
…ators - Add expandPartitionsInDiskImage functionality to VBDiskResizer - Implement hdiutil attach/detach with diskutil resizeVolume for partition expansion - Add support for RAW, DMG, and Sparse image partition expansion - Add resizingDisk state to VMState enum with UI progress overlay - Update VirtualMachineSessionView to show resize progress indicator - Improve ManagedDiskImageEditor confirmation message - Add comprehensive logging for resize and partition operations 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Add resizingDisk case to VirtualMachineControls.swift button state logic - Add resizingDisk case to VirtualMachineSessionView.swift state display logic - Ensure all VMState switch statements are exhaustive after adding new state - Both UI components now properly handle the disk resize progress state 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Skip Apple_APFS_ISC containers when finding resize target - Prioritize main Apple_APFS containers for partition expansion - Fixes issue where resize targeted small ISC container instead of main data container 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Detect when recovery partitions prevent main container expansion - Add specialized resize strategy for layouts with recovery partitions - Try multiple diskutil methods to handle partition repositioning - Fixes resize failure when recovery partition blocks container growth 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Acknowledge that recovery partitions may block immediate expansion - Provide clear logging about expected behavior for fresh macOS VMs - Focus on successful disk image resize rather than forced partition expansion - Recovery partitions in VM environments have complex layouts that may limit expansion 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Attempt to delete recovery partition to allow main container expansion - Recovery partition will be recreated by macOS when needed - Fallback to boundary-aware resize if deletion fails - Better handling for established macOS installations 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Add findRecoveryContainer to extract container reference from diskutil output - Use correct container identifier (e.g., disk6) instead of partition (disk4s3) - Add -force flag to deletion command for recovery containers - Better logging of container detection process 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Detect when recovery partition is protected by System Integrity Protection - Provide clear user guidance for manual partition adjustment - Acknowledge successful disk image resize even with partition limitations - Suggest Recovery Mode approach for full space utilization 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
ae14dd2 to
0375c21
Compare
Co-authored-by: Tony Arnold <[email protected]>
Co-authored-by: Tony Arnold <[email protected]>
|
Thanks @tonyarnold for catching the accidentally modified project files and @giladgd for the patience 🙇
|
| } | ||
|
|
||
| struct StorageDeviceListItem: View { | ||
| @EnvironmentObject var viewModel: VMConfigurationViewModel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| @EnvironmentObject var viewModel: VMConfigurationViewModel |
I don't think this is used anywhere in this View?
|
Can you provide screenshots or a video of it working?
…On Sun, Dec 7, 2025, 17:24 Tony Arnold ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In VirtualUI/Source/VM
Configuration/Sections/Storage/StorageConfigurationView.swift
<#593 (comment)>
:
> @@ -94,6 +109,7 @@ struct StorageConfigurationView: View {
}
struct StorageDeviceListItem: View {
+ @EnvironmentObject var viewModel: VMConfigurationViewModel
⬇️ Suggested change
- @EnvironmentObject var viewModel: VMConfigurationViewModel
I don't think this is used anywhere in this View?
—
Reply to this email directly, view it on GitHub
<#593 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAP75EK6KO7MRFT2U6PJIN34ASSKHAVCNFSM6AAAAACEXVFR42VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTKNBZGY2TIMRTHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
Sure, here you go: virtualbuddy_resize_disk.mp4 |

This is still in progress, unpolished, vibecoded mess