Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Alright, so I was in /var/www/forum/newrelease What I wanted to do was copy all of the files in newrelease to the directory forum, so I was thinking the command mv /* ../* would work, but now everything is gone. Any ideas how to get the files back?


So it seems the files got moved to the /root directory, but I'm not sure how to cleanly get them all back.

share|improve this question
This is the perfect reason why you should have sudo and not root access, as (hopefully) your sudoers file would protect you against yourself. What got moved? Did the entire filesystem from / get moved into /root? This sounds a little odd based on what you stated as your current directory when you ran the command, and what the command was. Just FYI, what you probably should have done is mv ./* ../ – sandroid Oct 24 '11 at 13:47
4 folders, /dev /proc /sys /var . – kelton52 Oct 24 '11 at 13:52
Hang on... is this in /root (as in the root user's home directory) or in / root (as in the root of the FS)? Maybe it's because I've never broken a system this way, but I don't see how these would have been recreated in root. Seems to me like you tried moving stuff and the three pseudo-filesystems and /var (because you were in it) couldn't be moved. What does ls -al /var/www/forum/ say? – sandroid Oct 24 '11 at 14:00
It all moved into the root users directory. I'll check that command, but the only thing in var is lock and init – kelton52 Oct 24 '11 at 14:07
no such file or directory – kelton52 Oct 24 '11 at 14:10
up vote 8 down vote accepted

Your command

mv /* ../*

has moved the entire filesystem (/) into /var/www/forum (../).

You can try the reverse, i.e. move to /var/www/forum and run

mv ./* /

but you may as well accept that it is fatally broken.

Restore from backups.

share|improve this answer
lol, no backups. actually everything(well everything that could be moved) moved to the root users directory. – kelton52 Oct 24 '11 at 14:06
I've been running linux servers forever and have never broken anything beyond repair, so I wasn't too concerned about it. – kelton52 Oct 24 '11 at 14:09
Then the command you showed was not the command you ran. – adaptr Oct 24 '11 at 14:09
Well it looks like everything got moved to /var/www/forum and then var proc sys and dev got moved to /root – kelton52 Oct 24 '11 at 14:16
@kelton52 You have now learned a VERY important (and possibly professionally costly) lesson about the importance of backups. As adaptr said your system is quite possibly FUBAR'd at this point (even unwinding it as they described you're going to leave cruft and breakage). Next time (A) be more careful, and (B) Have KNOWN GOOD VERIFIED BACKUPS. – voretaq7 Oct 24 '11 at 20:57

Just so you fully understand what must have happened, if you ran mv /* ../* from /var/www/forum/newrelease/:

You moved

  • everything in / (/*)
  • everything in /var/www/forum/ (../*) except for the alphabetically last subdirectory of /var/www/forum/

into the alphabetically last subdirectory of /var/www/forum/.

Try echo mv /* ../* anywhere to help visualize this.

Now, judging by the other comments you made, it appears you already shuffled stuff around further. Since the mv you ran is unlikely to really destroy any data, you should be able to move stuff back in place. If you have no statically linked rescue shell like busybox available, you'll have to boot into a rescue system.

From there you should be able to locate sbin/, bin/, usr/, lib/ etc. If you manage to put these back into / your system should be bootable again.

Think before taking further steps, it seems your recovery attempts so far only worsened the situation.

share|improve this answer

Your Answer


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.