Databases & Storage

Cold Storage: How to Store Rarely Used Data Cheaply and Safely

By NileVPS Team · Published · 4 min read

اقرأ المقال بالعربي

Not all data deserves the same storage. Your live database needs fast disks and instant access. Last year's logs, finished project files and monthly backups from 2024 almost never get read, yet they quietly fill up the same fast and comparatively expensive disk. Cold storage is the practice of moving data like that to cheaper, slower storage built for keeping things for a long time. Done well, it keeps your server lean and your history safe. Done badly, it produces archives nobody can restore. This guide explains the tiers and walks through a practical archiving setup for a VPS.

Hot, warm and cold data

TierTypical dataAccess patternStorage type
HotLive database, active uploads, application codeConstant, latency-sensitiveLocal SSD/NVMe
WarmRecent backups, last few months of logsOccasional, should be quickSecondary disk, object storage
ColdOld backups, compliance archives, finished projectsRare, delays acceptableObject storage archive classes, offline media

Cold storage trades access speed and convenience for lower cost per gigabyte and durability. Some archive services take minutes or hours to make data readable again, and many charge for retrieval or have a minimum storage period. Always read the terms of the service you choose before relying on it.

What belongs in cold storage

Good candidates:

  • Backups older than your normal restore window, for example daily backups kept 14 days locally and monthly copies archived for a year.
  • Rotated logs needed for audits or investigations but not for daily work.
  • Database dumps taken before major migrations.
  • Media and documents from closed projects or deleted accounts that you are required to keep for a period.

Poor candidates:

  • Anything your application reads during normal operation.
  • Your only copy of important data. Cold storage should be one of several copies, not the only one.
  • Data you are legally required to delete. Archiving it does not make it disappear.

Designing an archive policy

Before writing scripts, answer four questions:

  1. What is archived? List paths and databases explicitly.
  2. When does data move? For example, logs after 30 days, backups after 14 days.
  3. How long is it kept? Define a retention period and delete after it.
  4. How fast must it come back? If you need a restore within an hour, deep archive classes are the wrong tier.

Write the answers down. A policy in someone's head is not a policy.

A practical setup on a Linux VPS

Step 1: Compress and package

Compression reduces both storage and transfer. zstd gives a good balance of speed and ratio:

sudo apt install zstd
tar -I 'zstd -19 -T0' -cf logs-2026-10.tar.zst /var/log/myapp/2026-10/

For databases, dump in a compressed format:

pg_dump -Fc -d mydb -f mydb-2026-11-01.dump

Step 2: Encrypt before it leaves the server

Archived data often lives with a third party for years. Encrypt it so the storage provider never sees plaintext. A backup tool such as restic encrypts and deduplicates in one step:

export RESTIC_REPOSITORY=s3:https://your-object-storage-endpoint/bucket-name
export RESTIC_PASSWORD_FILE=/root/.restic-pass
restic init
restic backup /srv/archive

Store the password somewhere safe outside the server too. An encrypted archive whose key was only on the lost server is unrecoverable.

Step 3: Upload to object storage

If you prefer plain files, rclone can copy to most S3-compatible services:

rclone copy /srv/archive remote:bucket-name/archive --progress

Many S3-compatible providers offer lifecycle rules that move objects to a colder class or delete them after a set number of days. Use them where available instead of reinventing the logic.

Step 4: Apply retention

With restic, keep a defined set of snapshots and remove the rest:

restic forget --keep-monthly 12 --keep-yearly 3 --prune

Remove local copies only after the upload is verified.

Step 5: Schedule it

A systemd timer or cron job keeps the process consistent:

0 3 1 * * /usr/local/bin/archive-monthly.sh >> /var/log/archive.log 2>&1

Make the script exit with a non-zero code on failure and send yourself an alert, so a broken archive job does not go unnoticed for months.

Test restores, not just backups

The most common failure with cold storage is discovering, at the worst moment, that archives are incomplete, the key is lost, or the format cannot be read. Schedule a restore test, for example every quarter:

restic restore latest --target /tmp/restore-test
pg_restore -l /tmp/restore-test/srv/archive/mydb-2026-11-01.dump | head

Record how long the restore took. That number tells you whether your chosen tier matches your recovery expectations.

Where snapshots fit

VPS snapshots are excellent for quick rollbacks before an upgrade, but they usually live with the same provider as the server. Treat them as warm, short-term protection, and keep an independent, encrypted copy elsewhere for long-term retention, in line with the 3-2-1 rule covered in our guide to website backups.

FAQ

Is cold storage the same as a backup?

Not exactly. A backup is a copy for recovery; cold storage is a place to keep data you rarely access. Old backups are often stored in cold storage, but cold storage alone does not guarantee you have a usable, recent backup.

How often should I test restoring archived data?

At least a few times a year, and after any change to your scripts, keys or storage provider. A restore test is the only proof that your archive works.

Should I delete archived data eventually?

Yes. Set a retention period based on your business and legal needs, and delete data when it expires. Keeping everything forever increases cost and risk without adding value.

Related guides