Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

So this problem may sound familiar to a dozen other questions like these but I still haven't found an answer to mine in particular. When I installed Ubuntu I thought that when choosing to install it side by side with Windows it would just add it to the windows booter, but it didn't. And now I've got the problem that I recovered the MBR with my Win 7 disc because I still use that a lot, and I would like to be able to boot Ubuntu from that now.

Here is where the problem comes in. My problem is that since I didn't make a seperate boot partition for GRUB, I didn't think of making logical partitions (I've got 4 primary partitions, with the one with Ubuntu on) and I need to make it extended so that I can free some space up for the boot partition so I can then configure the Win booter to boot it correctly when I choose to.

And why I am just not deleting the whole partition to reinstall it (because I guess you're thinking that since it's such a fresh install why don't I just reinstall?) is because I have spent two days installing software and downloading and the only internet I have is a mobile broadband with limited bandwidth/month.

I'm looking for a way to copy the content which is around 5 gigs to some other drive, or somehow making it an extended drive and shrink it, or erasing the partition, doing this and that, copying it back and then installing GRUB. Would this be possible? Would GRUB be able to pick it up if I were to install it through some other way? Right now I'm on the live CD.

share|improve this question
1  
Why use the Windows boot loader? You can use GRUB. Since you erased GRUB, you can use boot-repair to restore it: help.ubuntu.com/community/Boot-Repair From there, you can access Ubuntu and make your extended partition, (you may also use the Paragon Hard Disk manager to do this, it's free) and then from Ubuntu's terminal do sudo update-grub. –  Richard Jan 15 '13 at 1:29
    
So, if I repair GRUB to /dev/sda1 which I think is the Window Boot loader right now, and go into Ubuntu I can download a program which can make my /dev/sda4 an extended without wiping the data? Ubuntu is on sda4 and I'm planning on making a boot and a swap as well so I want to make it an extended and making logical ones under it. I think that's how it worked. Correct me if I'm wrong. I'll look at the link though. Thanks! –  Simon Jan 15 '13 at 1:44
    
So, I was supposed to paste this link somewhere, or write it down, but I have no pen or paper so I'm posting it here. Hope it doesn't matter! paste.ubuntu.com/1533082 –  Simon Jan 15 '13 at 2:01
add comment

1 Answer 1

up vote 0 down vote accepted

There's no way to convert a partition from primary to logical while keeping the data, as far as I'm aware. So the question boils down to "how do I back up the data from a partition so I can restore it later to another partition and make Ubuntu to boot from that partition".

You'll need an Ubuntu LiveCD/USB and enough space on the Windows partition or somewhere else to store the backup of data. Boot from the LiveCD and mount both the Ubuntu partition and the partition where you're going to store the backup. Then make a backup with something like

sudo tar zcfv /media/my_backup_partition/myubuntu.tar.gz /media/Ubuntu 

(the reason we need to use tar (and sudo) is to preserve permissions. If the backup partition supports Linux permissions you can just copy the files to a directory there)

Then you remove the partition, create an extended partition and logical partitions inside it. Mount the new Ubuntu partition and extract the backup:

sudo tar zxfv /media/my_backup_partition/myubuntu.tar.gz /media/new_ubuntu_partition

Then I think you'll need to edit etc/fstab on the new partition to account for the new filesystem UUID and device name (it'll likely be sda5 instead of sda1..4) or, alternatively, to use tune2fs to change the UUID to match the old one.

Then you'll need to re-install GRUB.

The point is - the whole Ubuntu install is just a bunch of files, you can do with them whatever you can do with files, there's nothing magical about them.

share|improve this answer
    
Thank you! Since I'm in the LIVE CD right now I'll try this. I'm trying to understand the UUID thing though and I seem to get the idea of what it is but how do I update the fstab? Is the UUID itself random or generated when I make the partition or does the OS generate it or how does it work? Or just give me a short version explaining how to do it without messing it up! And thanks! I tried to copy it all but it didn't let me. I guess all I had to do actually was to use sudo. Anyway, thanks! –  Simon Jan 15 '13 at 2:10
    
@Simon: UUID is just an unique identified assigned to a filesystem when the latter is created. Ubuntu uses UUIDs to mount partitions because it's more robust than device names (/dev/sda2 etc.) which may change if you edit partitions or add a hard drive to the system. But in your case both UUID and device name are going to change anyway, so editing fstab is inevitable :) –  Sergey Jan 15 '13 at 2:20
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.