LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-12-2013, 06:53 PM   #1
alei
LQ Newbie
 
Registered: Aug 2013
Posts: 12

Rep: Reputation: Disabled
Unhappy Possible lost of lib directory


Hello guys,
I executed this command on my vps CENTOS: mv clientesFirmas/* /*
(before I was on /var/www/vhosts/alhepsoft.com/httpdocs/aClinicaMedia/clientesFirmas)

and CENTOS said this:

mv: cannot move `/dev' to `/var/dev': Device or resource busy
mv: overwrite `/var/lib'? no
mv: overwrite `/var/opt'? no
mv: cannot move `/proc' to `/var/proc': Device or resource busy
mv: cannot move `/sys' to `/var/sys': Device or resource busy
mv: overwrite `/var/tmp'? no

now I cant do nothing (even I can't connect with ssh), I think is something like this:
http://sylvestre.ledru.info/blog/2006/09/19/title_29

but the trick /lib./ld-linux.so.2 --library-path /bin/ mv /lib. /lib/ doesnt work on CENTOS.
I want to recover the system (without loosing data). Any help?

Last edited by alei; 08-12-2013 at 06:54 PM.
 
Old 08-12-2013, 07:15 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Quote:
Originally Posted by alei View Post
Hello guys,
I executed this command on my vps CENTOS: mv clientesFirmas/* /*
(before I was on /var/www/vhosts/alhepsoft.com/httpdocs/aClinicaMedia/clientesFirmas)

and CENTOS said this:

mv: cannot move `/dev' to `/var/dev': Device or resource busy
mv: overwrite `/var/lib'? no
mv: overwrite `/var/opt'? no
mv: cannot move `/proc' to `/var/proc': Device or resource busy
mv: cannot move `/sys' to `/var/sys': Device or resource busy
mv: overwrite `/var/tmp'? no

now I cant do nothing (even I can't connect with ssh), I think is something like this:
http://sylvestre.ledru.info/blog/2006/09/19/title_29

but the trick /lib./ld-linux.so.2 --library-path /bin/ mv /lib. /lib/ doesnt work on CENTOS.
I want to recover the system (without loosing data). Any help?
From the messages, your command sequence was more likely something like:

Code:
cd /var

mv /* .
Or you were in the root directory and did this:

Code:
mv * /var
You likely have many more problems than the /lib directory.

It looks like you tried to move everything from root / into /var/. Some of those would have overwritten existing /var subdirectories, including the /var/lib directory. It would probably be very difficult to un-entangle the resulting mess, if that is indeed what happened.

[MORE THOUGHTS]

If the above is true, then you also would have moved the /etc and /home directories into /var, either of which would prevent ssh logins.

If /etc/ and/or /usr were moved to /var then the machine will never reboot either.

If you have physical access to the machine you might boot to CD/DVD/USB or other OS, mount the drive and attempt to move /var/etc, /var/usr, /var/home and copy /var/lib back to /.

If you do not have physical access then you are probably stuck and will have to rely on someone with physical access to sort it out - or reinstall the OS.

Last edited by astrogeek; 08-12-2013 at 07:44 PM.
 
1 members found this post helpful.
Old 08-12-2013, 07:57 PM   #3
alei
LQ Newbie
 
Registered: Aug 2013
Posts: 12

Original Poster
Rep: Reputation: Disabled
Unhappy

Hi @astrogeek,
The exact commands I executed are these:
cd /var/www/vhosts/alhepsoft.com/httpdocs/aClinicaMedia/clientesFirmas
and then
mv clientesFirmas/* /*

my purpose was to put the content of the folder clientesFirmas out of the folder.
now, I can't connect with ssh and neither with ftp
I take this screenshoot:

Click image for larger version

Name:	Screenshot from 2013-08-12 18:04:11.png
Views:	49
Size:	169.0 KB
ID:	13186
 
Old 08-12-2013, 08:10 PM   #4
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Quote:
Originally Posted by alei View Post
Hi @astrogeek,
The exact commands I executed are these:
cd /var/www/vhosts/alhepsoft.com/httpdocs/aClinicaMedia/clientesFirmas
and then
mv clientesFirmas/* /*

my purpose was to put the content of the folder clientesFirmas out of the folder.
now, I can't connect with ssh and neither with ftp
I take this screenshoot:

Attachment 13186
Thanks for the screenshot, but it really confirms that this is what has happened.

The command...

Code:
mv clientesFirmas/* /*
...[updated] tells it to move each clientasFirmas/* to every /* - effectively overwriting everything in root directory...

So I think it started doing that and at some point overwrote something that caused an indeterminate condition that resulted in the messages that you see there.

But whatever the case, it is clear from the screenshot that it did in fact make the moves and overwrote or moved everything in the / directory.

It only prompted you for /* directories which conflicted with existing /var/... paths, but it silently moved /etc, /usr, /root, /home, ... everything else, into /var, but probably only after other damage was done.

At this point I would think it was not recoverable. But it would certainly require access to the drive(s) to find out what is left.

Last edited by astrogeek; 08-12-2013 at 08:43 PM. Reason: Additional thoughts...
 
1 members found this post helpful.
Old 08-12-2013, 10:26 PM   #5
alei
LQ Newbie
 
Registered: Aug 2013
Posts: 12

Original Poster
Rep: Reputation: Disabled
Thanks sir, I'm new at CENTOS, but really do you think I losed all?
Before I loosed the ssh connection, I will cd to some of the directories (I think that only to the /var directory)

Anyway, I'm very pleased for your help. How could I give you some kudos?
 
Old 08-12-2013, 11:12 PM   #6
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Quote:
Originally Posted by alei View Post
Thanks sir, I'm new at CENTOS, but really do you think I losed all?
Before I loosed the ssh connection, I will cd to some of the directories (I think that only to the /var directory)

Anyway, I'm very pleased for your help. How could I give you some kudos?

I do think that probably the system is not bootable, and you have probably lost a lot, sorry.

I think the machine will not be bootable because the /bin directory appears to be gone.

Do you still have the ssh connection? I thought that you had already lost that.

If you still have it I would keep it open and active for as long as possible.

So, if you still have the ssh connection, let's assume that /bin was moved to /var/bin. In that case, try this and see if it works:

Code:
/var/bin/ls /

and

/var/bin/ls /var
Post back here what that says, even if it is an error message.

Thanks for your kudos, sorry I was not more help. If it was helpful please click the "Did you find this post helpful?" link in my replies.

Last edited by astrogeek; 08-12-2013 at 11:13 PM.
 
1 members found this post helpful.
Old 08-12-2013, 11:26 PM   #7
alei
LQ Newbie
 
Registered: Aug 2013
Posts: 12

Original Poster
Rep: Reputation: Disabled
Unhappy

Hello Sir,
Actually, now I don`t have access to ssh, but before I loosed the ssh connection (and after I executed the mv command) I was able to access to /var. I only want my MySQL data, witch I think is in /var/lib or somewhere inside the /var directory.

I talked to my vps provider, and they recommended me to purchase a ftp-backup, then reinstall CENTOS, and then expect to recover a part of my data from the ftp-backup.
What do you think about it?


Thanks again Sir, you were very helpful.
I will post back if I have good or bad news (hope they will be good.I'm really afraid, I have important information on that server :-( )
 
Old 08-12-2013, 11:41 PM   #8
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
If you your data was valuable then I would think that getting the backup would be important.

It depends a little on what they define as "ftp-backup", but hopefully that would include your data and uploaded files. If it is an actual snapshot of the disk or at least everything mounted on root /, then you will have your best chance of recovering a good bit of it.

Can you find out what is included in their ftp-backup?

May I ask who the host company is? If it was a dedicated server would it be possible for you to buy the hard drive from them? Just an idea.

Alternatively, if you could get another account and have them mount the old drive so that you could access it via ssh. That would depend on the cooperation of the host company too.

I'll add some comments in a separate post of what likely happened and what you might expect to recover...
 
1 members found this post helpful.
Old 08-12-2013, 11:57 PM   #9
alei
LQ Newbie
 
Registered: Aug 2013
Posts: 12

Original Poster
Rep: Reputation: Disabled
Unhappy

The host server is godaddy.
I have not a dedicated server but a Virtual Private Server
I'm not sure but I think that your second idea about mounting the old hard drive to another machine is in part very similar to the ftp-backup, with the difference that they copy the content of the drive to another server.

Thanks again for your interest and your great ideas.
 
Old 08-13-2013, 12:26 AM   #10
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
I have thought a lot about this through the evening hoping to understand exactly what might have happened and how to recover from it. Here are the highlights

First, what happened...

You were in /var/www/vhosts/alhepsoft.com/httpdocs/aClinicaMedia/clientesFirmas/ which appears to have had a subdirectory of the same name, clientesfirmas/.

Form there you issued the command

Code:
mv clientesFirmas/* /*
I am not sure what the intended destination was as this woild have moved all the files (not the directory) into the root / directory if it had been mv clientesFirmas/* /. instead.

But the actual effect was that it began to replace everything in / with each file from /var/www/vhosts/alhepsoft.com/httpdocs/aClinicaMedia/clientesFirmas/clientesFirmas/ - definitely not what you wanted...

The order would be indeterminate, but if we assume that it took things in alphabetical order, it would have done something like this:

Code:
bin/ - Would have been replaced with the first file from clientesFirmas/
boot/ - Same thing, replaced with a file...
dev/ - At this point, if successful, many things begin to go wrong...
etc/ - Either overwritten, or possibly moved to /var if it had lost it's way at this point
home/ - Either overwritten, or possibly moved to /var if it had lost it's way at this point
lib/ - It had definitely lost its way by this point because you were prompted for the move
lost+found/ - Moved to /var if it exists at all
media/ - Moved to /var if it existed
mnt/ - Moved to /var if it existed
opt/ - You were prompted for this one
proc/ - You were prompted for this one
root/ - Moved to /var
sbin/ - Moved to /var
srv/ - Moved to /var
sys/ - You were prompted for this one
tmp/ - You were prompted for this one
usr/ - Moved to /var
var/ - Prompted and cannot be moved to itself anyway
Now, I have done some experiments locally using * as the target of a move, and had some surprising results. My systems are all Slackware so it could be different on CentOS, but here is what I found...
Code:
mv adir/afile ./*
results in the removal of all the destination targets instead of their replacement.

If that worked the same on your system, then it probably removed your /bin, /boot /etc and /home directories, by which time it was lost and moving things into /var

Now, what might be left?

That is hard to say without access to the hard drive.

With regard to your data itself - you might actually be very lucky if it all existed in the /var directory.

The first move of a file probably corrupted the system, so it "might" have never gotten around to the second file in clientesFirmas. In that case, your data may still be in the /var subdirectory.

Same for your MySQL data. It typically resides in /var/mysql/data/... so if /var itself was not corrupted it could still be largely intact.

But in the end, you will need physical access to the drive or a snapshot to find out what is there.

Best of luck, sorry to be the bearer of such bad news.

Last edited by astrogeek; 08-13-2013 at 12:29 AM.
 
1 members found this post helpful.
Old 08-13-2013, 07:01 AM   #11
alei
LQ Newbie
 
Registered: Aug 2013
Posts: 12

Original Poster
Rep: Reputation: Disabled
Unhappy

I'm sure all my data is on /var (MySQL data and even the directories in witch I'm interested)
So I think I just need a snapshot, the server that I purchased is virtual, i.e. CENTOS is virtualized over another OS (I think they use plesk for virtualize).
As long as I know, when you virtualize an OS over another, all the data is stored in only one directory.

As I tell you, I purchased the ftp-backup with the hope of get that snapshot, but I'm not sure about it, in godaddy's web page http://support.godaddy.com/help/arti...-is-ftp-backup
they define the ftp-backup as this:

"Our FTP Backup feature provides reliable, remote backup for the important data on your dedicated server. This type of backup is self-managed. We provide you with a secure FTP server and login and you decide when, what, and how you back up your data."

but I never was using this feature before, so I don't know if this feature could be helpful (I just purchased it because the godaddys assistant recommended me it).

By the other hand, godaddy is taking a lot of time activating the ftp-backups, I don't know why.
Maybe because the OS is corrupted?

Thanks again for all your effort @astrogeek. I'm pleased to talk with people like you.
I'll be in touch if I have some news.
 
Old 08-13-2013, 10:29 AM   #12
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by astrogeek View Post
You were in /var/www/vhosts/alhepsoft.com/httpdocs/aClinicaMedia/clientesFirmas/ which appears to have had a subdirectory of the same name, clientesfirmas/.

Form there you issued the command

Code:
mv clientesFirmas/* /*
I am not sure what the intended destination was as this woild have moved all the files (not the directory) into the root / directory if it had been mv clientesFirmas/* /. instead.
What happened was that the shell expanded those asterisks into a long list of arguments to the mv command. The last argument in that list was "/var", and since that is a directory it was taken as the destination for the move. The result is that everything under clientesFirmas/ and everything in the root directory (with the exception of those items that caused an error and could not be moved) got moved to /var. If you look there, you should see things like /var/boot, /var/bin/, /var/etc, ... . It is, at least in principle, possible to move those back into the root directory where they belong. You would of course have to boot from a rescue disk and work very carefully, but you should be able to get everything back.
 
1 members found this post helpful.
Old 08-13-2013, 04:26 PM   #13
alei
LQ Newbie
 
Registered: Aug 2013
Posts: 12

Original Poster
Rep: Reputation: Disabled
Lightbulb

Thks for your response @rknichols,
Now I strongly belive that I can get everything back.
Currently I'm coordinating with my vps provider.
They are going to copy all the current data of my server to a ftp-backup server (I think they are going to take care of the rescue drive, and everything needed for do that stuff).

If I have some troubles with it, I will be in contact again.
Best regards.
 
Old 08-14-2013, 11:36 AM   #14
alei
LQ Newbie
 
Registered: Aug 2013
Posts: 12

Original Poster
Rep: Reputation: Disabled
Smile Problem solved!

Thanks @astrogeek, @rknichols.
With your help I was able to restore all my data from the ftp-backup. Only the OS files were corrupted.
 
Old 08-14-2013, 01:39 PM   #15
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Quote:
Originally Posted by alei View Post
Thanks @astrogeek, @rknichols.
With your help I was able to restore all my data from the ftp-backup. Only the OS files were corrupted.
Excellent!

You are very welcome!

By the way - welcome to LQ - the hard way!
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
/lib directory deleted kalaiap Linux - Newbie 1 08-07-2008 01:07 AM
/lib/modules/kernel-2.6.19.2 -- lost deadlinx Linux - Kernel 8 03-27-2007 12:24 PM
HELP! Need FTP client after /usr/lib lost sixerjman Linux - Software 5 12-12-2005 06:04 PM
Need Lost lib file, please JuJuJane Linux - Software 2 10-10-2005 07:11 PM
Lost /usr/lib wapcaplet Mandriva 2 02-17-2004 11:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration