The easiest way, or at least the way that I think will lead to the fewest mistakes, is probably to check while running the operating system you want to keep.
In the Installed System (that you are keeping)
Boot into the Ubuntu system that you want to keep (if you're not in it already).
Open a Terminal window (Ctrl+Alt+T) and run:
mount
Then look at the output. Remember that this will be different depending on what OS you're in when you run it. You won't get the information you need if you run it from the live CD/DVD/USB!
Look for the root partition, /
, first. If you have any other data partitions, like a separate partition for /home
, find that too. (By default, there is no separate partition for /home
.)
To see the /
partition only, run:
mount | grep 'on / '
(Remember the final space before the ending '
character.)
For example, when I run that, I get:
/dev/sda8 on / type ext4 (rw,errors=remount-ro,commit=0)
This indicates that my /
partition is /dev/sda8
.
You probably also have a swap partition. To find out which one that is, run:
swapon -s
For example, I get:
Filename Type Size Used Priority
/dev/sda7 partition 4194300 792048 -1
This indicates that my swap partition is /dev/sda7
.
Now, it's possible that your devices will have different device names in the live CD/DVD/USB system than in the installed system. While unlikely, substantial data loss could result as a consequence of assuming they are the same. There are several ways to verify this--one of them is to compare the UUID's (with blkid
; Rostislav Stribrny's answer uses this method).
Since if you've followed this method then you've started out in the installed system, and you have the device names of the /
and swap partitions (and any other partitions you need to keep, if any), the most user-friendly way to make sure they're the right ones is probably to look at them visually.
To do this, install GParted. Remember, this is in the installed system that you want to keep (the live CD/DVD/USB already has GParted). Please do not attempt to repartition inside an installed system--just use GParted to see where the partitions are.
Then you can verify their positions before removing the others.
In the Live Environment
Make sure all important files are backed up, somewhere other than this computer. Both human and computer error can lead to serious data loss when repartitioning. I am talking about files like your documents, and anything else you'd be sad to lose. You probably do not have to back up your Ubuntu system files, because if things go way wrong, you can always reinstall Ubuntu.
Boot to the live CD/DVD/USB, select Try Ubuntu, open the GParted Partition Editor, verify that the partitions you're keeping are where they were before, and then repartition however you like. Make sure to look not just at the relative positions of the partitions, but to double check the device names too (names like "sda2
").
You can remove all partitions except the ones you found to be associated with the particular installed system that you decided to keep. But do not remove the extended partition (which is a kind of container partition but has its own device name), unless you're removing everything in it. If you remove an extended partition, that gets rid of the partitions it contains also. (If this is a UEFI system, then there will be no extended partition. Otherwise, given the number of OSes you have installed at the same time with their own partitions, you'll almost certainly have one.)
You can stretch the remaining partitions out to give them more room, or add additional storage partitions, or leave things be for the time being--whatever you prefer.
After applying your changes, you'll probably have to reinstall GRUB2 to the MBR. You can try booting from the hard drive and see if it works (then if it doesn't, boot back into the live system to reinstall GRUB2). But I recommend just reinstalling it before even rebooting.
To reinstall GRUB2 to the MBR, you can use the techniques presented here, or any of these methods.
Once you boot from the hard drive, assuming all goes well, you should make sure swap is working by running swapon -s
. If nothing is listed, you'll have to check the new device name for the swap partition, and edit /etc/fstab
accordingly. Usually, swap will still work, because usually its fstab
entry is by UUID rather than by device name.
Similarly, if you have other partitions that are mounted by device name in /etc/fstab
(like a separate /home
partition, though again, the entry will typically use the UUID and thus continue working even when the device name changes), you may have to fix those manually as well.
/dev/sda1: UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" TYPE="ext4" /dev/sda6: UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" TYPE="ext4" /dev/sda7: UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" TYPE="ext4" /dev/sda8: UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" TYPE="ext4" /dev/sda9: UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" TYPE="ext4" /dev/sda10: UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" TYPE="ext4"
which doesn't really help tell me what is on which partition..
– xuxuxu Mar 16 '13 at 12:08x
es, runsudo blkid
from the command line on the live CD/DVD/USB system that you plan to use to remove partitions. This will show you what UUIDs correspond to what device names. – Eliah Kagan Mar 16 '13 at 14:05