{"record":{"id":"56c4e958f5b009f3","repo":"lima-vm/lima","slug":"failed-to-convert-extra-disk-q-to-raw-w","errorCode":null,"errorMessage":"failed to convert extra disk %#q to raw: %w","messagePattern":"failed to convert extra disk %#q to raw: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/driver/krunkit/krunkit_darwin_arm64.go","lineNumber":77,"sourceCode":"\t// Add additional disks\n\tif len(inst.Config.AdditionalDisks) > 0 {\n\t\tctx := context.Background()\n\t\tdiskUtil := proxyimgutil.NewDiskUtil(ctx)\n\t\tfor _, d := range inst.Config.AdditionalDisks {\n\t\t\tdisk, derr := store.InspectDisk(d.Name, d.FSType)\n\t\t\tif derr != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to load disk %#q: %w\", d.Name, derr)\n\t\t\t}\n\t\t\tif disk.Instance != \"\" {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to run attach disk %#q, in use by instance %#q\", disk.Name, disk.Instance)\n\t\t\t}\n\t\t\tif lerr := disk.Lock(inst.Dir); lerr != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to lock disk %#q: %w\", d.Name, lerr)\n\t\t\t}\n\t\t\textraDiskPath := filepath.Join(disk.Dir, filenames.DataDisk)\n\t\t\tlogrus.Infof(\"Mounting disk %#q on %#q\", disk.Name, disk.MountPoint)\n\t\t\tif cerr := diskUtil.Convert(ctx, raw.Type, extraDiskPath, extraDiskPath, nil, true); cerr != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to convert extra disk %#q to raw: %w\", extraDiskPath, cerr)\n\t\t\t}\n\t\t\targs = append(args, \"--device\", fmt.Sprintf(\"virtio-blk,path=%s,format=raw\", extraDiskPath))\n\t\t}\n\t}\n\n\t// Network commands\n\tnetworkArgs, err := buildNetworkArgs(inst)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to build network arguments: %w\", err)\n\t}\n\n\t// File sharing commands\n\tif *inst.Config.MountType == limatype.VIRTIOFS {\n\t\tfor _, mount := range inst.Config.Mounts {\n\t\t\tif _, err := os.Stat(mount.Location); errors.Is(err, os.ErrNotExist) {\n\t\t\t\tif err := os.MkdirAll(mount.Location, 0o750); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/driver/krunkit/krunkit_darwin_arm64.go#L59-L95","documentation":"krunkit/libkrun requires raw disk images, so Cmdline converts each additional disk's data disk to raw format using diskUtil.Convert. If the conversion fails (unsupported image format, truncated/corrupt file, insufficient disk space for the raw copy), the error is wrapped as `failed to convert extra disk %#q to raw: %w`.","triggerScenarios":"Starting an instance with additionalDisks whose backing data file is in a non-raw format that cannot be converted (e.g. corrupt qcow2), or conversion failing due to no space in ~/.lima/disks/<name> since raw conversion writes in place with `true` (in-place flag) — any underlying Convert error surfaces here.","commonSituations":"Disk created by a different tool/version leaving an incompatible image; disk file partially deleted or zero-length; host disk full during conversion; interrupting a previous conversion left the image in a broken state.","solutions":["Read the wrapped `%w` error to identify the root cause (format vs I/O).","Free space on the host volume holding ~/.lima/disks and retry `limactl start`.","Recreate the disk: `limactl disk delete <name>` then `limactl disk create <name> --size <size>`, and re-copy data.","Verify the data file under ~/.lima/disks/<name>/ with an image tool; if corrupt, restore from backup."],"exampleFix":"# before: start fails converting disk \"data\"\n$ df -h ~/.lima/disks          # check space\n$ limactl disk delete data && limactl disk create data --size 50G\n# after\n$ limactl start myinstance","handlingStrategy":"validation","validationCode":"// Shell: verify image and free space before start\ndf -h \"$HOME/.lima/disks\" | awk 'NR==2 {exit ($5+0 > 90 ? 1 : 0)}' || { echo \"low disk space\"; exit 1; }\nfile \"$HOME/.lima/disks/<name>/datalt\" # confirm a readable image","typeGuard":null,"tryCatchPattern":"if err := inst.Start(ctx); err != nil {\n    if strings.Contains(err.Error(), \"failed to convert extra disk\") {\n        // recreate disk and reattach\n        exec.Command(\"limactl\", \"disk\", \"delete\", diskName).Run()\n        exec.Command(\"limactl\", \"disk\", \"create\", diskName, \"--size\", \"50G\").Run()\n        return inst.Start(ctx)\n    }\n    return err\n}","preventionTips":["Keep free space headroom on the volume holding ~/.lima/disks","Never interrupt a running start/conversion mid-way","Recreate disks whose image files appear zero-length or corrupt","Keep Lima up to date for converter fixes"],"tags":["krunkit","disks","raw-image","conversion","macos"],"backgroundTag":"disk-image-conversion-failed","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}