Why is it needed?
When you redeploy a bot (new ZIP) or the container is re-created, the working folder's files are replaced. The SQLite database, user photos or caches your bot wrote may be lost. Persistent Storage is a separate disk: it is mounted into the server as the /data folder and is never removed on its own.
1. Getting and attaching storage
- Persistent Storage — choose a plan on that page (1–100 GB).
- Pick your bot or site in the purchase window — storage is mounted at /data automatically and the server restarts.
- To attach later: Panel → Persistent Storage → volume → “Attach to a server”.
One plan can be split into several volumes: e.g. 10 GB → 6 GB for a bot, 4 GB for a site. Several volumes can be attached to one server at different paths (e.g. /data and /storage) several volumes are attached.
2. Using it in code
The main rule: write everything that must persist to /data.
# main.py — aiogram 3 + SQLite (/data da)
import os
import sqlite3
from pathlib import Path
DATA = Path(os.getenv("DATA_DIR", "/data")) # Persistent Storage
DATA.mkdir(parents=True, exist_ok=True)
db = sqlite3.connect(DATA / "bot.db")
db.execute("PRAGMA journal_mode=WAL") # bir vaqtda o'qish/yozish uchun
db.execute("CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT)")
db.commit()
def save_user(user_id: int, name: str) -> None:
db.execute("INSERT OR REPLACE INTO users VALUES (?, ?)", (user_id, name))
db.commit()# Foydalanuvchi yuborgan rasm va audio — /data/media ga
from aiogram import F, types
MEDIA = DATA / "media"
MEDIA.mkdir(exist_ok=True)
@dp.message(F.photo)
async def photo(message: types.Message, bot) -> None:
file = await bot.get_file(message.photo[-1].file_id)
await bot.download_file(file.file_path, MEDIA / f"{message.from_user.id}.jpg")
await message.answer("Rasm saqlandi ✅")// index.js — Node.js (better-sqlite3 + fayllar)
const fs = require('node:fs');
const path = require('node:path');
const Database = require('better-sqlite3');
const DATA = process.env.DATA_DIR || '/data';
fs.mkdirSync(path.join(DATA, 'uploads'), { recursive: true });
const db = new Database(path.join(DATA, 'bot.db'));
db.pragma('journal_mode = WAL');
db.exec('CREATE TABLE IF NOT EXISTS notes (id INTEGER PRIMARY KEY, text TEXT)');
async function saveUpload(name, buffer) {
await fs.promises.writeFile(path.join(DATA, 'uploads', name), buffer);
}<?php
// Web hosting: foydalanuvchi yuklagan fayllar /data/uploads ga
$dir = '/data/uploads';
if (!is_dir($dir)) mkdir($dir, 0775, true);
$name = bin2hex(random_bytes(8)) . '.pdf';
move_uploaded_file($_FILES['file']['tmp_name'], "$dir/$name");
$db = new PDO('sqlite:/data/site.db');3. Fayl menejeri
Panel → Persistent Storage → volume: upload (large files in resumable chunks), download, new folder, rename, copy, move, delete, search, sort and multi-select. PNG, JPG, WEBP, PDF, TXT, JSON, YAML and LOG files can be previewed in the browser.
4. Backups and restore
- Daily backups are on for every plan (you pick the hour); weekly is optional. Manual backups anytime.
- SQLite databases are copied consistently during backup (no half-written databases), and every backup is verified.
- During restore the server is stopped temporarily, data returns to the chosen state and the server starts again. The volume name is required to confirm.
- Backups can be downloaded as .tar.zst archives.
5. Billing and terms
- Paid from your EliteHost balance every 30 days (with auto-renew on).
- If the balance is short: a few days of grace (writes allowed), then read-only mode, then a retention period. Nothing is deleted right away.
- You'll be notified (site, Telegram, email) before expiry, at 70/85/95/100% usage and on backup errors.
Limits
- A volume attaches only to bot and web hosting servers on the same node.
- Attaching or detaching restarts the server (the mount applies at that moment).
- Shrinking works only with the server stopped and if files fit the new size. Growing is online.
- You can't escape the volume through symlinks; the single-file upload limit is 4 GB.
- Detaching never deletes data — the volume can be attached to another server.