Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

In a subdir (/var/www/html/subdir) by error I run as root: mv /* .

It move ALL files under the working directory, commands as ls, mv, cat, not work, inclusive run by ./bin/ls. Keyboard and Mouse was not detected (I did work from ssh).

My OS is Centos 6.2 x86_64, I did restart and was unable boot, I tried with CD and rescue mode, but any linux partition was not found by the rescue.

The OS is installed in 3 DD SAS in RAID 0 (IBM Server).

Is possible rescue the information or the operating system?

share|improve this question

4 Answers 4

up vote 2 down vote accepted

You can simply boot a rescue system and move back all those folders.

share|improve this answer
    
I just used a VM to confirm that this is true. –  Iain Jul 25 '12 at 22:16
    
Is not easy, the live CD's or mount or many others options no detect any Linux Partitions. I don't know if the RAID 0 in 3 hard disk is related. –  Jose Nobile Jul 26 '12 at 1:29
    
RAID was damage (repair by IBM Phone server), and files restored with boot rescue system –  Jose Nobile Oct 7 '13 at 19:20

Rescuing the information is easy: It just got moved, not deleted. So you can boot from another medium (e.g. a liveCD) and you can access all the files. Possibly you already have an other copy in a up-to-date backup.

As for recovery, you have two options:

  1. Boot from something else (e.g. pen drive or liveCD) and try to manually move files back. This might work if they just got moved. If permissions got changed then things get interesting
  2. Reinstall the OS. Use your documentation to set the server up as it was originally done, then restore the data from backup.
share|improve this answer
    
Is not easy, the live CD's or mount or many others options no detect any Linux Partitions. I don't know if the RAID 0 in 3 hard disk is related. –  Jose Nobile Jul 26 '12 at 1:29

I was contacted by IBM support, and I can repair the RAID 0 (support by phone), I don't know why the RAID0 was damaged, but it failed after move the files.

The rescue mode for detect linux partitions do not work on LVM2 (not work for me).

I restore my system, following the next instructions:

lvm vgscan -v

Activate all volume groups:

lvm vgchange -a y

List logical volumes:

lvm lvs –all

With this information, and the volumes activated, you should be able to mount the volumes:

mount /dev/volumegroup/logicalvolume /mountpoint

next, I did move all files of my subdir to root (/), restart and all ok.

Source: http://jim-zimmerman.com/?p=587

share|improve this answer

What you just did is not moving everything under the working directory, but moving everything from the root directory somewhere else. I'm very much afraid you're done for if you want to reboot your system.

You can try to recover by moving everything, but I personally doubt this will fix everything. You're much safer with a clean install and restore from backup.

Normally it should find the partition, try a live disk like Ubuntu. Chances are you will be able to rescue some of the info.

However:

  • getting your info back shouldn't be a problem if you have proper backups
  • running a RAID 0 is asking for a disaster to happen
  • always think twice before you run something as root
share|improve this answer
    
I have Backup, but the install (./configure && make && ake install for apache, mysql, php and all dependencies) is a hard work. –  Jose Nobile Jul 26 '12 at 1:32
    
RAID0 because I have a good backup solution. –  Jose Nobile Jul 26 '12 at 1:32
    
always to use user root is a old vice that I must fix. –  Jose Nobile Jul 26 '12 at 1:34
    
It is a vice best broken with a new install. Otherwise you keep running into files with permissions set so only root can open or edit them. (Not that I am saying that you need to reinstall, just that it is easiest to do when you reinstall). –  Hennes Jul 26 '12 at 7:04
    
I agree with @Hennes –  Lucas Kauffman Jul 26 '12 at 7:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.