2

I have been messing around with linux distros and have been asked to create partitions. I generally just click through the standard options without really knowing what I am doing. Since this kind of modification has the potential for bad consequences I would like to know more about what I am doing.

I would like to know:

  • What are the different types of partition? (in more detail than just their names)
  • All about creating, modifying and deleting partitions
  • What are the things which can go wrong
  • Any other stuff relevant to creating partitions for installing various OSs. (Don't have enough knowledge to ask the specific questions!)

3 Answers 3

4

I will answer your questions with respect to the classic MBR partitioning scheme. Some of the information below might not be applicable to modern GPT schemes.

What are the different types of partition? (in more detail than just their names)

There are three basic types of partition, primary, extended and logical.

  • Primary partitions are what you think of when you consider partitions. They are a defined region of your hard drive that is treated as a separate disk by the operating system. You can only create 4 primary partitions on a given hard drive.

  • Extended partitions are the way you get around the 4 partition limit. They are a sort of container for partitions. If you want more than 4 partitions on your drive, you will need to create an extended partition (you can only have one) which will then be subdivided into multiple logical partitions.

  • Think of logical partitions as "virtual partitions". In a way, they are a software trick to trick your drive into thinking it has more partitions than it does. Since there can only be four primary partitions on a drive, to get more you can create as many logical partitions as you want within an extended one. Once the partitioning is done, as far as the user or the OS is concerned, these are normal partitions. There is no difference in the way they are used or mounted on the system, you just see a prtition, you don't care if it is logical or primary. Some OSs don't like being installed on logical partitions but most have no problem with this. I am writing this answer from my Debian which is installed in a logical partition.

This is a screenshot of gparted listing the partitions of my hard drive. Note that I have 4 primary partitions, sda1 through 4. sda4 is an extended partition that contains 4 logical partitions (and a little unallocated, space).

enter image description here

All about creating, modifying and deleting partitions

Not sure what you want to know here. Partitions can be created, modified and deleted (usually in that order). You can resize a partition without affecting the data stored in it (it has to be unmounted first). As barlop stated, this carries risks and you could loose the data on the resized partition so you should always back it up. However I, like barlop, have done this many many times over the last 10 years and have never had any problem.

You can modify/create partitions using a partition manager. The classic *nix tool for this is fdisk, a command line program. Two popular GUI choices are gparted and the KDE Partition Manager.

What are the things which can go wrong

First of all, the things that can go wrong don't often go wrong. What can happen is loss of data, filesystem corruption when resizing an existing partition. To the best of my knowledge you can cause no hardware problems by playing with partitions. Basically, as long as you backup, you should be fine. Apart from that, as barlop said, setting the wrong partition bootable can render your system unable to boot.

Any other stuff relevant to creating partitions for installing various OSs. (Don't have enough knowledge to ask the specific questions!)

Older Windows versions needed to be installed on the 1st, primary partition or they would not work. This is no longer a problem. Different OSs need diferrent filesystems but that is not directly related to the partitions. A dedicated swap (virtual memory) partition is recommended for Linux systems.

4
  • 1
    This is only true for MBR style partitions though. IIRC GPT uses a different scheme as does BSD slices.
    – Journeyman Geek
    Commented Apr 27, 2013 at 14:02
  • @JourneymanGeek which part? I have not used GPT so I don't really know much about it. Fell free to edit anything you consider wrong. Is the limit on the number of primary partitions different for GPT or is nothing of what I say applicable there?
    – terdon
    Commented Apr 27, 2013 at 14:15
  • GPT allows much more partitions. At least 127, but I think that was a windows GPT limitation and not part of the GPT design. Other than that, good job trying to explain something which really needs many pages to cover all the details.
    – Hennes
    Commented Apr 27, 2013 at 14:27
  • ^. GPT also lets you boot off a drive bigger than 3tb, and the tools are different. There's nothing wrong with you answer at all, but its useful to know which partitioning scheme's in use.
    – Journeyman Geek
    Commented Apr 28, 2013 at 5:34
1

A program available now that is free and you can boot off USB, is Gparted Live.

it may have more options than you need to try, but you could experiment with that.

Creating a partition is no risk.

Deleting a partition obviously deletes it. KIND OF HIGH RISK.(you might delete the wrong one) Make sure the partitions are labelled so you know which is which. There is a risk of deleting the wrong partition but you'd have to be a complete fool to do that. Make sure you check and double check before deleting a partition. If you have more than one hard drive in there, then remove/detach any hard drives with important data on them, before partitioning, just in case of a human error. Backing up beforehand ensures no risk. Many programs you boot off, don't show you the contents, but you can see the capacity and label. Even before I knew the software would show the label, I still managed to not make an error, because I checked the capacity of the drive. So I knew what drive or partitions on the drive, I was working on. I would check and double check. When you label the partition it is must more fool proof(after you've checked and double checked that you got the label right! and labelling a drive isn't technically part of partitioning or a function of partitioning. it's just a must to be safer). You can always backup beforehand though. I've never made that mistake of deleting the wrong one.

Changing which partition is bootable. This is KIND OF HIGH RISK. If you make the wrong partition bootable, you won't be able to boot, though this is always reversible. One partition on a hard disk, has the bootable flag. The BIOS chooses which hard drive to boot from, and after that, the partition with the bootable flag is booted from. I have probably made the wrong partition bootable before, because I didn't care about getting it wrong. I didn't need to waste effort and get stressed over doing it right 'cos it's reversible. And you can always experiment with it.

Resizing a partition - HIGH RISK. (though i've had no problem in 10 years). i've heard partitions can be corrupted by this. You could run chkdsk after to check. If there's a powercut during it then who knows what'd happen. You may want to backup if there's important data, before resizing, if you do it at all. But this is only high risk if it goes wrong. And when it goes wrong it's not really human error. Personally it has not gone wrong for me in a decade. I may have seen a partition was corrupt recently after, I don't know if it was from that, though chkdsk probably fixed it. It wasn't important stuff anyway. But if you resize and run chkdsk and it seems fine then it's fine. You can always backup beforehand as I said, and that tends to be recommended. If resizing did go wrong, it's a)not human error b)not reversible. The only smart thing you can do to avoid this, is backup. Or just do this with a partition that doesn't have important stuff on it.

What you need to know, and I say "need" in the sense that it's just fundamental to know. It's no risk if you don't know and you'd find out soon enough and in a gentle way. There's no risk if you didn't know the following. The "risks" are those I mentioned above. As for some basics about partitions.. You create a primary partition maybe more. Gparted Live won't let you create more than four.
If you want any more partitions, you have to create what is called an Extended partition which is like a container - Gparted says it's a primary so it counts it in one of its four. Then within the Extended partition you can create as many "Logical partitions" as you want.

The bootable partition might run a boot loader, in linux I suppose like GRUB, and if there are other partitions then the boot loader software can boot an OS of any of them, but this is not part of the partitioning process.

Gparted Live won't let you convert e.g. a Primary to a Logical. Many Windows programs let you and no doubt linux ones too. If there is risk here i've never run into it.

You can make a logical partition bootable. So i'm not sure of any advantage in multiple primary partitions, beyond a primary and (if more partitions are wanted) an extended.

By the way, many people use virtual machines as an alternative to partitioning.

0

If you want to further explore the subject beyond terdon's answer, here are some articles that explain in detail how disk partitioning works:

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