1 (edited by kbarb 2012-05-09 02:06:29)

Topic: Partitioning Rules ?

I've been partitioning for quite some years with narry a problem, and Gparted is my partitioning utility of choice.

I'm trying to remember the actual problem I had, but I made a note to self to find out if there were partitioning rules I wasn't aware of.

I think I was working on a multiboot scenario, had just installed a Linux distro to a logical partition, and the install automatically made the Swap partition at the end of the drive with a lot of unallocated space between it and the last logical.

I had so much trouble trying to delete it and move the Swap to the beginning of the Extended partition, (and then - I think - create some unallocated space before the Extended for a small Primary) . . . I finally had to rebuild the entire drive from images - not horrendous as I did have the images - but it got me wondering . . .

I know this is a bit open ended, but do any obvious partitioning rules come to mind, as in do's and don'ts mostly as regards allowable partition layouts ? (And here I'm not asking about size limits or requirements.)

I know about :

  • Maximum of 4 primary partitions.

  • Maximum of 3 primary partitions, and 1 extended partition.

I'm curious about things like :

  • Can you leave unallocated space
    --in front of the first primary ?
    --between primaries  ?
    --between the last primary and the Extended  ?

  • Can you leave unallocated space
    --at the beginning of the Extended partition ?
    --between logicals ?

  • Do all primaries have to be at the front, and all logicals after them ?
    Or could you put a primary at the end some how, after the Extended partition.

  • Anything else I haven't thought of that comes to mind ?

2

Re: Partitioning Rules ?

I couldn't give any strict set of partitioning rules.
Such rules are mostly related to the BIOS, the hardware architecture of the computer, the operating systems installed, ...
Therefore, several things can vary with these factors and related changes over the years.

I remind that the msdos-type partition table is just one of the partitioning schemes used in the computing. It was created for the first IBM PC in the late 1970's and still remains largely in use, although the actual computing needs often overcome its possibilities. Other partitioning schemes are used in architectures like Sun, sparc systems, power-pc etc. Furthermore, the newer partitioning scheme GPT is often used in new systems, together with the new UEFI BIOS.

Regarding the "old good" msdos-type partition table:

Maximum of 4 primary partitions.
Maximum of 3 primary partitions, and 1 extended partition.

You are right. There are 4 partition entries. The extended partition type was introduced a few years later, to allow more than 4 partitions on a hard drive. Only one extended partition is allowed in the partition table (or not at all). You can have the extended partition in any one of the 4 positions, although it is usual to have a system or boot partition in the first places.
(This is often needed in systems with very old BIOS (before mid-1990s), because at the time the BIOS couldn't perhaps boot from a partition after the cylinder 1000 (or something like this). However this problem doesn't exist since the introduction of LBA in the BIOS. GParted doesn't work on such old 386 or 486 systems, because it needs at least Pentium 2 class processor).

Can you leave unallocated space
--in front of the first primary ?
--between primaries  ?
--between the last primary and the Extended  ?

You can leave unallocated space in front or after any partition. This doesn't create problem. I've heard that such space could be used by malware, but I have no precise info on such questions. I think that malware can work everywhere in a badly protected system.

Do all primaries have to be at the front, and all logicals after them ?
Or could you put a primary at the end some how, after the Extended partition.

See before. Each one of the 4 partitions is defined as it self, not in relation to the others.
Nevertheless, there are issues concerning the logical partitions (as follows).

Can you leave unallocated space
--at the beginning of the Extended partition ?
--between logicals ?

Yes, you can. BUT you can't freely use these unallocated spaces to create new logical partitions.
Better said: you can perhaps but I wouldn't recommend it.

In detail: It is better and safer to have all logical partitions in the disk order within the extended partition, i.e. /dev/sda5, /dev/sda6, ...
Avoid to have sequences out of order, like /dev/sda6, /dev/sda7, /dev/sda5 ...
Some partitioning tools allow these out-of-order logical partitions, but some other tools (including parted and GParted) don't support it.
If you want to create a new logical partition, it is better to have the space after the last existing logical one. So, I think it is easier to not leave unallocated between logical partitions, unless you want to grow some of them in a later time.
This is related to the specificity of the extended partition structure: each logical partition contains a link to the next logical. Out of order logical partitions often cause parted to find an error for the entire partition table and show the entire hard drive wrongly unallocated. It isn't easy to fix this problem.

Anything else I haven't thought of that comes to mind ?

Older systems (including win xp and same generation's linux distributions) use the cylinder alignment for the partitions. This comes from the legacy BIOS and hard drive firmware, that simulate the cylinder model of the early 1980's hard drives.
Late systems (including recent linux distributions and win7) usually default to the MiB model. This alignment is better for SSD drives and the latest generation of rotating drives ("advanced format" from western digital and similar formats from other manufacturers).
To work on an existing system, it is usually recommended to respect the existing alignment (to be verified from the fdisk -lu command output).

*** It is highly recommended to backup any important files before doing resize/move operations. ***

3

Re: Partitioning Rules ?

Thanks very much for your very detailed reply !

I'm going to number things for organization . . .

1.
I think I might have run into my problem with regards to your comments about unallocated space within the extended partition . . .

"you can't freely use these unallocated spaces to create new logical partitions. "  and

"It is better and safer to have all logical partitions in the disk order within the extended partition, i.e. /dev/sda5, /dev/sda6, ... "

Are you writing in reference to Linux here ?

So, once you make your first logical, you can only make subsequent logicals after that ?
I always thought you could move some space before, and then make another logical there, and have everything adjust automatically or at least configure it manually, although I've never done it.

Do you know . . . is that true for just Linux ? or both Linux and Windows ? or, this is because Gparted is Linux based.
I'm just getting into Linux so I haven't messed w/ fstab and so on - yet.

Does this apply also, for making primaries out of unallocated space ?
I think I've done this for Windows as long as the system and boot partitions keep their orig. drive letters.

2.
Just as an aside, I remember I have some tool that will reorder the partition order listing in the partition table according to their actual physical order - can't remember what that is offhand - but I don't remember either if that worked on the extended partition table as well.
But I don't think that will affect the way Linux knows about partitions.

3.
By the way, while we're on this kind of thing - I just read a few pages on the new 4K sector drives, but still reading up on this.
For instance :
http://www.seagate.com/tech-insights/ad … master-ti/
If I'm installing Win7, whatever, am I going to have to/should I - make a choice of using 4K sectors ?
(I mean, as long as I'm not using anything, or any OS like XP that requires 512k sectors.)
Is this even an option to address in Gparted ?

4.
I'm going to have to educate myself on the GPT and the new UEFI BIOS - I haven't run into it yet but it won't be long.

Thanks again - this is all very helpful.

4

Re: Partitioning Rules ?

Are you writing in reference to Linux here ?

So, once you make your first logical, you can only make subsequent logicals after that ?
I always thought you could move some space before, and then make another logical there, and have everything adjust automatically or at least configure it manually, although I've never done it.

Do you know . . . is that true for just Linux ? or both Linux and Windows ? or, this is because Gparted is Linux based.
I'm just getting into Linux so I haven't messed w/ fstab and so on - yet.

Does this apply also, for making primaries out of unallocated space ?
I think I've done this for Windows as long as the system and boot partitions keep their orig. drive letters.

I'm writing rather in reference to various hard drive tools. We have in this forum some reports on out-of-order logical partitions, where GParted shows the entire hard drive unallocated. However in these cases, the operating systems (linux as well as windows) work without problem.
This issue is related to the specific recursive structure of the extended partition: each logical partition understands its space divided in two parts, the partition it self and the space that contains the next and all subsequent partitions. We tried to investigate this in an old topic, about 3 years old.
Thanks to this recursive structure, there is no limited number of logical partitions.
(Nevertheless their number has a maximum by the number of letters available (26) in winxp or 15 partitions in total in a SCSI/SATA drive in linux, due to other limits. )

I have to mention that we have some reports on "overlapping partitions" where GParted displays the partition graph. So, I still don't know very well what exactly happens in each case. Perhaps some other disk tools could work.

2.
Just as an aside, I remember I have some tool that will reorder the partition order listing in the partition table according to their actual physical order - can't remember what that is offhand - but I don't remember either if that worked on the extended partition table as well.
But I don't think that will affect the way Linux knows about partitions.

Linux fdisk does this job, for the 4 primary partitions. I think it doesn't work for logical partitions.
It seems that the problem concerns logical partitions only. The 4 partitions listed in the partition table (primary partitions and extended partition) don't cause any real problem if out of order. The warning displayed by fdisk in this case refers to older operating systems, perhaps old BIOS and eventually some disk tools.

3.
By the way, while we're on this kind of thing - I just read a few pages on the new 4K sector drives, but still reading up on this.
For instance :
http://www.seagate.com/tech-insights/ad … master-ti/
If I'm installing Win7, whatever, am I going to have to/should I - make a choice of using 4K sectors ?
(I mean, as long as I'm not using anything, or any OS like XP that requires 512k sectors.)
Is this even an option to address in Gparted ?

Actually, these hard drives contain firmware that shows the drive to the system as a 512-byte/sector drive. Manufacturers didn't provide hard drives with full native 4096 byte format. Operating systems don't support directly such drives, although this is a quite old standard (from the late 1990s, I think). Western digital shipped a dedicated controller card for its first generation of these drives, seagate prefered to ship them as external USB drives instead of classical SATA-connected drives.

Especially for the bigger drives ( >2TB, i.e. 3TB and lately 4TB), the controller and the BIOS have to be compatible with this new technology. UEFI BIOS and GPT are needed in most cases, and perhaps 64 bit O.S. We had several posts on impossibility to format them under win7.
So, I would suggest to wait before using such big drives. It seems that things change rapidly.

4.
I'm going to have to educate myself on the GPT and the new UEFI BIOS - I haven't run into it yet but it won't be long.

Newer systems use them more and more.

*** It is highly recommended to backup any important files before doing resize/move operations. ***

5

Re: Partitioning Rules ?

kbarb wrote:

1.
I think I might have run into my problem with regards to your comments about unallocated space within the extended partition . . .

"you can't freely use these unallocated spaces to create new logical partitions. "  and

"It is better and safer to have all logical partitions in the disk order within the extended partition, i.e. /dev/sda5, /dev/sda6, ... "

Are you writing in reference to Linux here ?

So, once you make your first logical, you can only make subsequent logicals after that ?
I always thought you could move some space before, and then make another logical there, and have everything adjust automatically or at least configure it manually, although I've never done it.

Do you know . . . is that true for just Linux ? or both Linux and Windows ? or, this is because Gparted is Linux based.
I'm just getting into Linux so I haven't messed w/ fstab and so on - yet.

Does this apply also, for making primaries out of unallocated space ?
I think I've done this for Windows as long as the system and boot partitions keep their orig. drive letters.

In support of class413's comments, we have had difficulty in the past with GParted and logical partitions out-of-order.

Having said that, with recent versions of GParted I have been able to create, resize, and move logical partitions that have been created out of order.  One of the key things is to ensure that enough unallocated space is kept in front of the logical partition to store the Extended Boot Record.  Recent versions of GParted contain a few bug fixes to ensure that this space is indeed reserved.

Regarding overlapping partitions, the command line program parted and the associated libparted library that GParted uses will not permit working on partition tables with overlapping partitions.  Further parted/libparted should not permit creating an overlapping partition.

If you receive an error regarding overlapping partitions, then please save the gparted_details.htm log file and post the problem in this forum.  If the overlapping partition problem already exists, then we can also help you to resolve that situation.