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


Had turned to just


I restarted the machine and now it boots me into

grub rescue>_

first pic

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: second pic
  • 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.

  • 1
    Could you tell use about your partitioning scheme ? Was /home on a separate partition? – John WH Smith Jun 22 '14 at 12:47
  • I'd wager it was on the same, I remember only having access to one partition when everything was working fine. Is there any way I can check for you, from here? – Dimitris Sfounis Jun 22 '14 at 12:53
  • I added a complement about this in my answer. – John WH Smith Jun 22 '14 at 12:56

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 :

# Create mount points (home only if necessary).
sudo mkdir /mount/old /mount/old/home

# Mount the former / partition on /mount/old.
sudo mount /mount/old /dev/sdaX # sdaX being your destroyed / partition.

# Mount the former /home partition (if you have one) on /mount/old/home.
sudo mount /mount/old/home /dev/sdaY # sdaY being your former /home partition, if necessary.

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 large ext4 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, then umount them, and reboot on the virtual drive. Before umount-ing, you can also go to /mount/old/var/www or /mount/old/home/user/Downloads/var/www to get your data back.

# Find all files owned by root in the former Downloads directory, and move them back to the root (mounted on /mount/old)
sudo find /mount/old/home/user/Downloads -type d -maxdepth 1 -user root -exec mv {} /mount/old \;

# Un-mount everything.
sudo umount /mount/old/home /mount/old

# Power off! Remove the ISO and power the machine back on.
sudo poweroff

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 don't think I can launch my VM with a live ISO, once it gets created. I will keep reviewing your post. – Dimitris Sfounis Jun 22 '14 at 13:02
  • You can change the media on which your VM boots. You crashed the OS installed on the hard drive. You just need to boot somewhere else :) – John WH Smith Jun 22 '14 at 13:03
  • As I've written before, my dear, it runs on a remote online service, provided by GRNet, Greece's main research and internet network. – Dimitris Sfounis Jun 22 '14 at 13:07
  • If your access level to the machine is that limited, then indeed my solution won't be applicable. You'll need access to the physical machine hosting the VM, in order to reboot the VM differently. Maybe you could try contacting GRNet for such a thing? In last resort, ask for a full disk backup, and reset everything :) – John WH Smith Jun 22 '14 at 13:10
  • You're right. Maybe I've got a chance in that. Thank you for everything, dear. – Dimitris Sfounis Jun 22 '14 at 13:11

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

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.