2

I ran (stupidly) these commands:

mv ncdu/ /home/*
mv ncdu/ /var/*

Trying to move the ncdu folder into these directories. And it caused me to remove all my Apache directories in my /home/ folder, except virtfs (cPanel).

As you can imagine, It's knocked out my websites and various other functionily.

I've noticed that /virtfs/ still have all the files of the websites.

How do I restore the /home directory to how it should be? Is there a cPanel script I can run or do I have to create hardlinks manually?

I've also noticed that the var/yp directory has a lot of the var directories you would expect, can i restore from that?

HopelessN00b
  • 53,385
  • 32
  • 133
  • 208
Moe
  • 167
  • 1
  • 1
  • 8
  • 3
    The easiest way would be to restore from backups. You do have those, right? – Nathan C Nov 24 '14 at 14:37
  • All you did was `mv`? Why not just move them back? Who was the owner of the directories? If apache, you could use a find command to help you figure out where they all went. `find / -type d -user apache`. I don't know much about cPanel. Maybe it's another user. – Aaron Copley Nov 24 '14 at 15:22

1 Answers1

3

I'd expect that command to leave you with a single folder under /home (the last one in dictionary order) with all of the other folders that were under /home (and ncdu) directly under there. Ah - that's what's happened - virtfs happens to be the last folder.

Try going to /home/virtfs and just mv the folders back to their original location.

Suggested commands below. You'll want to choose which folders to move rather than just using * since you don't want to move the stuff that was originally under /home/virtfs.

cd /home/virtfs
mv a b c d ..

Same goes for /var. Just change to /var/yp and mv the stuff that ended up there back up one level.

Paul Haldane
  • 4,457
  • 1
  • 20
  • 31
  • Thanks, I'm giving it a go now, my SSH was working up until a moment ago and now it's been cut off. Could this be a result of the /var movements? – Moe Nov 24 '14 at 15:34
  • @Moe - almost certainly provoked by the sud-directories of /var disappearing. I'd expect a lot of stuff to continue OK whilst it has the files open (syslog for example should be OK in the short term) but some other stuff (mail?) is likely to be upset/confused. – Paul Haldane Nov 24 '14 at 15:44
  • Woohoo, I Got it functioning! My heart sank when I realized what I had done. Thank you :) – Moe Nov 24 '14 at 15:55