1

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?

update

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

Kelly Elton
  • 240
  • 2
  • 13
  • 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 . – Kelly Elton 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 – Kelly Elton Oct 24 '11 at 14:07
  • no such file or directory – Kelly Elton Oct 24 '11 at 14:10

2 Answers2

8

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.

adaptr
  • 16,479
  • 21
  • 33
  • lol, no backups. actually everything(well everything that could be moved) moved to the root users directory. – Kelly Elton Oct 24 '11 at 14:06
  • 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 – Kelly Elton Oct 24 '11 at 14:16
  • 2
    @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
4

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.

al.
  • 915
  • 6
  • 17