Find the answer to your Linux question:
Results 1 to 6 of 6
I am new to linux, and have only been using it for a month now. Today I issued the following command: mv /* /var/www because I was trying to move ...
  1. #1
    Just Joined!
    Join Date
    Dec 2009
    Posts
    3

    HELP!!!! I moved my entire root directory somewhere else!!!!

    I am new to linux, and have only been using it for a month now. Today I issued the following command: mv /* /var/www because I was trying to move all the files in the folder to the web root. I know now that I was supposed to add a period before /* to make it ./*.

    UGH! Is there any way to revert this? I can't even use simple commands like ls because it gives me the following error: bash: /bin/ls: No such file or directory

    I'm hoping I can at least recover my files! I absolutely HATE myself at this very moment. Any help would be greatly appreciated!!!

  2. #2
    Linux Guru Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    2,102
    you could try the following:
    1) boot a live CD such as Knoppix
    2) mount / and /var/www (the later only, if it is separate partition)
    3) cd to <MOUNTDIRECTORY_OF_YOUR_CHOICE>/var/ww
    4) mv everything, that is not supposed to be there to <MOUNTDIRECTORY_OF_YOUR_CHOICE>/
    5) unmount the two dirs again
    6) reboot from harddisc

    This should work.
    If not, save all important files. (aka config, homedirs, data like /var/www and possible the logs), then re-install.

  3. #3
    Just Joined!
    Join Date
    Dec 2009
    Posts
    3
    Quote Originally Posted by Irithori View Post
    you could try the following:
    1) boot a live CD such as Knoppix
    2) mount / and /var/www (the later only, if it is separate partition)
    3) cd to <MOUNTDIRECTORY_OF_YOUR_CHOICE>/var/ww
    4) mv everything, that is not supposed to be there to <MOUNTDIRECTORY_OF_YOUR_CHOICE>/
    5) unmount the two dirs again
    6) reboot from harddisc

    This should work.
    If not, save all important files. (aka config, homedirs, data like /var/www and possible the logs), then re-install.

    Hi Irithori,

    Thanks for the suggestions. It makes sense to me. However, do you have any pointers on how to do step 2? how do I mount the internal hard drive? Also, when I boot from a live CD will I have access to a working mv command? Right now it deosn't seem to work on my system.

  4. #4
    Linux Guru Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    2,102
    knoppix will offer you a fully working linux.
    including mv

    2a) sudo su -
    2b) fdisk -l
    2c) identify your root partition. you need the device name (like /dev/sda1)
    2d) mkdir /mnt/root
    2e) mount /dev/<YOURDEVICE> /mnt/root

    After you are finished with moving files around, unmount the partition
    unmount /mnt/root

  5. #5
    Just Joined!
    Join Date
    Dec 2009
    Posts
    3
    You are the best man! I followed your directions exactly and I'm back to normal. The only discrepancy was I had to use umount instead of unmount :P.

    Thanks again!

  6. #6
    Linux Guru Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    2,102
    welcome

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...