Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
01-23-2010, 12:22 PM
|
#1
|
LQ Newbie
Registered: Jan 2010
Posts: 3
Rep:
|
system files delete by typo, /bin/ gone. How to recover?
Hey guys,
I had some bad luck today when I was trying to fix an account that had trouble with FTP. I decided to remove the user and add him again and reset all configuration. Anyhow, to make things short, I accidently typed rm /* -R -f and without looking hit the enter button, as soon as I realised what I wrote I hit ctrl+c. Too bad the /bin/ folder was gone by this time and standard commands like ls didn't execute anymore.
My question is if there is any way to recover these files by a system repair or something? The server is used to host a heavy loaded site which can't afford any downtime, and silly me didn't make a backup of the whole HDD, just the important folders (not the system files).
Currently I don't have the balls to restart the server as I know this will probably turn into a dissaster. I also don't have straight access to this server since it is located in a datacenter (I can go there if absolutely necessary but I rather don't).
Anyone has some advice? I'd be glad to hear if there's a command to repair/redownload system files!
Kind regards,
Dennis Bronk.
P.S. sorry if the post is a little hard to read, I am dutch.
|
|
|
01-23-2010, 12:40 PM
|
#2
|
Moderator
Registered: May 2001
Posts: 29,415
|
What distribution+release? If it has proper and mature package management can you list or verify package contents to see which are affected?
|
|
|
01-23-2010, 01:34 PM
|
#3
|
LQ Newbie
Registered: Jan 2010
Posts: 3
Original Poster
Rep:
|
I am running CentOS 5.
Currently the situation has gotten worse, I was having dinner and when I returned my SSH connection was closed and WinSCP too. I can't connect to any of these anymore, the server just abrupetly closes the connection.
Websites are still up though.
Through some workarounds I can still have limited control over the server. I am running DirectAdmin which enables me to edit files, and I could also execute CGI scripts.
This is bad ...
edit:
I think this requires a reinstall of linux, I am waiting for a few hours until most customers won't order anything and I'll make a backup of MySQL database and the website, put it offline immediatly afterwards and temporarily host it on a Dell Poweredge R200 that I use for testing purposes.
If anyone has some advice though, or knows a solution I'd be glad to hear since I really don't want to go through this kind of trouble. I am probably able to run executables through scripts and have full control over configuration files, so I still have a little control.
Last edited by Dbronk; 01-23-2010 at 01:50 PM.
|
|
|
01-23-2010, 01:51 PM
|
#4
|
Moderator
Registered: May 2001
Posts: 29,415
|
Usually you would be able to list packages from the RPMDB that have items in /bin, but since 'rpm' resides in /bin as well you would need to copy /var/lib/rpm over to another machine to read it with something like 'rpm -qa --dump|awk '/^\/bin/ {print $1}'|xargs -iX rpm -qf 'X'|sort -u'. The resulting core packages should be a list like "ash bash coreutils cpio dbus ed filesystem (fuse) gawk gettext grep gzip initscripts iputils kbd keyutils mailx mktemp net-tools procps redhat-lsb rpm sed setserial SysVinit tar util-linux vim-minimal". Since /bin/rpm is gone you'll have to curl/wget these packages from the std repo to your staging/rescue Centos machine, unpack each with 'cd /tmp; rpm2cpio "${packagename}" | cpio -idmv', then copy the ./bin parts over to the victim system.
|
|
|
01-23-2010, 02:05 PM
|
#5
|
LQ Newbie
Registered: Jan 2010
Posts: 3
Original Poster
Rep:
|
Ok, that doesn't sound like a hard job. Somewhere on the internet I saw an advice on copy'ing /usr/bin to /bin/ as a backup replacement. But I can't imagine those folders are the same ....
I am lucky only my bin got deleted (atleast, that's what I hope, no other folders dissappeared but some files may have been deleted).
Such a small typo, such a great mess it caused heh. I currently don't have a backup linux distro running, but I'll get one up ASAP using dual boot and a spare harddisk I have for my own PC.
Meanwhile I'll get the important files and I'll try to find out if I can write to / using scripts. I think that's going to be a though one too. SFTP is not working anymore, though normal FTP is.
|
|
|
All times are GMT -5. The time now is 03:10 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|