Skip to main content

How to recover from VPS filesystem corruption

Tutorial on how to recover from VPS filesystem corruption

Updated over a week ago

Sometimes, filesystem corruption can cause various VPS issues including Browser Terminal showing a blank screen, SSH connection failures, or websites becoming inaccessible. When your VPS filesystem becomes corrupted, you can use Hostinger's Emergency Mode and fsck (file system check) to detect and repair these issues.

Browser Terminal issues are often the first sign of filesystem corruption, as Browser Terminal provides direct access to your VPS through Hostinger's infrastructure. This guide will walk you through the complete filesystem recovery process using Emergency Mode.

Step 1 - Enable Emergency Mode and connect via SSH

Navigate to the VPS section of your hPanel and click on Manage next to your chosen server. Next, open the Settings page.

Once there, go to the Emergency mode tab and toggle Turn on Emergency mode.

Wait a few minutes for Emergency Mode to fully activate.

Once enabled, you will be able to connect to your VPS via SSH using the provided credentials.

ssh root@your-server-ip

Step 2 - Identify your main partition

Since the VPS is in Emergency Mode, you need to identify which disk is corrupted to be able to fix it.

In your SSH connection, run the following command:

lsblk

To identify where your original OS is stored. The result will show something like:

root@machine:/# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 63.4M 1 loop /snap/core20/1974
loop1 7:1 0 111.9M 1 loop /snap/lxd/24322
loop2 7:2 0 53.3M 1 loop /snap/snapd/19457
loop3 7:3 0 40.9M 1 loop /snap/snapd/20290
loop4 7:4 0 63.5M 1 loop /snap/core20/2015
sda 8:0 0 50G 0 disk
├─sda1 8:1 0 49.9G 0 part /mnt/sda1
├─sda14 8:14 0 4M 0 part
└─sda15 8:15 0 106M 0 part /mnt/sda15
sdb 8:16 0 2.2G 0 disk
├─sdb1 8:17 0 2.1G 0 part /
├─sdb14 8:30 0 4M 0 part
└─sdb15 8:31 0 106M 0 part
sr0 11:0 1 4M 0 from

The main partition can be identified as the largest in size. In the example above, the largest partition is sda1, designated with the mount point /mnt/sda1.

In Emergency Mode, your original (corrupted) system is automatically mounted under /mnt, while the current emergency environment runs from a separate partition.

Step 3 - Repair your VPS

Now you have identified your main partition, you can run the filesystem check command. Replace sda1 with your actual main partition:

fsck /dev/sda1

The output will show the reasons why your VPS was corrupted:

fsck from util-linux 2.37.2
e2fsck 1.46.5 (30-Dec-2021)
ext2fs_check_desc: Corrupt group descriptor: bad block for block bitmap
fsck.ext4: Group descriptors look bad... trying backup blocks...
cloudimg-rootfs: recovering journal
fsck.ext4: unable to set superblock flags on cloudimg-rootfs
cloudimg-rootfs: ***** FILE SYSTEM WAS MODIFIED *****
cloudimg-rootfs: ********** WARNING: Filesystem still has errors **********
Here, it shows that fsck successfully made some repairs (journal recovery, using backup group descriptors), but not all issues were fixed. The key line is:
**cloudimg-rootfs: ********** WARNING: Filesystem still has errors ************
This means the file system is still in a bad state.
To fix remaining errors, run:
fsck -f /dev/sda1

-f means that it will force a full check. You can use -fy if you want to auto-confirm all fixes automatically.

Step 4 - Exit Emergency Mode and restart your VPS

After repairing the file system on your main partition, return to your hPanel VPS settings and turn off Emergency Mode.

Once Emergency Mode is disabled, restart your VPS server. After restarting, your VPS should be fully operational with Browser Terminal access restored.

Troubleshooting

If Browser Terminal still shows a blank screen after following these steps:

  • Try running the repair command with automatic confirmation: fsck -fy /dev/sda1

  • Repeat the entire process to ensure all errors were addressed

  • If issues persist, we recommend backing up any recoverable data and recreating the server entirely or restoring your VPS from backups.

Note: This method works for filesystem corruption issues. For database recovery in Emergency Mode, refer to this guide: How to Recover MySQL Databases From MySQL Data Files in VPS.

Did this answer your question?