{"record":{"id":"b566b8f03b1a60ed","repo":"lima-vm/lima","slug":"disk-shrinking-is-not-supported","errorCode":null,"errorMessage":"disk shrinking is not supported","messagePattern":"disk shrinking is not supported","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/instance/start.go","lineNumber":554,"sourceCode":"\t\treturn err\n\t}\n\n\tdiskSize := img.Size()\n\n\tif img.Type() == vhdx.Type {\n\t\tlogrus.Warn(\"Skip resizing the instance because go-qcow2reader cannot read vhdx type image\")\n\t\treturn nil\n\t}\n\n\tif inst.Disk == diskSize {\n\t\treturn nil\n\t}\n\n\tlogrus.Infof(\"Resize instance %s's disk from %s to %s\", inst.Name, units.BytesSize(float64(diskSize)), units.BytesSize(float64(inst.Disk)))\n\n\tif inst.Disk < diskSize {\n\t\tinst.Disk = diskSize\n\t\treturn errors.New(\"disk shrinking is not supported\")\n\t}\n\n\tdiskUtil := proxyimgutil.NewDiskUtil(ctx)\n\n\treturn diskUtil.ResizeDisk(ctx, disk, inst.Disk)\n}\n","sourceCodeStart":536,"sourceCodeEnd":561,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/instance/start.go#L536-L561","documentation":"prepareDisk resizes the instance disk to the newly requested size but refuses to shrink: reducing disk size is not supported by the underlying disk utilities and risks data loss. Note the code first sets inst.Disk back to the current size (preventing the shrink from being persisted) and then returns this error.","triggerScenarios":"Calling `limactl start` (or the Prepare path) on an instance whose lima.yaml `disk` value is now SMALLER than the previously applied disk size stored in the instance state.","commonSituations":"Editing lima.yaml to lower the disk value and re-running start, copying a config from a smaller instance, or reverting a config file to an older version.","solutions":["Restore the disk value in lima.yaml to a size >= the current disk (`limactl list` shows current disk)","If a smaller disk is truly needed, create a new instance and copy data over","Manually shrink the filesystem/disk outside lima if you accept the risk (not supported)"],"exampleFix":"# before (in lima.yaml)\ndisk: 50GiB   # was 100GiB -> error\n# after\ndisk: 100GiB  # keep >= current size, or grow\n","handlingStrategy":"validation","validationCode":"cur := getCurrentDiskSize(instName) // from `limactl list --json` .disk\nif requestedDisk < cur {\n    return fmt.Errorf(\"cannot shrink disk from %d to %d; keep disk >= current\", cur, requestedDisk)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never lower the `disk` field in lima.yaml of an existing instance","Compare requested disk against `limactl list` before applying config changes","Keep config files under version control to spot accidental reverts","To shrink, create a fresh instance and migrate data"],"tags":["disk","resize","validation"],"backgroundTag":"disk-shrink-not-supported","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}