How to back up and restore a cloud computer: a tested guide
One backup file, saved somewhere that outlives the computer. Then delete things on purpose and bring them back, because a backup you have never restored is only a hope.
A computer keeps its files while it sleeps. That is not a backup. If you delete the computer, or a command removes the wrong folder, or you drop the wrong database, the files go with it. A backup is a copy kept somewhere else.
This post makes a backup of a small site, its database and a second database on a Small computer, saves it to Assets, then breaks the site and restores it. The restore found a mistake in the agent's own instructions, and that is the best argument for testing one.
What to back up
- Your files: the project folder and any notes you wrote.
- Your databases, as dumps. A dump is a text file of SQL that rebuilds the database. Copying a running database's own files is not safe, and a dump is also easy to read and to move to another computer.
- The facts that are not in the files: which packages you installed, which database user the site logs in as, which port it runs on. The agent can write these into a README inside the backup.
The first message
We used the computer from the XAMPP move post, which now had a MariaDB database for a club site and, from the SQL post, a PostgreSQL database called school. We sent:
I want a backup of everything on this computer that I would
miss if it were deleted. Please make one file,
/home/agent/backups/backup-YYYY-MM-DD.tar.gz, that holds: a dump
of the clubsite MariaDB database, a dump of the school PostgreSQL
database, the folder /home/agent/www, and
/home/agent/clubsite-move-notes.md. Put a README.txt inside that
says what is in it and how to restore each part. Do not delete or
change anything else. When it is done, list what is inside the
archive and its size, and tell me the one command to check the
archive is not damaged.
What the agent made
The agent looked first. MariaDB was running and PostgreSQL was stopped, since a restart leaves it off. It started PostgreSQL only to dump it, and stopped it again afterwards, so the computer was as it found it. It asked before the commands that wrote the dumps, and it checked the numbers inside them: 6 members, 15 students, 5 courses and 42 enrolments.
It also gave the one command that checks the archive is readable, which you can run any time:
tar -tzf /home/agent/backups/backup-2026-11-16.tar.gz > /dev/null && echo OK
The agent raised two things we had not asked about. The site's db.php holds the real database password in plain text, so the archive is private: it set the file so only its owner can read it, and told us to keep it away from public links and public Git. And the dump does not contain the database login, so on a new computer you would make that user again and put the same password in db.php. The README says so.
Save it somewhere that survives
The archive is now on the computer's disk, which is the same place the originals are. Open the Files tab and go to the backups folder. Each file has Download, which saves it to your own laptop, and Save to assets.
Assets is your own storage, apart from any computer. Its page says "Files that stay after a computer is deleted", and this account had 5 GiB of it. The dialog lets you name the copy, and a slash makes a folder:
backups/… to keep backups together.
For a backup you really care about, also press Download once and keep that copy on your laptop or your university drive. Two places are safer than one.
Break it, then restore it
Then we tested it. We asked the agent to drop the database, move the site's folder out of the way (not delete it), show that the page was broken, and restore both from the archive by following its own README:
Now prove the backup works. Pretend the computer lost the club
site: drop the clubsite database and move /home/agent/www/clubsite
to /tmp/clubsite-old (do not delete it yet), then show me that
the page is broken. After that, restore both from the backup
following the README, and show me the page working again with 6
members. Tell me each command you ran, and any step where the
README was wrong or incomplete.
Before it did anything destructive, the agent made a safety copy of its own, in case the backup turned out to be bad, and then asked for approval. We had not told it to do either.
We approved. The page went to a 404 with no members. The agent unpacked the archive, loaded the database dump with sudo mariadb < clubsite_db.sql, and copied the site back. After the fix described below, the page answered 200 with all six members, and diff -r said the restored folder was identical to the one it had moved aside.
What the restore found
The README the agent wrote had a mistake, and only the restore showed it. The restore command put the site in /home/agent/www/www, so the page stayed a 404. When the destination folder already exists, cp -a copies the folder into it. Adding /. copies its contents instead:
Wrong: cp -a /tmp/restore-2026-11-16/www /home/agent/www
Correct: cp -a /tmp/restore-2026-11-16/www/. /home/agent/www/
The agent listed five more gaps in the README, and what to add for each.
- The README never checked the web page, only the database. Add a request to the page and expect 200 and six rows.
- It did not say what to do if something is already using port 8000. If a server is still running from the old folder, you cannot tell whether the restore worked.
- It did not say the database login must exist. The dump holds the data and not the user. It worked here because dropping a database does not remove its users, but on a new computer the page would show an error.
- It did not warn that
db.phpmust stay readable only by its owner and group.cp -akeeps that setting, and a plaincp -rwould not. - The PostgreSQL restore was untested. Testing it means dropping the school database, so the agent asked first, and we did not.
That last one matters. A restore you have not run is a guess, and half of this backup is still a guess.
A checklist
- Dump each database to a file. Do not copy a running database's files.
- Put the dumps, your project folder and a README in one archive, and check it with
tar -tzf. - Write into the README what the dump does not hold: users, passwords, packages and ports.
- Save a copy to Assets, and download one to your own machine.
- Test the restore on purpose, with a safety copy first, and follow the README word for word.
- Fix the README where it was wrong, and repeat the backup when your data changes.
What it cost
It was a Small computer, RM0.03 an hour while it runs and nothing while it sleeps, for about half an hour, so a few sen. The archive was 7.2 KiB, and Assets is separate storage: this account had 5 GiB of it. How running time and credit work has the details, and why a computer sleeps says what stays on its disk.
Cautions
- A backup holds secrets. This one held a database password. Keep archives private, and do not publish them or put them in public Git.
- Test the restore on something you can lose. We used a toy site. Do not start with the only copy of your project.
- Check what the agent writes. Its README had a mistake, and it said so only because we asked it to look for one.
awxis in early alpha. Keep a copy of anything that matters on your own machine too.
Keep reading
- How to practise Linux on a computer you can break
- How to work on LaTeX with AwanBox
- How to move a XAMPP project to AwanBox
- How to practise SQL with PostgreSQL: SELECT, JOIN, GROUP BY
- Why a computer sleeps, and how to keep it running
Getting started
Sign in with your Google account and open a chat on the computer you want to protect. Paste the first message from this post, then run the restore test the same day.
Awi, signing off.