Closed thermogl closed 1 week ago
Hello @thermogl,
You can try our Packer plugin which can remove partitions directly and can resize disks. I think something like that will the following resize.pkr.hcl
work:
packer {
required_plugins {
tart = {
version = ">= 1.12.0"
source = "github.com/cirruslabs/tart"
}
}
}
source "tart-cli" "tart" {
vm_base_name = "my-vm"
vm_name = "my-new-vm"
cpu_count = 4
memory_gb = 8
disk_size_gb = 50
ssh_password = "admin"
ssh_username = "admin"
ssh_timeout = "120s"
}
build {
sources = ["source.tart-cli.tart"]
}
Please replace my-vm
and my-new-vm
and then run:
brew install hashicorp/tap/packer
packer init resize.pkr.hcl
packer build resize.pkr.hcl
Thank you!
Have tried this and it sort of works, in that it deletes the recovery partition, but disk0s2 hasn't been expanded to the new size. I can then run diskutil apfs resizeContainer disk0s2 0
inside the VM and it seems to succeed (Growing APFS Physical Store disk0s2 from 74,107,002,088 to 149,475,672,064 bytes
), but when I re-run diskutil list
I can see that it hasn't actually resized.
Any ideas how to fix that?
Ah, had to run repairDisk first. Thanks for all the help!
Hello.
I'm trying to increase the disk size of a Mac OS VM using the steps outlined in https://github.com/cirruslabs/tart/issues/17#issuecomment-1439367869 however I cannot resize disk0s2 I believe because disk0s3 is a recovery partition.
I get the following error when running
diskutil apfs resizeContainer disk0s2 0
: "Error -69519: The target disk is too small for this operation, or a gap is required in your partition map..."I cannot boot the VM into recovery mode to run
crsutil disable
so I also cannot delete disk0s3.I figure the only option left is to create a new VM with a larger disk and copy my existing files over. What's the best way to do this?
Alternatively, do I have any other options apart from recreating the VM from scratch? Can I create a new disk, say disk0s4 and move the files to it then use that instead of disk0s2?