On my old Ubuntu system (the one I'm trying to restore to) I had a boot partition /dev/sda1, my main OS partition /dev/sda2, and a swap partition /dev/sda3. I mistakenly formatted over /dev/sda1 turning it into a FAT32 fs.

The first thing I did was use testdisk to make sure my file system was intact (which it was), so I copied it to an external hard disk -- meaning I did cp -r /dev/sda2 /path/to/external/backup. Is it possible to use my live CD to get a fresh install with a proper boot partition and then do mount /path/to/external/backup some/proper/mount/point then write in /etc/fstab something so that I can boot into it? What would the actual process be exactly?

I already tried 2 or maybe 3 different ways to fix my grub partition so I can boot into the /dev/sda2 that's still on my laptop SSD, but I'm going on week 3 of trying to fix that issue and don't have time to mess with it any more.

  • cp -r isn't the best way to make a backup. If using cp at least use cp -a, but a filesystem archiver like fsarchiver might suit you better.
    – bsd
    Commented Jan 22, 2016 at 9:54
  • If your OS is still on /dev/sda2, it should be doable. Is it? Can you post sudo fdisk -l /dev/sda?
    – TNW
    Commented Jan 22, 2016 at 14:43
  • @TNW WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted. Disk /dev/sda: 256.1 GB, 256060514304 bytes 255 heads, 63 sectors/track, 31130 cylinders, total 500118192 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x4b904150 Device Boot Start End Blocks Id System /dev/sda1 1 500118191 250059095+ ee GPT
    – aweeeezy
    Commented Jan 22, 2016 at 19:25
  • @TNW, here's a screenshot showing that testdisk recognizes the partition and even lets me open the files of my old file system.
    – aweeeezy
    Commented Jan 22, 2016 at 19:30

1 Answer 1


Fixing this should be possible, and it roughly resembles Arch Linux installation process (disclaimer: I might be mistaken about some steps, please comment if you're in trouble).

First of all, boot with your live CD/DVD/USB. Then, mount your partition (everything as root!):

mkdir /mnt/ubuntu
mount /dev/sda2 /mnt/ubuntu

Then, backup all you might need from your /dev/sda1 and reformat it for something GRUB-suitable - let's say that ext3 will do:

mkfs.ext3 /dev/sda1

Then mount it within your system location, then bind the stuff that usually gets filled during boot process:

mount /dev/sda1 /mnt/ubuntu/boot
mount -o bind /dev /mnt/ubuntu/dev
mount -o bind /dev/pts /mnt/ubuntu/dev/pts
mount -o bind /proc /mnt/ubuntu/proc
mount -o bind /sys /mnt/ubuntu/sys

Finally, jump into your old Ubuntu:

chroot /mnt/ubuntu

You should now become root on your old Ubuntu, assuming everything gone well. You'll basically have to reinstall grub and kernel (assuming grub2 and pkg names as in Debian):

aptitude install grub2 linux

Install grub on your HDD:

grub-install /dev/sda

Then generate the config:

grub-mkconfig -o /boot/grub/grub.cfg

Review the config, and if it looks okay you should be good to go! Reboot and try if it works.

  • I'm good with these instructions up until the second to last step: root@ubuntu:/# grub-install /dev/sda --> Installing for i386-pc platform. --> grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible. --> grub-install: warning: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged.. --> grub-install: error: will not proceed with blocklists.
    – aweeeezy
    Commented Jan 25, 2016 at 5:23
  • After looking into the error mentioned above, I tried resizing /dev/sda1 so that there is 50MB of free space in front of this partition...no success with that.
    – aweeeezy
    Commented Jan 25, 2016 at 5:45
  • @aweeeezy Look there. If you create that 1MB partition in the free space you made, and then set it's type to "BIOS Boot", you should be able to install grub alright.
    – TNW
    Commented Jan 27, 2016 at 2:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .