I installed Ubuntu on a hard drive that had Windows XP installed so I could dual-boot the two operating systems. Everything was fine but now I can't boot into XP or Ubuntu. I had some important documents in the Ubuntu partition and the hard drive is still working, so how can I recover those files from a working Ubuntu installation? Where should I look for the broken Ubuntu installation?
Go to another computer, simply download an actual Ubuntu image and make a bootable USB stick described on homepage from ubuntu.com. Boot from these USB stick and choose "Try Ubuntu". Now put a clean second USB stick or HDD into another USB port and save your documents from your computer HDD.
PS: It does not work, if you have encryption enabled by installation.
You might have somehow crashed the GRUB bootloader.
I'll explain how to recover, saving both systems, and also how to get files from in case recovery fails.
But for both you'll first need a live CD/USB
From another computer make a Live CD or USB by simply following these steps.
Download an Ubuntu image
Write it to a CD or USB as described
Boot from the live CD/USB on the problem computer. You may need to access the BIOS by pressing an F key (eg F2), Esc or Del and change boot order to prefer CD or USB.
In terminal execute
sudo add-apt-repository ppa:yannubuntu/boot-repair sudo apt-get update sudo apt-get install boot-repair boot-repair
Press Recommended repair and when finished try booting your system from the hard disk again.
Mount the partition that contains
Copy your whole username folder to some other place, not on the hard disk or the live USB system. Ypu need to copy the whole directory rather than just the contents because it will contain also hidden files that include browser bookmarks and other settings you might want to keep for backup.
My Ubuntu 16.04 crashed during file editing. After power cycle, it kept flopping between login password and reboot console printout. I inserted a bootable USB stick with Ubuntu 18.04 and chose "Try Ubuntu". The way to find where the old data/documents is
Ctrl+Alt+T to open a terminal.
Issue "lsblk" to see the partitions:
ubuntu@ubuntu:~/Documents$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT ... sda 8:0 0 74.5G 0 disk ├─sda2 8:2 0 37.3G 0 part ├─sda5 8:5 0 3.7G 0 part ├─sda6 8:6 0 29.8G 0 part └─sda7 8:7 0 3.7G 0 part [SWAP] sdb 8:16 1 1.9G 0 disk └─sdb1 8:17 1 1.9G 0 part /cdrom sdc 8:32 1 2G 0 disk └─sdc1 8:33 1 2G 0 part
or graphically by using
From the size, you can tell the old data is either in /dev/sda2 or /dev/sda6.
Make a directory sda2 under /media and mount /dev/sda2 at /media/sda2/ for sda2:
ubuntu@ubuntu:/dev$ sudo mkdir /media/sda2 ubuntu@ubuntu:/dev$ sudo mount /dev/sda2 /media/sda2 ubuntu@ubuntu:/dev$ ls sda2 Document
Do the same thing for sda6 until you find the old data.
ubuntu@ubuntu:/media$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT ... sda 8:0 0 74.5G 0 disk ├─sda2 8:2 0 37.3G 0 part /media/sda2 ├─sda5 8:5 0 3.7G 0 part ├─sda6 8:6 0 29.8G 0 part /media/sda6
Then you can tarball and zip the data with
% tar -czvf oldData.tgz Document
Saving the .tgz file to a locally inserted USB flash drive is not possible since Ubuntu 18.04 is not installed yet. So I used Firefox to upload it to Google Drive. From there, I downloaded it to my Windows PC. After unzip and extract, I found the unsaved data/files were indeed gone due to the crash, but the rest is safe. Now I can start to install Ubuntu 18.04 knowing that the old data has been saved.
Apparently, you can recover files from a wubi installation. It requires some command line work, but nothing too difficult. You'll need to boot from an Ubuntu live CD, and then run the following in a terminal window:
sudo fdisk -l sudo mkdir /win sudo mount /dev/sdxy /win sudo mkdir /vdisk sudo mount -o loop /win/ubuntu/disks/root.disk /vdisk
Now, check the file browser, your wubi installation should be available there.
In the third command, the x and y are most probably a and 1, which gives /dev/sda1. Make sure to adjust according to where the wubi installation is.