Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

The safest way to undo a Linux VPS change is to match the recovery tool to the layer that changed: use Git for committed application or configuration files, apt history for a recent package transaction when your Ubuntu release supports it, an Ubuntu archive snapshot when you need packages from a known point in time, and a backup or provider snapshot for databases, uploads, boot failures, or whole-server damage. First preserve evidence and make a fresh backup if the machine is still readable; then restore the smallest possible scope and verify the affected service.

Choose the recovery layer before running a rollback command

“Undo the last change” is not one operation on a VPS. A deployment can alter tracked files, install packages, rewrite configuration, migrate a database, create generated assets, and change service state in one session. Reversing only one layer can leave the server inconsistent.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Method Best scope What happens to history What it can restore Main risk or limit
Git revert A published commit containing application or configuration changes Adds a new commit that reverses the earlier patch Tracked text and other files represented in the commit Does not undo package installs, database writes, uploads, or external side effects
Git reset A private branch whose commit pointer must move Rewrites the branch reference; the index and working tree depend on the mode Tracked files relative to a selected commit --hard can overwrite work and remove tracked paths absent from the target
APT transaction history A recent package install, removal, or upgrade on a release with the history interface APT performs another package transaction Packages involved in the recorded transaction, subject to dependency resolution Does not restore databases, application data, generated files, or arbitrary configuration edits
Ubuntu archive snapshot Making a package available from a specific archive state Changes the package source selection for the command Package versions published at a UTC snapshot time An older package may miss later security fixes and may not be dependency-compatible
Backup or provider snapshot Filesystem, database, boot, or multi-service damage Restores a captured system state to a volume or instance Whatever the backup includes, including application data when designed for it Restore time, stale capture data, and possible downtime; a backup without a tested restore procedure is not sufficient

If you are unsure, stop writing to the server, record what happened, and identify whether the symptom is limited to a repository, a package transaction, a package version, application data, or the entire filesystem. The narrowest correct method reduces collateral changes.

Preserve evidence and make a recovery point first

Do these checks while the system is still accessible. They prevent a second command from destroying information needed to diagnose the first failure.

#1 Best Overall
WD 2TB My Passport, Portable External Hard Drive, Black, backup software with defense against ransomware, and password protection, USB 3.1/USB 3.0 compatible - WDBYVG0020BBK-WESN
  • Slim durable design to help take your important files with you
  • Vast capacities up to 6TB[1] to store your photos, videos, music, important documents and more
  • Back up smarter with included device management software[2] with defense against ransomware
  • Help secure your important files with password protection and hardware encryption
  • 3-year limited warranty
  1. Record the incident. Note the symptom, the first failing request or service, the timestamp and timezone, the operator, and the commands recently run. Save shell history from the relevant account without editing it.
  2. Capture service and package state. Save the affected service status, recent journal or application logs, the current package versions, and the output of any deployment tool. Copy logs to a location outside the path you may restore.
  3. Identify the release and tools. Confirm the exact Ubuntu or Debian release and the installed APT version. A command documented for Ubuntu 25.10 is not automatically present on an older release.
  4. Make a fresh backup if reads are safe. Copy important configuration and data before attempting a downgrade or filesystem restore. If the machine is unstable, prioritize a provider volume snapshot or an offline copy over repeated repair attempts.
  5. Freeze unrelated changes. Pause automated deployments, scheduled package upgrades, queue workers, and destructive maintenance jobs. Keep a written list of every command used during recovery.

Do not start by deleting logs, purging packages, or repeatedly rebooting. Those actions can remove evidence and make a later restore harder to interpret.

Undo committed application or configuration changes with Git

Inspect the repository and select an exact target

Change into the repository and inspect both the working tree and recent history:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
git status
git log --oneline --decorate
git diff

Use the commit ID, tag, or other unambiguous reference that represents the known-good state. If the working tree contains unrelated edits, copy or commit them on a separate branch before recovery. A clean tree makes it possible to distinguish the reversal from pre-existing work.

Use git revert for a published commit

For a commit already pushed or deployed, create an additive reversal:

git revert <commit>

Git’s manual describes this operation as reverting the changes introduced by one or more existing commits and recording new commits for the reversal. The original commit remains visible, which preserves an auditable deployment history and lets you reapply or fix the change later.

For several commits, choose the range deliberately and review the generated patch before pushing. Reverting a later commit that depends on an earlier one can produce conflicts; resolve them in the working tree, run the application’s tests and configuration checks, then continue the revert. If the result is wrong, the reversal itself can be reverted with another normal commit.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Restore only selected paths

