Reinstall a VPS without losing data
Reinstalling a VPS erases everything it holds: files, databases, accounts, SSH keys, firewall rules and scheduled tasks. It is irreversible and a forgotten backup cannot undo it. The operation makes sense when the system is compromised, broken beyond reasonable repair, or when you want a clean base. Preparation makes all the difference.
What disappears
| Data | Usual location | Export |
|---|---|---|
| Website and code | /var/www, /srv |
rsync or archive |
| Databases | MariaDB, PostgreSQL | mysqldump, pg_dump |
| Configuration | /etc |
targeted copy |
| Scheduled tasks | crontab -l |
text file |
| Accounts and keys | /home, /root/.ssh |
encrypted backup |
| Certificates | /etc/letsencrypt |
can be reissued |
Backups included with the VPS plan depend on the plan. Check what the dashboard actually offers before relying on it; a provider backup never replaces a tested off-site copy.
Back up first
Copy files to another machine:
rsync -aHAX --numeric-ids /srv/ utilisateur@backup-machine:/srv/copy/-a keeps permissions and dates, -H hard links, -A ACLs, -X extended attributes. Without --numeric-ids, UIDs may be translated and owners can change on restore.
Export databases:
mysqldump --single-transaction --routines --triggers --databases my_db > my_db.sql
pg_dump -Fc my_db > my_db.dumpCheck the archive before destroying anything:
tar -tzf backup.tar.gz | head
grep -c 'CREATE TABLE' my_db.sqlAlso record packages and services: dpkg --get-selections > packages.txt and systemctl list-unit-files --state=enabled > services.txt.
Reinstall from the dashboard
In https://dash.neoheberg.fr, open the VPS, choose reinstall and the proposed system is Debian 13. The operation destroys the container and recreates it. The root password is usually shown once: copy it before closing the window.
Wait for completion, then check the console and network address. Do not start the reinstall if the backup is not confirmed: there is no rollback.
Bring it back online
- Log in over SSH and update the system.
- Create the admin user and your keys.
- Reinstall the required packages and services.
- Restore files with
rsync -ato preserve owners. - Import the database, then restore the crontab.
- Re-enable the firewall and Fail2ban, then certificates.
Do not restore an old configuration without reviewing it: reinstalling is the moment to remove an unused service and rotate exposed secrets.
Verify
systemctl --failed
ss -tlnp
curl -I https://votre-domaine.frThe site must answer, services must be enabled, and restored file permissions must match users that exist on the new system. Test an SSH login with your key before disabling password authentication.
Advertisement
Was this article helpful?
Read next
- Reboot, stop and check a VPSReboot cleanly, use panel actions and check the state after boot.
- List open ports on a VPSTell a listening service from a reachable port, then close what is unnecessary.
- Monitor RAM and CPUTell cache from real memory use, read load average and spot a process killed by the OOM killer.