--- title: Disks description: Keep your app's files across sleeps, restarts and deploys. --- # Disks Your app runs from a fresh copy of its image every time it starts: after it [sleeps](sleep-and-wake.md), after a restart, after a deploy. Anything it wrote to its own filesystem is gone then. A **disk** keeps files: a SQLite database, uploads, the app's setup. ```yaml components: - name: web port: 3001 public: true disk: {size: 1Gi, path: /app/data} ``` | Field | Means | |---|---| | `size` | Whole GiB: `1Gi` (the default) up to `4Gi` on the free plan. The disk, your database and their backups share the plan's storage | | `path` | The directory your app keeps its files in, for example `/app/data`. Not `/`, a system directory (`/etc`, `/usr`, `/var`, `/tmp`, …), or anything under `/dev`, `/proc`, `/sys` or `/run` | ## Adding one When your app uses SQLite or writes files while Kaviris tries it out, the deploy says so ([data_without_disk](../refusals/data_without_disk.md)) and offers the change: press **Add a disk**, then approve it. Your coding agent does the same with `update_contract` and `approve_contract`. Adding a disk lets the app reach nothing new, so it is an ordinary change; no rebuild is needed. The first time, the disk starts with whatever your image has at `path`, so an app that ships files there still finds them. After that the disk's files win. ## How it works The disk is a real block device of its own, attached to your app's micro-VM and mounted inside it. Kaviris's machines never open its filesystem. One copy of your app runs at a time: a deploy stops the old one before the new one starts, so two copies never write to the same files. ## Removing or resizing Both take the disk's files away, so Kaviris asks you to confirm first (your agent gets a `confirm_token` to show you the summary). A new size is a new, empty disk for now: the files are not carried over. After a removal or a resize, the old disk is kept for **30 days**. Putting the same disk back (same size) within that time brings its files back. Then it is deleted for good, and its backups 7 days after that. A kept disk still counts against your plan's storage, and so do those backups. ## Backups Kaviris backs up each disk nightly, as a whole, encrypted before it leaves the machine. Backups are kept for 7 days, and the last one stays even if it is older. - **Only while nothing is using it.** The backup runs while your app is not running, so it never pauses your app. An app that stays awake all night gets no backup that night. - **Last night, not any moment.** A disk comes back as it was at its last backup, unlike your [database](backups-and-restore.md). - **Restoring is by request for now.** You and your agent can't do it yet: write to [support](../support.md), and our staff handle it. - **Backups count toward your storage,** and can take up to 7 days to shrink after you delete files. - **Deleted files stay in the copy** until the disk reuses their space, as on the disk itself. ## What is not there yet - **A tested restore, and the disk in your export.** Both are coming. - **How full it is.** The app page shows the disk's size, not how much of it is used. A full disk makes writes fail inside your app. - **Growing a disk with its files.**