Perform FSCK on virtual server in Recovery Mode
Added: 03.08.2016 13:41:31 Last updated: 16.01.2017 22:15:48
In this guide we will go through how you can start the virtual server in «Recovery mode», and then run FSCK on the server's hard drive(s).
The guide only applies for Linux based virtual servers. Commands used are written like this: «command», where «» is not included when command is actually used.
Because of various reasons, a file system can become corrupt, and if that happens you will have problems using the server like normal. To fix this, you can run FSCK on the hard drive(s) that has a corrupt file system.
You start by rebooting the virtual server into what is called «Recovery mode». Basically, the server is rebooted with an operating system that is loaded to the memory on the server, and you can access the server via «console» in the control panel or via SSH towards the server's IP address. When the server is started in «recovery mode», the hard drives will not be «mounted», which means that we can perform advanced operations on it that usually would not be possible.
- Go to «Virtual servers»
- Choose the actual server.
- Click on the «Tools» menu
- Click on «Reboot in Recovery»
Click «Yes» to confirm that the server should be rebooted into «Recovery mode».
- When the server has been restarted in «Recovery» you will see this in the overview of the server.
- To gain access to the server you can either use «Console» or SSH. Because of the text design in console, we are using SSH in this example. The procedure is the same independently of how you connect to the server.
- When you log in to a server that has been started in "Recovery" you must use «root» as username, and the password that was set on the server originally.
- As mentioned in the introduction, the disks are not mounted in «Recovery», so to see this you write «fdisk -l»
- Which hard drive «fsck» should be run on can be indentified from the size. In this example we know that the hard drive is 5GB, and it is therefore disk «/dev/xvdb1» it's about.
- To run «fsck» on the disk, you write: «fdisk -y /dev/xvdb1». In our example there are no flaws in the hard drive, and therefore limited information is being given. In case there is a fault on the hard drive, both the progression in the process and what should be corrected will be visible on the screen.
When you are done, you close «Console»/disconnect from SSH and restart the server.
We have now seen how to fix a corrupt file system by using «FSCK».