Let's start with saying that I'm a very inexperienced not-so-poweruser. Last night I was trying to move every file in a directory to another location, but accidentally did this:
mv stuff /* /home/user/Downloads
I was connected to the remote VM through SSH, and from that command onward, everything started crashing and burning. No command on the terminal would be recognised, not ls, not cd, nothing, and the left part of the console, which usually stated something like
Dimitris#>_
Had turned to just
#>_
I restarted the machine and now it boots me into
grub rescue>_
I tried ls
, I've got three hd()
s:
hd(0), hd(0,msdos1), fd(0)
- First one has an unrecognized filesystem (possibly the normal hd that I messed up since I moved everything to /home/user/Downloads)
- Second one has some directories:
- Third one's first sector cannot be read.
Anything I can do to revert the last change, or anything? Or is it a fatal messup?
I'm fine with just destroying the VM and creating again, but I'd rather not lose my /var/www/ directory.
Basically, since you moved all files required for boot (for instance...
/boot
), your current machine is in no state for boot. However, others are.You may be able to restore your machine's previous state since you know what was done. Configure your VM to boot on a Ubuntu Live ISO, select Try Ubuntu and manually mount your "messed up" partitions :
If you want to get more information about your partitions, type
sudo fdisk -l
. This will give you the virtual drive's partition scheme. Try to recognise your partitions according to their filesystems and sizes. In most usual cases, the/
partition is a largeext4
partition. If your/home
shares the same partition as/
, then remove it from the commands below.From there, try to revert your changes in
/mount/old
and/mount/old/home
, thenumount
them, and reboot on the virtual drive. Beforeumount
-ing, you can also go to/mount/old/var/www
or/mount/old/home/user/Downloads/var/www
to get your data back.This seems like the most obvious solution, yet I don't know if GRUB's configuration will be able to handle the recent changes. You can still give it a try!
I think the Ubuntu on your VM is useless, and better you install again the Ubuntu. But, before you do that, you can read the Hard Disk of your VM in another way.
Here link to how to do it, and see your files.
"Or you could create an entirely new Window VM and add the vmdk as a second disk to it."
I think the folder you looking for: /var/www/ it somewere on /home/user/Downloads
I just had simmilar issue! I was able to fix it. I am on Ubuntu 16.04 LTS.
What I did was:
sudo mv / /opt
while I was in /Downloads dir. But it worked as moving all my root folders to /opt/*, with some exceptions because of the files were busy etc.Immediately afterwards I started experiencing glitches in the UI and in cmd, like
>ls
'ls' comand is not defined
etc.What helped was to boot from new Ubuntu USB stick, select
try Ubuntu w/o isntallation
, go to terminal, then/media/<YOUR_HARD_DRIVE_ID>
and then smth likesudo mv /media/<YOUR_HARD_DRIVE_ID>/opt/* /media/<YOUR_HARD_DRIVE_ID>/
Hope that helps