6

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?

  • Depends on how Ubuntu was installed. If it's on a dedicated partition, you could use a live CD/USB and copy the files over. However, if you installed Ubuntu inside Windows, I don't know the way. – mikewhatever Nov 9 '11 at 22:33
  • Yeah i installed ubuntu inside Windows and thats the problem. – Daniel Mesa Nov 10 '11 at 0:02
  • Then need to use in my answer ==PRepearing LiveCD/USB== & == A Recovering bootloader== – Kangarooo Nov 12 '11 at 14:27
  • Related: Recovering user files with a Live CD – Eliah Kagan Nov 4 '17 at 13:31
4

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.

  • I have done that, but i do not know where to search my old documents because there are no actual ubuntu folders like home/ i do not know how to visibilize those folders that use ubuntu's file system, not the ntfs one. P.S I'm new to ubuntu, so this may seem a stupid question – Daniel Mesa Nov 9 '11 at 23:00
2

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

Preparing LiveCD/USB

From another computer make a Live CD or USB by simply following these steps.

  1. Download an Ubuntu image

  2. Write it to a CD or USB as described

  3. 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.

Recovering bootloader

  1. In terminal execute

    sudo add-apt-repository ppa:yannubuntu/boot-repair
    sudo apt-get update
    sudo apt-get install boot-repair
    boot-repair
    
  2. Press Recommended repair and when finished try booting your system from the hard disk again.

    See boot repair | Ubuntu help wiki

Copying files

  1. Mount the partition that contains /home/

  2. 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.

2

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 ubuntu@ubuntu:~/Documents$ gparted

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.

1

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.

Source: http://neosmart.net/forums/showthread.php?t=5004

  • not good idea to use time to install couse Ubuntu live session can be used with CD or USB – Kangarooo Nov 10 '11 at 2:42
  • What? What time are you talking about? – mikewhatever Nov 10 '11 at 20:00
  • 2 days ago. Check ubuntu.com/download/ubuntu/download there u can see that u can use USB Live without intallation. And wubi is slow & installed. You dont need to install OS to recover files and u dont need to install in Windows partition to make slow system in system- like Inception. – Kangarooo Nov 12 '11 at 14:25
  • Are you high??? – mikewhatever Nov 12 '11 at 14:42
  • No im am not high so youre alone on that.. – Kangarooo Nov 12 '11 at 20:25

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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