prompts / vps-volume-data-disk.md
edit FILL IN & copy this prompt →866 words

Prompt: give an ird server a persistent data disk

Have an agent put the data of an ird VPS — Docker volumes, a database, uploads — on a separate volume that outlives the server's own disk: create it, attach it at server create, format and mount it with an fstab entry, move the data over, and grow it later by moving to a bigger volume on a fresh server, deleting the old one only after the new one is proven.

Needs: ird access (the ird CLI, logged in — volumes are CLI-only, and the MCP vps_create has no volume parameter); an SSH key on the account; a shell with ssh and rsync Costs: volumes per GB-hour while they exist (credits_prices → recurring.volume-hourly.per_gb_hour); a new server bills its tier hourly from creation (recurring.vps-hourly), so two servers bill during a migration; a safety snapshot bills recurring.image-hourly Group: servers

Paste everything below the line into a fresh conversation. Fill in the FILL IN block first.


Task

Do OPERATION below. A volume is attached only when a server is created — ird vps volumes has only create and delete; no CLI or MCP command attaches or detaches later — so every path ends in a new server with the volume on it. Billable or destructive steps show cost and id first and wait.

FILL IN

OPERATION:  new-server            # new-server | migrate | grow
VOLUME:     data-1, 50            # name, size GB (grow: the new size)
SERVER:     app-1                 # migrate/grow: the existing server (name or id)
OLD_VOLUME: <volume id>           # grow: the volume being outgrown
TIER:       1x                    # tier id from vps_tiers (blank = same as SERVER)
IMAGE:      latest Debian         # image from `ird vps images`, or a snapshot id
HOST:       app.example.ro        # hostname to keep pointing at the live server (blank = none)
ZONE:       example.ro            # its zone on ird DNS
SSH_KEY:    laptop                # name or id from `ird vps ssh-keys`
DATA:       /var/lib/docker, /var/lib/postgresql   # what moves onto the volume
MOUNT:      /data

Non-negotiable rules

  1. Price first. Volume: GB × per_gb_hour × 730. Server: tier hourly × 730. Say both, wait.
  2. Create once. Create blocks until provisioning finishes (vps_create schema; the CLI walks you through it — pass every flag); on a timeout check ird vps list before anything else — a second call is a second server.
  3. No attach after create. An existing server gets a volume only via a new server with --volume and a data move.
  4. Format only an empty disk. mkfs only when lsblk -f shows no filesystem; a volume with data is mounted, never reformatted.
  5. Delete only after verification, only by named id. ird vps volumes delete and ird vps destroy are permanent. I write the id in chat after the new server has passed step F.

Steps

A. Inventory. ird vps list --json → SERVER id, tier_id, ipv4. ird vps volumes --json → volumes. ird vps tiers, ird vps images, ird vps ssh-keys → ids. credits_prices → the two rates. If HOST: dns_get_zone(ZONE) → its A record.

B. Create the volume. ird vps volumes create <name> <size-gb> → volume id; bills from now.

C. Create the server with it. For migrate/grow, first ird vps snapshot SERVER pre-volume-<date> as rollback (poll ird vps snapshot images at most once a minute until available). Then ird vps create <name> --tier TIER --image <image or snapshot id> --ssh-key <key id> --volume <volume id>. No --zone/--subdomain while SERVER still holds HOST; DNS moves in step G.

D. Format and mount (over SSH, Debian/Ubuntu):

  1. lsblk -f — find the extra disk by size, not by name.
  2. Empty only: mkfs.ext4 -L data /dev/<disk>.
  3. mkdir -p MOUNT && mount /dev/<disk> MOUNT; blkid for the UUID; add UUID=<uuid> MOUNT ext4 defaults,nofail 0 2 to /etc/fstab; mount -a and findmnt MOUNT to prove it.

E. Move the data. For each DATA path: stop the writer (systemctl stop docker / systemctl stop postgresql), rsync -aHAX --numeric-ids <path>/ MOUNT/<name>/, then point the service at the new location — Docker: data-root in /etc/docker/daemon.json; Postgres: data_directory — or a symlink. Start it, check it sees its data, only then remove the old copy. For migrate/grow the source is SERVER: rsync … root@<old ip>:<path>/ MOUNT/<name>/ from the new server for the bulk, then stop writers on SERVER and rsync the delta.

F. Verify. ird vps power restart <name>; after the reboot MOUNT is mounted with data present, services are up, the app answers on the new IP, a database row count matches.

G. Cut over and retire. If HOST: dns_set_record(domain=ZONE, name="HOST.", type="A", data={address: <new ipv4>}) (CLI: ird dns set ZONE <short name> A <ip>); dig +short HOST = new IP. Old server: ird vps power off SERVER (still billing while off), soak the agreed period, then on my written id ird vps destroy <id>; for grow, then ird vps volumes delete OLD_VOLUME — permanent. Drop the pre-volume snapshot once rollback is no longer wanted.

Deliverable

Volume id, name, size and monthly cost; server id, IP, MOUNT and the fstab line; what moved and how it was verified; HOST target; what was destroyed or deleted and when; monthly cost of what remains.

static mirror of HEAD · about · clone: git clone https://ird.cod-sursa.ro/prompts.git