LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Dedicated Server with Linux CentOS corruption (https://www.linuxquestions.org/questions/linux-newbie-8/dedicated-server-with-linux-centos-corruption-4175484430/)

alanps 11-13-2013 07:15 AM

Dedicated Server with Linux CentOS corruption
 
Hello everybody, I'll try to make this as simple as I can, but please be pacient with me, I never used Linux before and everything I know so far it's from Google's search and personal experience with the famous "trial and error".

Last week I was experiencing some issues with MySQL server and one of my dedicated server's hard disk partition. The main partition (where I have MySQL and Linux OS installed) was full, and I tried to free space moving some folders to another partition.

Because of my luck, and negligence, I move the folder "sbin" with another folders (can't remember the name of them) to the "home" partition. For my surprise, when I finished, I tried to access through SSH to my dedicated server (using PuTTY) and when I enter the root password, it says "wrong password". So I freaked out. I restarted the dedicated server, and I receive this error:
http://img18.imageshack.us/img18/781/bs3l.png

I immediately contacted the company that gives me the server but they told me the only thing they can do is restore the server and, of course, format (erase) everything on it.
I really freaked out x1000000, because I use it for work purposes and I didn't make a backup, because I started using it a few weeks ago.

Anyway, this people won't help me to solve my problems, but I started to think a few things about this:

1. Is there any way to format just ONE partition (the server has THREE), install Linux OS in that partition and then fix the issue in the partition where Linux OS corrupted is installed?
#### IN CASE IT IS POSSIBLE ####
How can I do this? Is like Windows like booting a CD and everything else? Can I do this with an external hard disk through USB?

2. Another ideas? Like solving this OS issue without formating and that stuff.

------

As I said, I'm using this server for work purposes and I have tons of clients' files in there, I can't afford such a loss like that, and I refuse to accept that it's the only "possible solution" to format an entire hard disk.

------

LAST ERROR I RECEIVE WHEN INITIATING SERVER:
http://img802.imageshack.us/img802/1484/61r4.png

## SOME INFO ABOUT THE DEDICATED SERVER
Intel Xeon - Linux CentOS 6
Don't know if it has optical drives like CD-RW.
Don-t know if it has USB ports, I think it should.
I have physical access for a limited amount of time, because it's in a private datacenter.

______________________________


I really appreciate your time and help with this.
Thanks a lot.

Hope you can help me.


Bye bye,
Alan.

TenTenths 11-13-2013 10:05 AM

If you've physical access you should be able to boot from a suitable CentOS 6 DVD or USB and use the "rescue" mode, that'll at least let you mount the partitions and give you some form of access to the data. I'd strongly suggest getting the data off onto USB key / hard disk at that point.

Once you're happy that you have the data you want and can access it on another device such as a laptop etc. I'd then suggest having the OS re-installed from scratch.

Ask your hosting company for the specs of the machine, they should advise if there's any optical drives attached. As for USB, I've not seen a server in years that doesn't have at least two.

alanps 11-13-2013 10:10 AM

Quote:

Originally Posted by TenTenths (Post 5063732)
If you've physical access you should be able to boot from a suitable CentOS 6 DVD or USB and use the "rescue" mode, that'll at least let you mount the partitions and give you some form of access to the data. I'd strongly suggest getting the data off onto USB key / hard disk at that point.

Once you're happy that you have the data you want and can access it on another device such as a laptop etc. I'd then suggest having the OS re-installed from scratch.

Ask your hosting company for the specs of the machine, they should advise if there's any optical drives attached. As for USB, I've not seen a server in years that doesn't have at least two.

Thanks a lot for your quick reply.

So if I boot the CentOS DVD, I should be able to access the partitions in "rescue" mode?
Even if the OS is corrupted in the server?

Can I simply boot the rescue mode and move the folders I originally moved out of the root?

TenTenths 11-13-2013 10:24 AM

Quote:

Originally Posted by alanps (Post 5063734)
So if I boot the CentOS DVD, I should be able to access the partitions in "rescue" mode?
Even if the OS is corrupted in the server?

Yes, Rescue Mode boots the OS off the DVD then scans the server for partitions and mounts them in a folder which you can then chroot to and it'll look just like your server.

Quote:

Originally Posted by alanps (Post 5063734)
Can I simply boot the rescue mode and move the folders I originally moved out of the root?

Once you've access to your data via any method then TAKE A BACKUP!!!!! :) :) Then TAKE ANOTHER BACKUP!!!!

Then once you're happy you have the data on some medium you can access then yeah, you can move folders back and then try rebooting the server and cross your fingers :)

alanps 11-13-2013 11:44 AM

Quote:

Originally Posted by TenTenths (Post 5063744)
Yes, Rescue Mode boots the OS off the DVD then scans the server for partitions and mounts them in a folder which you can then chroot to and it'll look just like your server.

Once you've access to your data via any method then TAKE A BACKUP!!!!! :) :) Then TAKE ANOTHER BACKUP!!!!

Then once you're happy you have the data on some medium you can access then yeah, you can move folders back and then try rebooting the server and cross your fingers :)

Oh man you are giving me a lot of hope, you are like me God, Jesus, the Holly Mary and the Twelve Apostles, all together!!!!!!

One last question, you mentioned "..mounts them in a folder which you can then chroot to and it'll look just like your server."
What means "you can then chroot to"?

Thanks a lot for your help, it really helps me, a lot!

Thanks again!

TenTenths 11-13-2013 12:35 PM

Dedicated Server with Linux CentOS corruption
 
at its simpest chroot fakes out the OS to think that the given folder is /

it's kinda easier to see it in action than explain on my phone

chrism01 11-15-2013 04:19 AM

when you boot off the Rescue DVD, the root '/' is naturally on the DVD, but you can (IF the HDD root is ok!) 'chroot' aka 'change root' to the one on the HDD.
Don't do this if the HDD root is corrupt; its pointless.
The Rescue DVD mounts the HDD partitions as just data partitions, so you can work with them using the programs/tools on the DVD.

HTH


All times are GMT -5. The time now is 07:54 PM.