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.

I have an issue, not necessarily a problem. I have a disk, which had Ubuntu 11.04, a swap, a big NTFS and some free space. When 11.10 came out, I did a fresh install and recently I've deleted the 11.04 partition since I didn't needed it anymore. I've noticed that my partition table is a little bit messy. Especially that I seem to have 2 primary empty partitions at the beginning and end of the partition table and my swap /dev/sdb5 seems to reside in an extended container /dev/sdb2 (probably old swap from 11.04).

Here is a screenshot from GParted: enter image description here

Any way I could make some order in here?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

First I advise you manage your partitions from a live CD.

Second, before you start, check fstab and make sure all your partition enteries are by UUID

UUID=dccc7153-df39-4b3c-b707-b42f2e3a5421  /  ext4   errors=remount-ro  0  1

FSTAB will also tell you what partitions are in use. If you need a list of partitions by uuid use

sudo blkid

1) Boot the desktop CD and unmount all your hard drive partitions and swap (you can do this in gparted).

2) Delete any unwanted partitions -> apply changes.

3) Resize your partitions one at at time.

4) Fix your partition table (order) with fdisk

sudo fdisk /dev/sda

At the fdisk prompt type the following commands

# Extra functionality
x

# Fix partition order
f

# Write changes to disk
w

# Quit fdisk
q

Reboot and your partitions should look much better.

Note - You really do not need to "fix" this "problem" , but it will not hurt to fix either.

share|improve this answer
    
Thanks a lot. You are right about the fix not being needed, but I don't like a messy disk. I will try your solution tomorrow because I need to get the live CD, and it's already late, and in case I screw something up, I don't have the energy to stay to much and fix it :). By the way, you say I should delete and resize my partitions, but my swap currently is part of an extended container...How should I fix this? –  bioShark Dec 15 '11 at 23:04
    
I would leave the swap alone (I only see one swap partition). If you want, you can delete it (from the live CD) and make a new one, you will have to update the UUID in fstab is all. Te resize the extended partition, do it in steps. Make sdb3 smaller -> apply changes -> make sdb2 smaller, or to make it larger, make sdb2 larger -> apply changes -> make sdb3 larger. You can also move partitions if you wish. –  bodhi.zazen Dec 15 '11 at 23:13
    
You are right about changing the UUID in fstab. I was only bugged by the fact that the swap (sdb5) is inside the logical disk partition sdb2. But actually that could remain logical (because it gives me more choices for future primaries. So the only problem is the reordering, so that the 2 unallocated are merged together and moved to the back –  bioShark Dec 15 '11 at 23:21
    
The fdisk commands will re-order the partitions. To move the unallocated space you will need to extend / resize / move the partitions. Do it one step at a time resize -> apply changes -> move -> apply changes ... –  bodhi.zazen Dec 15 '11 at 23:23
    
Got it, thx. Sounds like I'll have some fun tomorrow. Hope I don't screw things up because my NTFS partition holds all my movies :) –  bioShark Dec 15 '11 at 23:28
show 2 more comments

There is no such thing as a primary empty partition; unpartitioned space is just space that does not belong to any partition. Also, logical partitions always reside in an extended container.

One thing you could do to clean things up is to move the big NTFS partition all the way to the left and your Linux partitions to the end of the disk. If you decide to do this, you should just delete the swap partition and the extended partition that contains it to make way for the NTFS partition to move over, then you can create a new swap partition at the end of the disk later ( if you even want to have swap -- it really isn't needed if you have more than one or two GB of ram ). After modifying the swap partitions, you will need to update /etc/fstab to either remove the swap entry or point it to the new UUID. You can find the uuid and then edit the file with:

sudo blkid
gksu gedit /etc/fstab

Note that moving that huge NTFS partition will take AGES (like 12-24 hours), so I wouldn't suggest it.

Instead, I would suggest that you just ignore the free space at the start of the disk for the time being, and maybe expand the ext4 partition so it uses the remaining free space at the end of the disk. Moving the end of the partition to the right doesn't take very long and will give you more usable space in Ubuntu. In order to do this, you will have to run gparted from the livecd as the partition can not be in use to expand it ( for now, gparted should be gaining this ability soon ).

share|improve this answer
    
Thanks for the answer. What you have described above in the first part is what bodhi.zazen has suggested. Remove swap, move NTFS, move ext4 to fill the space remained now open between ntfs and ext3, add the swap after ext4 and change the UUID of the new swap in /etc/fstab. Your second suggestion will let me have some free space at the beginning. It's notwhat I want. For the things I want to do I really should have planned the partition table better :). Even from Ubuntu I use the NTFS partition to store big things, so Ubuntu doesn't need to be big. Free space is planned for future tests on OSs. –  bioShark Dec 16 '11 at 9:12
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.