Tuesday, 18 December 2012

Using Ramshell to reboot servers

In a case where a server is not up after a server reboot, it is likely that the server is undergoing automatic fsck. One more reason for server not coming up is that, the automatic fsck failed and the server needs a manual fsck. In these cases, the server filesystem will not be mounted and so no service will be up on the server. Because of this reason, we cannot ssh into the server and do manual fsck. Ramshell becomes hand in these cases.

What is ramshell?
 
Ramshell works with a lightweight ssh server like OpenSSH. 
It needs only few libraries to get started and hence can be started as a standalone 
service even before the filesystems are mounted. Ramshell works on port 63579

How do you connect to ramshell?


ssh -l root -p 63579 server_IP

You will get a shell similar to ssh shell.

How do you fsck a server that is currently down?
 
When the slash partition is corrupted and need fsck, the server enters into 
recovery mode. In this case we need to run fsck on the / partition. 
You can type the following command to find the which is / partition.
Type /sbin/fdisk -l to see the partitions present. The  
df -h command will not work, as the partitions are not mounted.
Eg
root@manoj [~]# /sbin/e2label /dev/sda6
/
Just to make sure the partitions are not mounted, touch a file in / partition. It should return "read only".
How to fsck the partition?
e2fsck -y /dev/sda6 
 
Note:  Here I described only a basic idea of RamShell, 
you need to install and configure Ramshell during the server setup inorder to make 
Ramshell available.

4 comments:

  1. Very new thing to learn and as you told that these are the basics, so can we get more stuffs to study about Ramshell. BTW, great job.

    ReplyDelete
    Replies
    1. Thanks Arun..I will be adding more on this..Keep reading the blog... more to come...

      Delete
  2. Hmmm gud gng bro...keep it up ....keep blogging !!!!!!

    ReplyDelete

Note: only a member of this blog may post a comment.