{"record":{"id":"ea35ce5537085f27","repo":"abiosoft/colima","slug":"cannot-recover-disk-w-creating-new-storage-pool","errorCode":null,"errorMessage":"cannot recover disk: %w, creating new storage pool","messagePattern":"cannot recover disk: %w, creating new storage pool","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"environment/container/incus/incus.go","lineNumber":128,"sourceCode":"\t\treturn fmt.Errorf(\"error parsing incus config template: %w\", err)\n\t}\n\n\tstdin := bytes.NewReader(buf)\n\tif err := c.guest.RunWith(stdin, nil, \"sudo\", \"incus\", \"admin\", \"init\", \"--preseed\"); err != nil {\n\t\treturn fmt.Errorf(\"error setting up incus: %w\", err)\n\t}\n\n\t// provision successful\n\tif emptyDisk {\n\t\treturn nil\n\t}\n\n\tif !recoverStorage {\n\t\treturn c.wipeDisk(conf.Disk)\n\t}\n\n\tif _, err := c.guest.Stat(poolDiskFile); err != nil {\n\t\tlog.Warnln(fmt.Errorf(\"cannot recover disk: %w, creating new storage pool\", err))\n\t\treturn c.wipeDisk(conf.Disk)\n\t}\n\n\tfor {\n\t\tif err := c.recoverDisk(ctx); err != nil {\n\t\t\tlog.Warnln(err)\n\n\t\t\tif cli.Prompt(\"recovery failed for default storage pool, try again\") {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tlog.Warnln(\"discarding disk, creating new storage pool\")\n\t\t\treturn c.wipeDisk(conf.Disk)\n\t\t}\n\t\tbreak\n\t}\n\n\treturn nil","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/environment/container/incus/incus.go#L110-L146","documentation":"During incus provisioning with an existing data disk, colima checks for the pool disk file with guest.Stat(); the stat failed and colima logs a warning that it cannot recover the disk and will wipe it and create a new storage pool. This is an intentional degrade path, not a hard failure — data on the previous pool is discarded.","triggerScenarios":"guest.Stat(poolDiskFile) errors: the .img pool disk file is absent (moved/deleted), the /var/lib/incus mount is missing, or permissions changed after a host upgrade.","commonSituations":"External data disk not mounted, colima VM recreated but an old disk marker (limautil.DiskProvisioned) still present, or manual cleanup that removed the img while leaving metadata.","solutions":["Accept the wipe if the data is disposable — this is the default path","If the data matters, stop colima and verify the disk image exists at the expected path before retrying","Ensure external/data disks are mounted before 'colima start'","If state is inconsistent, reset fully: 'colima delete && colima start'"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// data-safe gate: only allow the wipe path when user confirms\nif _, err := c.guest.Stat(poolDiskFile); err != nil {\n    if !cli.Prompt(\"pool disk missing, wipe and recreate storage (data will be lost)\") {\n        return fmt.Errorf(\"aborted: pool disk file missing: %w\", err)\n    }\n    return c.wipeDisk(conf.Disk)\n}","typeGuard":null,"tryCatchPattern":"// colima already degrades gracefully; callers only need to surface the warning\nif _, err := c.guest.Stat(poolDiskFile); err != nil {\n    log.Warnln(fmt.Errorf(\"cannot recover disk: %w, creating new storage pool\", err))\n    return c.wipeDisk(conf.Disk)\n}","preventionTips":["Back up the incus disk image before upgrades","Verify external data disks are mounted before 'colima start'","Do not delete files under /var/lib/incus manually"],"tags":["incus","storage","recovery","data-loss"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}