Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I had an hard-drive with two partitions: one was 460GB NTFS and the other was 5GB ext3 Ubuntu 10.10. I wanted to extend the Ubuntu partition, so I was going to shrink the NTFS partition by 15GB, but I accidentally right-clicked the NTFS partition and chose "Make Partition Active".

It actually made all the ext3 partition to become "Unallocated". It seems I can't boot from it anymore.

My question is, how can I undone it? Because it took like a millisecond to complete, I'm almost sure the data is still there.

Thanks.

share|improve this question
    
What program were you in when you right-clicked the NTFS partition and chose "Make Partition Active"? –  cjm Mar 12 '11 at 18:00
    
You probably misclicked something else. What program were you in? As you suspect, this is probably recoverable. Boot from a Linux CD/USB, run fdisk -l and post the output. –  Gilles Mar 12 '11 at 18:03
add comment

1 Answer 1

up vote 4 down vote accepted

The program calling the Linux partition "unallocated" sounds like the Windows Disk Management tool. Microsoft could make it recognize non-Microsoft partition types, but they haven't. It may be that your Ubuntu partition is still there and unharmed.

If that is the case, you may just have to mark the Ubuntu /boot partition active. The Windows tool will probably refuse to mark any non-Microsoft partition active, so you'll have to use another tool. I recommend booting your system with the Ubuntu install disk and telling it to use rescue mode. I haven't used the Ubuntu rescue mode recently; it may have a menu option for fixing this sort of thing automatically. If not, you will have to get to a command prompt, then say something like this:

# fdisk /dev/sda
Command (m for help): p
...partition list; /boot will be the smallest one you see in all likelihood
Command (m for help): a
Partition number (1-8): 1

That sets /dev/sda1 to be active. That's the most likely one to be /boot, but isn't necessarily it. You can try rebooting now.

If that didn't work, try repairing your GRUB boot loader.

If that also fails, go back into rescue mode, get into fdisk and look at the partition table again. If you find a 5 GB partition and it isn't marked as NTFS, Linux, or Linux swap, you may have found the "unallocated" partition. Say it's /dev/sda3. Then in fdisk:

Command (m for help): t
Partition number (1-8): 3
Hex code (type L to list codes): 83
Command (m for help): w

That sets /dev/sda3 to partition type 83, which says it contains one of several Linux-compatible filesystems: ext[234], XFS, ReiserFS...

Again, try booting.

If that's still not doing it, there are other steps you can take, but we've run out of easy ones. It sounds like this was just a hobby install, so it's probably not worth going to heroic measures to fix it.

In older versions of Ubuntu, you could have chosen to switch to Wubi to reduce the chances of a conflict with Windows. Unfortunately, UEFI conflicts with Wubi and it looks too difficult to work around the problems, so it was removed from Ubuntu, starting in 13.04.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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