When one file or directory is wrong but the rest of a commit is needed, restore that path from a known-good commit:

git restore --source=<commit> -- path/to/file path/to/directory

Inspect the resulting diff before staging. This command changes the selected working-tree paths; it does not automatically create a commit or restore untracked files. Commit the intended result only after checking permissions, ownership, secrets handling and syntax.

Use reset only when rewriting a private branch is intentional

git reset moves HEAD and can also change the index and working tree. The modes have different consequences:

Rank #2
SSK Portable SSD 500GB External Solid State Hard Drive USB C Up to 1050MB/s
  • Capacity Display Variance: 500GB external ssd often appears as around 465GB on Windows. MacOS can show full 500 GB capacity. This is binary calculation difference and doesn’t affect SSD hard drive actual physical storage
  • 1050 MB/s Speed: Instantly access to your files with blazing-fast 10Gbps external SSD read up to 1050MB/s and write up to 1000MB/s. LED Light indicates USB SSD instant activity
  • Data Security: Solid state drives S.M.A.R.T. health diagnostics​ and adaptive TRIM optimizing data block management ensures consistent write speeds and extends the longevity of the portable SSD
  • USB-C & USB-A Cable: Both cables featuring rapid USB 3.2 Gen2, this USB SSD effortlessly bridges devices, enabling seamless cross-platform file transfers and backup between computers, smartphones, tablets and iPhone
  • Always Fast: No slowdowns for large file transfers. With SLC caching (25% of current available capacity allocated as high-speed cache), this external SSD delivers steady 10Gbps for transfers within the cache capacity
  • git reset --soft <commit> moves the branch pointer while leaving changes staged.
  • git reset --mixed <commit> (the default) moves the pointer and leaves file changes in the working tree, unstaged.
  • git reset --hard <commit> makes tracked files match the target commit. It can overwrite tracked edits and remove tracked paths that do not exist in that commit.

Create a safety branch before a destructive reset and verify the reference twice:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
git switch -c recovery-before-reset
git branch backup-before-reset
git reset --hard <known-good-commit>

Do not use a hard reset to repair a shared branch unless every consumer is prepared for rewritten history. Other clones will need an explicit, coordinated update, and uncommitted work that was overwritten may be unrecoverable.

Validate the service after a Git recovery

Check configuration syntax using the service’s native validation command, restart only the affected service, inspect its status and logs, and exercise a representative request. Compare behavior with the known-good state. A successful Git command proves only that files changed; it does not prove that the running process loaded them or that a database schema still matches the code.

Undo a recent package transaction with APT history

Check whether the history interface exists

Ubuntu documents apt history-list, apt history-info, apt history-undo, apt history-redo and apt history-rollback as an APT history-management interface added in Ubuntu 25.10. Verify the installed Ubuntu release and APT version before relying on these commands; an older system may not recognize them.

apt --version
apt history-list

Use the list to find the transaction ID, then inspect its exact package changes:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
apt history-info <ID>

Read the proposed operation before approving it. Package removal can affect dependants, and a later transaction may rely on versions installed by the transaction you are trying to undo.

Undo one transaction or roll back later transactions

To reverse the package changes recorded in one transaction, Ubuntu’s documented form is:

sudo apt history-undo <ID>

The release notes show sudo apt history-undo 0 removing a package installed by transaction 0. To repeat an earlier transaction, use:

sudo apt history-redo <ID>

To remove changes made after a selected transaction, use:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Kosbees 500 GB External Hard Drives,Portable Hard Drive for Windows,Ultra Slim External HDD Store Compatible with PC, MAC,Laptop,PS4, Xbox one, Xbox 360;Plug and Play Ready
  • 【Plug-and-Play Expandability】 With no software to install, just plug it in and the drive is ready to use in Windows(For Mac,first format the drive and select the ExFat format.
  • 【Fast Data Transfers 】The external hard drives with the USB 3.0 cable to provide super fast transfer speed. The theoretical read speed is as high as 110MB/s-133MB/s, and the write speed is as high as 103MB/s.
  • 【High capacity in a small enclosure 】The small, lightweight design offers up to 500GB capacity, offering ample space for storing large files, multimedia content, and backups with ease. Weighing only 0.35 Lbs, it's easy to carry "
  • 【Wide Compatibility】Supports PS4 5/xbox one/Windows/Linux/Mac and other operating systems, ensuring seamless integration with game consoles,various laptops and desktops .
  • Important Notes for PS/Xbox Gaming Devices: You can play last-gen games (PS4 / Xbox One) directly from an external hard drive. However, to play current-gen games (PS5 / Xbox Series X|S), you must copy them to the console's internal SSD first. The external drive is great for keeping your library on hand, but it can't run the new games.
sudo apt history-rollback <ID>

For example, the documented sudo apt history-rollback 1 removes changes after transaction 1. Treat these as new package operations, not as a time machine: APT resolves dependencies against repositories currently available and may select versions different from those originally installed.

When history commands are unavailable

Inspect the recorded APT logs instead:

sudo less /var/log/apt/history.log
sudo zgrep -h "Commandline|Start-Date|Install:|Upgrade:|Remove:" /var/log/apt/history.log*

Identify the previous package version and obtain it from a repository or supported archive snapshot. Do not assume that installing an older .deb is safe: dependencies, maintainer scripts, service users and configuration formats can have changed. Simulate or inspect the proposed package operation where supported, preserve the current package state, and schedule a maintenance window if a service restart is required.

Understand what an APT rollback leaves behind

APT changes package files and package-managed metadata. It does not automatically undo a database migration, delete application-generated assets, restore an edited file under /etc, or return a queue and object store to yesterday’s contents. If the upgrade triggered a schema change or data conversion, pair the package action with the application’s documented downgrade or database restore procedure. Keep a backup of the current state so you can return to it if the older package cannot read newer data.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Ubuntu archive snapshots to obtain a package from a known time

An archive snapshot selects package metadata from a time-indexed Ubuntu archive state. Snapshot IDs use UTC in the form YYYYMMDDTHHMMSSZ. Ubuntu 24.04 and later detect snapshots automatically; supported older releases require the documented source configuration and minimum APT versions.

Inspect availability before installing

sudo apt update --snapshot <UTC-SNAPSHOT-ID>
apt policy <PACKAGE> --snapshot <UTC-SNAPSHOT-ID>

The policy output lets you confirm which version the snapshot exposes before changing the installed package. Use the exact UTC ID, including the trailing Z; a local-time conversion can select the wrong archive state.

Install from the selected snapshot

sudo apt install <PACKAGE> --update --snapshot <UTC-SNAPSHOT-ID>

Use a snapshot to reproduce or troubleshoot a regression, or to make a known package version available for a controlled downgrade. It is not a substitute for a complete system restore. Review the security pocket and vulnerability status first: Ubuntu’s snapshot documentation warns that an example older version may lack newer security fixes. Return to current repositories and update to a supported security level as soon as the compatibility investigation ends.

Check release support and dependencies

If the snapshot option is rejected, check the installed APT version and the release’s support status rather than forcing an undocumented syntax. A package from one archive state may require matching versions of libraries, kernels or plugins. Test the complete dependency set in a disposable instance or restored volume when possible, and keep the current package list so you can reverse the experiment.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Restore a VPS with backups or a provider snapshot

Choose a restore target that preserves the damaged system

For filesystem-wide corruption, a failed boot, multiple services, or data loss, restore to a separate instance or volume first when the provider allows it. Preserve the damaged system as evidence. This lets you extract a missing configuration file, compare logs, or copy a specific upload without committing immediately to an irreversible replacement.

A provider snapshot is useful for fast infrastructure recovery, but its contents and consistency depend on how it was taken. A crash-consistent disk image may contain an in-flight database write. Stop the database cleanly before taking future snapshots, or use the database engine’s backup and restore mechanism for application data.

Rank #4
SSK Portable SSD 1TB External Solid State Hard Drive USB C Up to 1050MB/s
  • Capacity Display Variance: 1TB external ssd often appears as around 931GB on Windows. MacOS can show full 1 TB capacity. This is binary calculation difference and doesn’t affect SSD hard drive actual physical storage
  • 1050 MB/s Speed: Instantly access to your files with blazing-fast 10Gbps external SSD read up to 1050MB/s and write up to 1000MB/s. LED Light indicates USB SSD instant activity
  • Data Security: Solid state drives S.M.A.R.T. health diagnostics​ and adaptive TRIM optimizing data block management ensures consistent write speeds and extends the longevity of the portable SSD
  • USB-C & USB-A Cable: Both cables featuring rapid USB 3.2 Gen2, this USB SSD effortlessly bridges devices, enabling seamless cross-platform file transfers and backup between computers, smartphones, tablets and iPhone
  • Always Fast: No slowdowns for large file transfers. With SLC caching (25% of current available capacity allocated as high-speed cache), this external SSD delivers steady 10Gbps for transfers within the cache capacity

Restore databases with application-aware procedures

Restore a database dump or physical backup using the database’s supported tools, matching the engine version and required extensions. Do not blindly copy live database files from a mounted production disk into a running database. Check users, permissions, replication state, migration level and application connection settings before allowing traffic.

Restore files and services in a controlled order

  1. Provision or attach the recovery volume and record its device, filesystem and mount options.
  2. Restore system configuration and secrets with correct ownership and restrictive permissions.
  3. Restore the database and verify integrity before starting dependent application services.
  4. Restore uploads, generated assets and queues according to their application semantics.
  5. Start services in dependency order, inspect logs, run health checks and test representative user actions.
  6. Only then redirect traffic or replace the damaged instance. Keep the original available until the recovery is accepted.

Build a backup plan that can actually be restored

Ubuntu’s server guidance says a backup plan must define what is backed up, how often it runs, where copies are stored and how they are restored. It also recommends keeping important backup media off-site in case of disaster. A practical plan maps each data class to a method:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Configuration: version /etc and deployment files; Ubuntu identifies etckeeper as a tool for tracking /etc.
  • Databases: schedule application-aware dumps or engine-native backups, then test restoring them into an isolated instance.
  • Files and volumes: use incremental networked backups such as Bacula or periodic local or remote SSH snapshots such as rsnapshot where they fit your operating model.
  • Infrastructure: retain provider snapshots or images for rapid rebuilds, while keeping an independent copy for provider-wide or account-level failures.
  • Off-site copy: keep at least one copy outside the VPS host and protect it from the same credentials and failure domain.

An external hard drive can serve as removable, off-site media when it is encrypted, labeled, rotated and periodically checked. A backup job that has never been restored is an assumption, not a recovery capability.

A complete incident runbook

Use this sequence when the cause is not obvious:

  1. Contain: stop deployments and scheduled jobs; keep the server reachable for evidence collection.
  2. Capture: save logs, command history, service status, package versions, Git status and the current time.
  3. Classify: decide whether the fault is a tracked file, commit, package transaction, package availability problem, application data problem or system-wide failure.
  4. Protect: take a fresh backup or provider volume snapshot if reads are safe. Preserve the original before destructive operations.
  5. Select: use Git revert for a published code change, Git restore for selected paths, reset only for a private branch, APT history for a supported transaction, an archive snapshot for package availability, or a full restore for broad damage.
  6. Stage: perform the recovery on a branch, separate volume or replacement instance whenever practical.
  7. Verify: validate syntax, dependencies, database integrity, service health, logs, authentication and a representative application workflow.
  8. Release: redirect traffic or resume jobs only after the checks pass. Record the exact target commit, transaction ID, snapshot ID or backup timestamp.
  9. Prevent recurrence: document the trigger, add a pre-deployment check, improve backup coverage or pin a compatible package until a supported fix is available.

Common failure modes and safer responses

“The Git revert succeeded, but the site is still broken”

The failure may be outside Git: a package, environment variable, database migration, cache, queue or generated asset can remain changed. Compare the deployed commit with package and data timelines, then recover the affected layer rather than reverting unrelated code again.

“APT says the transaction cannot be undone”

Confirm the command exists on the installed APT version, inspect the transaction details and check repository availability. If a required version is no longer in the current repository, use a supported archive snapshot or a tested package source. Resolve dependency conflicts deliberately; do not force removal of shared libraries merely to make the command complete.

“The older package starts but data is incompatible”

Stop the service, preserve the current data directory, and restore a database backup or use the vendor’s downgrade path. Package rollback alone cannot reverse a schema migration or data transformation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

“The provider snapshot restored the disk but the application is inconsistent”

Check whether the snapshot was crash-consistent, whether database writes were in flight, and whether external services or object storage were included. Restore application data from its own backup and replay or discard queues according to the application’s documented procedure.

“A hard reset removed work”

Stop writing to the repository and inspect reflog references such as git reflog. Recovery may be possible if objects have not been pruned, but uncommitted changes that were never recorded may not be recoverable. This is why a safety branch and a clean working tree are prerequisites for destructive reset modes.

What to remember

  • Use the smallest tool that covers the damaged layer: Git for tracked changes, APT history for a supported package transaction, snapshots for package availability, and backups for data or whole-system state.
  • A Git revert preserves published history by adding a reversal commit; a hard reset rewrites the branch and can overwrite tracked files.
  • APT history management depends on the release and APT version; Ubuntu documents the interface as added in 25.10.
  • Ubuntu archive snapshots use UTC IDs and can expose older packages, but older packages may lack current security fixes.
  • Neither a package rollback nor a Git operation restores arbitrary databases and application data. Those require application-aware backups and a tested restore process.
  • Keep redundant copies with at least one off-site, and preserve the damaged system until the replacement has passed verification.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.