Skip to content

[Bug]: index.json files disappear when disk is full #3924

@tendant

Description

@tendant

zot version

v2.1.12-0-g331a927

Describe the bug

When disk becomes full (ENOSPC) during an image push, the repository index.json file is removed, causing all existing images in the repository to become inaccessible.

This leads to permanent loss of repository metadata under a common failure condition.

To reproduce

1.	Run zot with local storage (/data/zot)
2.	Fill disk until nearly full
3.	Push a new image to an existing repository
4.	Disk reaches 100% during push
5. 	index.json file under the repository directory is deleted / missing
6. 	Repository becomes empty
    "distSpecVersion": "1.1.1",
    "storage": {
        "rootDirectory": "/data/zot"
    },
    "http": {
        "address": "0.0.0.0",
        "port": "8000",
        "compat": ["docker2s2"],
        "auth": {
            "htpasswd": {
                "path": "/etc/zot/htpasswd"
            }
        }
    },
    "log": {
        "level": "debug"
    }
}```

### Expected behavior

	•	Existing index.json should remain intact if write fails
	•	Failed push should not destroy repository metadata

### Screenshots

_No response_

### Additional context

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingrm-externalRoadmap item submitted by non-maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions