I have typed the following command.

cd /var/www/html/dev.sportsdirect.bg
rm -r /*

Then i notcied that the home folder and many others are deleted. How can i restore that. Right now i have working SSH connection to the server and all files under /var/www/html/ are not deleted for my luck.

Whatever command i type i get this error:

bash: /usr/bin/sudo: No such file or directory

Can you please tell me how can i restore my system ?

Thanks in advance!

  • Be careful when you use rm. For future reference, you should have used ./* or just * to delete the contents of the current directory instead of /* because / is the top level directory and ./ is the current directory. – mchid Nov 3 '15 at 15:34

Quite honestly - reinstallation will be probably your easiest and quickest option. You can do that without re-formatting partitions, which may prevent your current data (or what's left of it)

For the beginning anyway use LiveCD maybe and backup whatever's left from your important stuff.

You can try recovery mode and run some actions, maybe apt-get reinstall will help you - but if you're not really sure what's been exactly removed, that may not be your easiest solution.

  • What is this LiveCD and how can i backup all files under /var/www/ and how can i backup all my mysql databases ? – Venelin Vasilev Nov 3 '15 at 9:09
  • That may help for LiveCD: help.ubuntu.com/community/LiveCD. It refers to the older version, but generally it's the same story. Basically you have to prepare a new Ubuntu CD (or actually USB, whichever you prefer) - and start it in live mode, without reinstalling the system. – Jacek Nov 3 '15 at 9:14
  • As for backup - well... tar/gzip may help you. For MySQL - the best would be to get familiar with this database a bit, but anyway - for start backup of your databases files (/var/lib/mysql I guess?) with tar/gzip should be enough - just make sure you either stop the database or apply read lock - to make sure your backup is consistent. (if your mysql installation is still fine after all that removal - you can use mysqldump - but I guess that in your situation archiving of the db directory will be a better solution) - just make sure you back it up to some safe location. – Jacek Nov 3 '15 at 9:17
  • I got this error: error: file 'grub/e386-pc/normal.mod' not found. Entering rescue mode... What i have to do from here ? – Venelin Vasilev Nov 3 '15 at 9:28
  • Again, use rather LiveCD - boot your system from it and do your backups and then reinstall. And quite honestly - no offence - if you're not sure what to do with it, leave it to someone who knows the stuff. Otherwise you will probably spend a good while trying to fix it and you still risk more data loss. – Jacek Nov 3 '15 at 9:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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