A snapshot is a point-in-time picture of a server's disk that you can roll back to if a change goes wrong. Used well, snapshots make risky work, such as an operating system upgrade or a big software change, far less stressful. Used badly, they give a false sense of safety, because a snapshot is not a backup. This guide explains how snapshots work, how to take and remove them yourself on your own VPS, and what to ask support for.
A snapshot freezes the state of a disk so you can return to it later; it lives on the same storage as the server, so it doesn't replace an off-site backup. On your own VPS you can take snapshots with the tools of your operating system, such as LVM, Btrfs or ZFS, if the disk layout supports them. Anything on our side of a Domain India VPS, such as a snapshot before risky work or a restore, is done by support: open a ticket. Always keep your own off-site backups as well.
The commands below run as root on a VPS or server you manage. On shared hosting (cPanel, DirectAdmin, Webuzo) you can't take disk snapshots. Instead, cPanel and DirectAdmin accounts are backed up weekly with JetBackup 5, and Webuzo accounts every night to a separate Domain India backup server, with restores through support. See Backup and Restore with JetBackup.
1. What a snapshot is
A snapshot records which disk blocks look like what at one moment. After that, new writes go to fresh blocks (or the old ones are copied aside), so the snapshot keeps showing the disk as it was. Snapshots can be taken at three levels:
| Level | Taken by | Covers |
|---|---|---|
| Hypervisor | The hosting platform | The whole virtual disk of the VPS |
| Volume | LVM inside your server | One logical volume, such as the root filesystem |
| Filesystem | Btrfs or ZFS inside your server | One filesystem or subvolume |
2. Snapshots are not backups
- Rolling back a failed OS or software upgrade
- Testing a risky change and undoing it in minutes
- Getting a consistent copy to back up from
- A failed disk or storage system, because they live on the same storage
- Mistakes you only notice weeks later, after the snapshot is gone
- Ransomware or an attacker with root, who can delete them
Keep at least one copy of your data off the server: database dumps and files sent to object storage or your own computer. Automated backups with cron and rclone shows one way to do it.
3. Snapshots on a Domain India VPS
There is no snapshot page or snapshot button for VPS in the Domain India client area. Anything that has to happen outside your server is done by support:
- Before risky work, such as a major OS upgrade, open a ticket to ask whether a snapshot of your VPS can be taken first, and wait for confirmation before you start.
- To roll back to a snapshot, open a ticket with the VPS IP address and what you need restored. A rollback returns the whole disk to that moment, so anything written after it is lost.
- Your own backups still matter. Don't plan around a snapshot you haven't confirmed exists.
Open tickets from /client/support/new when logged in, or from /support/ticket.
4. Take your own LVM snapshot
If your VPS uses LVM, you can snapshot a logical volume yourself. First check the layout and the free space in the volume group:
sudo lvs # logical volumes, e.g. "root" in volume group "vg0"
sudo vgs # the VFree column must show space for the snapshotIf lvs shows nothing, the disk doesn't use LVM; see section 5. If VFree is 0, there's no room for an LVM snapshot.
- Create the snapshot.Size it for the writes you expect while it exists, not for the whole volume:
sudo lvcreate --snapshot --size 5G --name root_snap /dev/vg0/root - Check it.
sudo lvsshowsroot_snapwith aData%column. If that reaches 100%, the snapshot becomes invalid. - Do the risky work,then test your sites and services.
- If it went well, remove the snapshot:
sudo lvremove /dev/vg0/root_snap. Old-style LVM snapshots slow down writes while they exist, so don't keep them for days. - If it went wrong, roll back:
sudo lvconvert --merge /dev/vg0/root_snap, then reboot. The merge of a mounted root volume completes during the next boot.
To copy files out of a snapshot without rolling back, mount it read-only: sudo mount -o ro /dev/vg0/root_snap /mnt (on XFS add -o ro,nouuid).
5. Btrfs and ZFS snapshots
Btrfs and ZFS have snapshots built in. They are instant and use space only for changed data.
# Btrfs: read-only snapshot of a subvolume
sudo btrfs subvolume snapshot -r /data /data/.snapshots/before-upgrade
sudo btrfs subvolume delete /data/.snapshots/before-upgrade
# ZFS: snapshot, list, roll back, delete
sudo zfs snapshot tank/data@before-upgrade
sudo zfs list -t snapshot
sudo zfs rollback tank/data@before-upgrade
sudo zfs destroy tank/data@before-upgradeMost VPS images use ext4 or XFS without LVM. On those, rely on file-level backups instead, such as restic or borg to off-site storage, which also keep several versions.
6. Make the snapshot consistent
A snapshot of a running server is "crash-consistent": like pulling the power cord. Databases usually recover, but a clean copy is safer:
- Dump databases first:
mysqldump --all-databases --single-transaction | gzip > /root/db-$(date +%F).sql.gz, orpg_dumpallfor PostgreSQL. - Or stop write-heavy services for the few seconds the snapshot takes, then start them again.
- Note what changed and when, so you know which snapshot to roll back to.
7. Limits to keep in mind
- A snapshot can't restore a single file on its own; you mount it and copy the file out, or roll back everything.
- Rolling back loses every change since the snapshot, including new orders, emails and uploads.
- Snapshots use disk space that grows with every change. Delete them once you no longer need them.
- A snapshot of a disk full of errors is a copy of the errors. Check your data before you trust it.
8. Where Domain India fits
Domain India VPS plans run on KVM with NVMe storage and full root access, and are self-managed: the data and its backups are yours to look after, and support handles anything outside the server. For copying or resizing a whole VPS, see Cloning and resizing your VPS. The card shows the live price, excluding 18% GST:
- 2 vCPU
- 4 GB DDR4 RAM
- 128 GB NVMe SSD Storage
- 3 TB Monthly Bandwidth
Is a snapshot the same as a backup?
No. A snapshot lives on the same storage as the server, so a storage failure or an attacker with root access can take it with the server. Keep separate off-site backups as well.
How do I take a snapshot of my Domain India VPS?
There is no snapshot button in the client area. Open a support ticket before risky work to ask whether a snapshot can be taken. Inside the VPS you can also use LVM, Btrfs or ZFS snapshots if your disk layout supports them.
How do I restore my VPS from a snapshot?
Open a support ticket with the VPS IP address and what you need restored. A rollback returns the whole disk to the moment of the snapshot, and everything written after it is lost.
Can I take snapshots on shared hosting?
No. cPanel and DirectAdmin accounts are backed up weekly with JetBackup 5, which you can download or restore from your control panel. Webuzo accounts are backed up every night, and support restores them on request.
How long should I keep an LVM snapshot?
Only as long as the risky work takes. Classic LVM snapshots slow down disk writes and become invalid if they fill up, so remove them with lvremove once you are sure the change worked.
Why is my LVM snapshot marked invalid?
It ran out of space. The snapshot size must cover all the data changed while it exists. Create it larger next time, or keep it for a shorter time.
Ready to make changes safely? Take your own backup first, then open a ticket if you need anything done on our side of your VPS, or compare VPS plans.
Tell support the VPS IP address and what you plan to change, and ask what can be done on our side before you start.
Open a ticket