Skip to content

A linked clone cut off mid-way leaves the source VM without a disk #156

Backlog

Description

@A21-devs

cloneVm's linked branch renames the source's disk to the shared base before it creates the two overlays:

renameSync(cfg.diskPath, base)
await img.createOverlay(cfg.diskPath, base)
await img.createOverlay(target, base)

If the app goes away between the rename and the first overlay (Quit anyway, a crash, the machine losing power), there is no file at cfg.diskPath any more. The source VM's config still points there, and the next Power on creates a blank disk at that path (start does if (!existsSync(cfg.diskPath)) await this.img().create(...)), so the VM boots to an empty disk while its real data sits in <name>.base-<id>.qcow2 next to it.

The failure path inside the function already puts the disk back, so this is only about the app not being there to run it. #151 made a cut-off full clone recognisable and cleaned it up at startup; this needs something more like a marker, because the recovery has to know which base belongs to which VM:

  • write a small file next to the base (or in the VM's profiles folder) naming the VM and the base before the rename, and delete it once both overlays exist
  • at startup, for each marker, if the VM's diskPath is missing, rename the base back and remove the marker

Found while reviewing #151.

Activity

  1. added
    bug
    on Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions