1

I recently installed Fedora 22 on a desktop PC. I wanted to install it on a logical partition. During installation, in the Anaconda installation wizard, I chose to create a 16 GiB logical partition as swap space, and a 50 GiB logical partition for the system, boot, home, root, etc (etc. etc, not /etc... but yes, that too... no pun intended).

This is a multi-booted system with Windows 10 preview, Ubuntu and Fedora. The disk is using MBR partition scheme. Windows is using a primary partition as system partition as the boot (a.k.a. system) partition. The Windows itself is installed on a logical partition. At least in the Windows world, a logical partition (a.k.a. "logical drive") can only be created inside an extended partition. I have created this extended partition next to the primary partition, and it ran to the end of disk. Then I had Ubuntu installed, and then Fedora.

This is what it looks like now in Disks tool in Fedora.

fedora-disks

Why are the Fedora partitions not listed under the "extended partition"?

You can see that Ubuntu is listed under the extended partition. This is what I would expect for Fedora too, and this is the way Windows usually lists logical partitions too, as an entity living inside the extended partition.

Perhaps a better, and more general question would be: is it possible for logical partitions to exist outside of an extended partition? Outside of the boundary of an extended partition? Up until now, I only thought that primary partitions could do that.

Here is an fdisk output for the same disk.

Disk /dev/sda: 465.8 GiB, 500106780160 bytes, 976771055 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9a3b2e4f

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sda1  *         2048    264191    262144  128M  7 HPFS/NTFS/exFAT
/dev/sda2          266238 237123583 236857346  113G  f W95 Ext'd (LBA)
/dev/sda3       237123584 270678015  33554432   16G 82 Linux swap / Solaris
/dev/sda4       270678016 375535615 104857600   50G 83 Linux
/dev/sda5          266240 105123839 104857600   50G  7 HPFS/NTFS/exFAT
/dev/sda6       105125888 137123839  31997952 15.3G 82 Linux swap / Solaris
/dev/sda7       137125888 237123583  99997696 47.7G 83 Linux

Partition table entries are not in disk order.

You can see that the extended partition starts at sector 266238 and ends at sector 237123583. Partition 3 (Fedora swap) starts at sector 237123584. How is this possible?

Here is what it looks like in Windows 10 disk management tool.

windows-disk-management

I have marked in the screenshot above what I believe is the Ext4 partition that's used by Fedora. That should be it, because it's exactly 50 GiB and Windows uses binary prefixes (but unfortunately uses "MB" and "GB" to indicate it). As you can see it is listed as a primary partition. In fact all the Linux partitions I created are listed as primary partitions. This contradicts what I have just shown above in Linux. So who is right and who is wrong then?... Windows or Linux? Both can't be right about it?


Update: parted

Here is the output from parted.

Model: ATA ST3500320AS (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type      File system     Flags
 1      1049kB  135MB   134MB   primary   ntfs            boot
 2      136MB   121GB   121GB   extended                  lba
 5      136MB   53.8GB  53.7GB  logical   ntfs
 6      53.8GB  70.2GB  16.4GB  logical   linux-swap(v1)
 7      70.2GB  121GB   51.2GB  logical   ext4
 3      121GB   139GB   17.2GB  primary   linux-swap(v1)
 4      139GB   192GB   53.7GB  primary   ext4

This is easier to read than the output from fdisk. And unlike fdisk, here we can see that the partitions are printed in disk order. Thank you parted! This does help to shed some light on the subject. I can tell that the first 3 partitions are in the right order, as I created them with diskpart. Except that the extended partition does not run to the end of the disk. Either Ubuntu or Fedora installation process must have changed it for some reason.


Update: fstab and grub config (fulfilling request)

As requested by @Chris.C here is what my fstab and grub configuration file looks like.

# /etc/fstab
# Created by anaconda on Wed Jul  1 01:18:26 2015
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=036c6533-ec01-428a-a38c-23c364cc220a /                       ext4    defaults        1 1
UUID=01d56d7c-5d48-497c-befd-05f7a7f22281 swap                    swap    defaults        0 0

Now here is the grub configuration... I have to add this line to create code block separation.

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
set pager=1

if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="${saved_entry}"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

terminal_output console
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Fedora (4.0.4-301.fc22.x86_64) 22 (Twenty Two)' --class fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-4.0.4-301.fc22.x86_64-advanced-036c6533-ec01-428a-a38c-23c364cc220a' {
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='hd0,msdos4'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 --hint='hd0,msdos4'  036c6533-ec01-428a-a38c-23c364cc220a
    else
      search --no-floppy --fs-uuid --set=root 036c6533-ec01-428a-a38c-23c364cc220a
    fi
    linux16 /boot/vmlinuz-4.0.4-301.fc22.x86_64 root=UUID=036c6533-ec01-428a-a38c-23c364cc220a ro rhgb quiet LANG=en_US.UTF-8
    initrd16 /boot/initramfs-4.0.4-301.fc22.x86_64.img
}
menuentry 'Fedora (0-rescue-6b81f900dbfc4da3b56fe2db6748aabc) 22 (Twenty Two)' --class fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-6b81f900dbfc4da3b56fe2db6748aabc-advanced-036c6533-ec01-428a-a38c-23c364cc220a' {
    load_video
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='hd0,msdos4'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 --hint='hd0,msdos4'  036c6533-ec01-428a-a38c-23c364cc220a
    else
      search --no-floppy --fs-uuid --set=root 036c6533-ec01-428a-a38c-23c364cc220a
    fi
    linux16 /boot/vmlinuz-0-rescue-6b81f900dbfc4da3b56fe2db6748aabc root=UUID=036c6533-ec01-428a-a38c-23c364cc220a ro rhgb quiet
    initrd16 /boot/initramfs-0-rescue-6b81f900dbfc4da3b56fe2db6748aabc.img
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###

### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_ppc_terminfo ###
### END /etc/grub.d/20_ppc_terminfo ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows Recovery Environment (loader) (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-2E0E4F3F0E4EFEF9' {
    insmod part_msdos
    insmod ntfs
    set root='hd0,msdos1'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  2E0E4F3F0E4EFEF9
    else
      search --no-floppy --fs-uuid --set=root 2E0E4F3F0E4EFEF9
    fi
    parttool ${root} hidden-
    drivemap -s (hd0) ${root}
    chainloader +1
}
menuentry 'Ubuntu 15.04 (15.04) (on /dev/sda7)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-6f745b5e-bb49-40cb-bcae-b245d76b9d7d' {
    insmod part_msdos
    insmod ext2
    set root='hd0,msdos7'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos7 --hint-efi=hd0,msdos7 --hint-baremetal=ahci0,msdos7 --hint='hd0,msdos7'  6f745b5e-bb49-40cb-bcae-b245d76b9d7d
    else
      search --no-floppy --fs-uuid --set=root 6f745b5e-bb49-40cb-bcae-b245d76b9d7d
    fi
    linux16 /boot/vmlinuz-3.19.0-15-generic root=UUID=6f745b5e-bb49-40cb-bcae-b245d76b9d7d ro quiet splash $vt_handoff
    initrd16 /boot/initrd.img-3.19.0-15-generic
}
submenu 'Advanced options for Ubuntu 15.04 (15.04) (on /dev/sda7)' $menuentry_id_option 'osprober-gnulinux-advanced-6f745b5e-bb49-40cb-bcae-b245d76b9d7d' {
    menuentry 'Ubuntu (on /dev/sda7)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-3.19.0-15-generic--6f745b5e-bb49-40cb-bcae-b245d76b9d7d' {
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos7'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos7 --hint-efi=hd0,msdos7 --hint-baremetal=ahci0,msdos7 --hint='hd0,msdos7'  6f745b5e-bb49-40cb-bcae-b245d76b9d7d
        else
          search --no-floppy --fs-uuid --set=root 6f745b5e-bb49-40cb-bcae-b245d76b9d7d
        fi
        linux16 /boot/vmlinuz-3.19.0-15-generic root=UUID=6f745b5e-bb49-40cb-bcae-b245d76b9d7d ro quiet splash $vt_handoff
        initrd16 /boot/initrd.img-3.19.0-15-generic
    }
    menuentry 'Ubuntu, with Linux 3.19.0-15-generic (on /dev/sda7)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-3.19.0-15-generic--6f745b5e-bb49-40cb-bcae-b245d76b9d7d' {
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos7'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos7 --hint-efi=hd0,msdos7 --hint-baremetal=ahci0,msdos7 --hint='hd0,msdos7'  6f745b5e-bb49-40cb-bcae-b245d76b9d7d
        else
          search --no-floppy --fs-uuid --set=root 6f745b5e-bb49-40cb-bcae-b245d76b9d7d
        fi
        linux16 /boot/vmlinuz-3.19.0-15-generic root=UUID=6f745b5e-bb49-40cb-bcae-b245d76b9d7d ro quiet splash $vt_handoff
        initrd16 /boot/initrd.img-3.19.0-15-generic
    }
    menuentry 'Ubuntu, with Linux 3.19.0-15-generic (upstart) (on /dev/sda7)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-3.19.0-15-generic--6f745b5e-bb49-40cb-bcae-b245d76b9d7d' {
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos7'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos7 --hint-efi=hd0,msdos7 --hint-baremetal=ahci0,msdos7 --hint='hd0,msdos7'  6f745b5e-bb49-40cb-bcae-b245d76b9d7d
        else
          search --no-floppy --fs-uuid --set=root 6f745b5e-bb49-40cb-bcae-b245d76b9d7d
        fi
        linux16 /boot/vmlinuz-3.19.0-15-generic root=UUID=6f745b5e-bb49-40cb-bcae-b245d76b9d7d ro quiet splash $vt_handoff init=/sbin/upstart
        initrd16 /boot/initrd.img-3.19.0-15-generic
    }
    menuentry 'Ubuntu, with Linux 3.19.0-15-generic (recovery mode) (on /dev/sda7)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-3.19.0-15-generic--6f745b5e-bb49-40cb-bcae-b245d76b9d7d' {
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos7'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos7 --hint-efi=hd0,msdos7 --hint-baremetal=ahci0,msdos7 --hint='hd0,msdos7'  6f745b5e-bb49-40cb-bcae-b245d76b9d7d
        else
          search --no-floppy --fs-uuid --set=root 6f745b5e-bb49-40cb-bcae-b245d76b9d7d
        fi
        linux16 /boot/vmlinuz-3.19.0-15-generic root=UUID=6f745b5e-bb49-40cb-bcae-b245d76b9d7d ro recovery nomodeset
        initrd16 /boot/initrd.img-3.19.0-15-generic
    }
    menuentry 'Memory test (memtest86+, serial console 115200) (on /dev/sda7)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/memtest86+.bin--6f745b5e-bb49-40cb-bcae-b245d76b9d7d' {
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos7'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos7 --hint-efi=hd0,msdos7 --hint-baremetal=ahci0,msdos7 --hint='hd0,msdos7'  6f745b5e-bb49-40cb-bcae-b245d76b9d7d
        else
          search --no-floppy --fs-uuid --set=root 6f745b5e-bb49-40cb-bcae-b245d76b9d7d
        fi
        linux16 /boot/memtest86+.bin console=ttyS0,115200n8
    }
}

### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

Update: attempting to fix partitions order in fdisk

As suggested by @Chris.C I have tried fixing the partitions order using fdisk. Here is the result.

[root@sg-1 /]# fdisk /dev/sda

Welcome to fdisk (util-linux 2.26.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): x

Expert command (m for help): f
Nothing to do. Ordering is correct already.

Expert command (m for help): 

It's needless to say, but fdisk is feeling bored, because it has nothing to do.

7
  • Perhaps you may wish to read Wikipediaìs artcile about disk partitioning, en.wikipedia.org/wiki/Disk_partitioning#PC_partition_types You might find it helpful. Jul 1, 2015 at 21:53
  • @MariusMatutiae Since you are giving me reading material, is there anything in particular you want me to focus on? Would you give me a hint please? To me, that's like saying "go read some books". I don't mean to Ctrl-F through it. I was thinking more as a long term study material. I did read that article, and the PC partition types section in particular (which you linked to). Unfortunately, I did not gain any new knowledge. I'm sorry, but it wasn't helpful.
    – Samir
    Jul 1, 2015 at 22:17
  • You have too many primary partitions. There can only be a maximum of four primary partitions or three primary partitions and an extended partition on a physical disk. It's in the Wikipedia article linked to by @MariusMatutiae. You were skimming, not reading, it.
    – Larssend
    Jul 1, 2015 at 23:38
  • @geewee Excuse me, but I think I would know if I skimmed it or read it. Besides, skimming is part of the reading process. On top of that, I already knew the fact you're pointing out. So what's there to read for me then? If this is what Marius was referring to, he could have said it. Now... would you please point out for me which ones you think are primary partitions? Do you even think it's possible to exceed the maximum number of primary partitions of 4 in a MBR scheme?
    – Samir
    Jul 1, 2015 at 23:54
  • @sammyg: You sure do like to argue, don't you? Have a look at your Disk Management screenshot -- tells you which ones are primary partitions. It technically shouldn't be possible to exceed the restrictions, but some programs just let it happen.
    – Larssend
    Jul 2, 2015 at 5:28

2 Answers 2

0

Looks like you have a wrong partition number order. partition 5/6/7 should follow partition 2. This can be fixed by

sudo fdisk /dev/sda
x  (expert mode)
f  (fix the partition order)
w  (write to disk)

Don't have a messed up system now but IIRC after w the change takes effect immediately. Make sure to check /etc/fstab, menu.lst etc. before rebooting since partition# might change, or have a live cd to fix the booting issue after repair.

11
  • What should I check for in /etc/fstab and menu.lst? What would you like me to do with my extended partition? When you say it's a wrong partition number order, are you referring to the fdisk output from Fedora? If so, then you should refer to: "Partition table entries are not in disk order." So in reality, if you follow disk order, it is more likely something like this: 1, 2, 5, 6, 7, 3, 4. So there you go, no worry there then. Partition 5, 6 and 7 are already following partition 2.
    – Samir
    Jul 1, 2015 at 22:00
  • @sammyg Except the wrong order it looks fine on Fedora, per fdisk your extended partition /dev/sda2 runs from 266238 to 237123583 which is /dev/sda5 sda6 and sda7, but these 3 should have a partition# of /dev/sda3, sda4, sda5 instead, so after fixing(sort and put them back in order) your Fedora's boot partition will change and you need to update /etc/fstab and grub's menu.lst to reflect the update. I'm not sure if the fdisk error related to the Windows disk manager but thats sth wrong and should get fixed anyway.
    – lex
    Jul 1, 2015 at 22:12
  • If I am reading this right, the first Windows partition should be number 1, extended partition should be number 2, Ubuntu partitions should be 3 and 4, and then Fedora partitions should be 5 and 6. Correct? So where will the second Windows partition go then? To the end of the disk, at number 8? Shouldn't it be number 3?
    – Samir
    Jul 1, 2015 at 23:05
  • Before I start doing trial and error, can you complete the commands? With the options and in the order they should be executed? I will reference it and check the syntax myself, but I need your input, because I have not done this before. I don't want to screw it up on the first run.
    – Samir
    Jul 1, 2015 at 23:09
  • post the content of /etc/fstab and menu.lst? if they're uuid based you might not need to change them then. Otherwise, modify /dev/sda? accordingly.
    – lex
    Jul 2, 2015 at 5:57
0

MBR stands for Master Boot Record. It's defined as the first 512 byte of a disk. It fits in a small text file, so you can easily copy it to a diskette for backup. In case it gets damaged, you can easily repair it by using the backup.

MBR is a type of data structure that holds two key pieces of information: machine boot code and partition table. The way a partition table is structured is called a partitioning scheme, or partitioning format. There is more than one kind of partitioning scheme, but the one used in a MBR is only used on a MBR partitioned disks. However, there are some historical variations to the MBR partitioning scheme. The most common scheme is the one used by DOS and Windows. This is for a historical reason: the IBM PC introduced the concept of a MBR and it was using PC-DOS as the operating system (later to become MS-DOS and eventually Windows). This is the standard MBR partitioning scheme found on a MBR partitioned disk.

Standard MBR partitioning scheme allows for up to 4 primary partitions to be created. In order to create more than 4 partitions on the same disk, no more than 3 primary partitions can be created, leaving one partition entry for an extended partition. An extended partition can hold several logical drives. How many it can hold depends on the size of the disk, and the way that the operating system mounts disk drives. On DOS and Windows, this is the same as the number of letters in the English alphabet, which is 26. This is the total number of disk drives that can be mounted. If 3 partitions are primary, then the extended partition can hold 23=26-3 logical drives. DOS and Windows cannot boot from a logical drive. So in order to boot the operating system, at least 1 partition will have to be a primary partition. In this case, the extended partition can hold no more than 25=26-1 logical drives.

On a UNIX-like operating system, such as GNU Linux, everything is a file. For this reason, there is no limitation to how many disk drives can be mounted on these systems. Additionally, they can boot from a logical drive. This means that a MBR partitioned disk on a GNU Linux system can have more than 26 logical drives, and still boot from one of them! Of course, Linux can boot from more than one of them as well (multi-boot). Windows can do this too, but not from logical drives. (Newer versions of Windows might be able to do this. But originally, Windows was not designed to allow for booting more than one version, or another instance of the the same Windows version.)

On a GNU Linux system, a MBR partitioned SATA disk with 4 primary partitions will use the following naming scheme for the partitions.

/dev/sda1    primary
/dev/sda2    primary
/dev/sda3    primary
/dev/sda4    primary

If there is an extended partition, it will get the next name in the naming scheme, which is sda5.

/dev/sda1    primary
/dev/sda2    primary
/dev/sda3    primary
/dev/sda4    primary
/dev/sda5    logical
/dev/sda6    logical
/dev/sda7    logical

This is why logical partitions on Linux start from sda5 by default. The first 4 are reserved for primary partitions. Don't confuse the Linux device naming scheme with MBR partitioning scheme.

Even if there are only 3 primary partitions, the first logical partition will still get the name sda5.

/dev/sda1    primary
/dev/sda2    primary
/dev/sda3    primary
/dev/sda4    extended
  /dev/sda5    logical
  /dev/sda6    logical
  /dev/sda7    logical

This is also true if there is only 1 primary partition. The numbers don't have to come in consecutive order like 1, 2, 3.

/dev/sda1    primary
/dev/sda2    extended
  /dev/sda5    logical
  /dev/sda6    logical
  /dev/sda7    logical

The physical location of the data contained in a partition can be read by the partition sector start and end position. This is the sole purpose of a partition table, its reason for existence. The partition table is a reference table that tells the system where to look in order to read data or write data to that partition.

You can think of a partition as being physical, which is where the raw data is physically stored on a disk. It's actually not stored directly to the disk platter as bits and bytes. It's stored to a hardware-level format that's used internally by the disk controller board, which then encodes this information physically to a magnetic medium on the disk platter.

By contrast, a partition table is logical – it's a logical data structure. But that logical part has a physical location too, and we have already established that it's the first 512 bytes, or sector 1 on the disk (absolute sector 0 on an LBA addressed disk).

So when you do some common task like "selecting a partition", you are really not selecting the partition (the physical location of your files). The partition table by itself is not the partition. You are selecting a reference point in the partition table that points to a storage area on the disk. But in everyday use, we say that we are "selecting a partition".

Number  Start   End     Size    Type      File system     Flags
 1      1049kB  135MB   134MB   primary   ntfs            boot
 2      136MB   121GB   121GB   extended                  lba
 5      136MB   53.8GB  53.7GB  logical   ntfs
 6      53.8GB  70.2GB  16.4GB  logical   linux-swap(v1)
 7      70.2GB  121GB   51.2GB  logical   ext4
 3      121GB   139GB   17.2GB  primary   linux-swap(v1)
 4      139GB   192GB   53.7GB  primary   ext4

By this example, partition 3 and 4 are primary partitions. The reason Fedora Linux sees it this way is probably because these partitions have a starting position after the extended partition. In reality, I believe they are logical partitions. They seem to be chained to by the partition table sector in the EBR (Extended Boot Record) of the extended partition. I will have to examine the partition table entries in detail to be sure.

So it appears as if Linux allows for logical partitions to live outside of the boundary of the more traditional DOS/Windows type of extended partition. This is however not possible in DOS and Windows. In FDISK in DOS and early Windows versions, it's not possible to create a logical partition (logical drive) unless there is an extended partition on the disk, and logical partitions can only be created within the boundary of the extended partition. This is also true for Diskpart and Disk Management (Logical Disk Manager) in more recent versions of Windows.

Technically, an extended partition doesn't contain any filesystem. The logical partitions it describes do. So I imagine that an extended partition could be as small or as big as one makes them, as long as the tools that are used allow it, and it's big enough to hold the logical partition entries – one sector or 512 bytes. So only the first sector of the extended partition is important, the EBR.

windows-disk-management

By this example, I would say that Windows Disk Management tool sees the extended partition, and it marks it with the dark green color and displays the NTFS filesystem partition inside it. This is the only filesystem on this disk that Windows understands. Windows does not understand the Ext4 filesystem used on the partitions that follow. So for this reason, it assumes it's a primary partition and excludes it from the green extended partition box, and since these partitions have a starting position after the NTFS partition, it places them after it (to the right of it).

Windows pretty much describes every partition as "primary partition" if it contains a filesystem it doesn't understand.

Additionally, since this is a non-standard extended partition, with 2 daisy-chained logical partitions outside of the boundary of the regular extended partition it describes them too as primary partitions instead of logical partition.


Update: partition tables

I finally had some time to examine the partition tables in detail.

MBR Partition Table
===================
Partition entry 1 (1BE – 1CD): 80 3E 03 00 07 19 1B 46 00 08 00 00 00 00 04 00
Partition entry 2 (1CE – 1DD): 00 57 1C 46 0F 71 E1 FF FE 0F 04 00 02 28 1E 0E
Partition entry 3 (1DE – 1ED): 00 71 E1 FF 82 71 E1 FF 00 38 22 0E 00 00 00 02
Partition entry 4 (1EE – 1FD): 00 71 E1 FF 83 71 E1 FF 00 38 22 10 00 00 40 06
--------------------
Entry 1:
80 ► active partition
07 ► NTFS file system Windows, SYSTEM (Windows 10)
00 08 00 00 ► 00 00 08 00 = 2048
00 00 04 00 ► 00 04 00 00 = 262144 = 134217728 byte = 128 MiB
--------------------
Entry 2:
00 ► not active
0F ► Extended partition (LBA)
FE 0F 04 00 ► 00 04 0F FE = 266238
02 28 1E 0E ► 0E 1E 28 02 = 236857346 = 121270961152 byte = 112 GiB
--------------------
Entry 3:
00 ► not active
82 ► GNU Linux Swap space (FEDORA)
00 38 22 0E ► 0E 22 38 00 = 237123584
00 00 00 02 ► 02 00 00 00 = 33554432 = 17179869184 byte = 16 GiB
--------------------
Entry 4:
00 ► not active
83 ► GNU Linux files system (FEDORA)
00 38 22 10 ► 10 22 38 00 = 270678016
00 00 40 06 ► 06 40 00 00 = 104857600 = 53687091200 byte = 50 GiB

EBR Partition Table 1
=====================
Partition entry 1 (81FFDBE – 81FFDCD): 00 57 1E 46 07 71 E1 FF 02 00 00 00 00 00 40 06
Partition entry 2 (81FFDCE – 81FFDDD): 00 71 E1 FF 05 71 E1 FF D2 05 40 06 30 42 E8 01
Partition entry 3 (81FFDDE – 81FFDED): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Partition entry 4 (81FFDEE – 81FFDFD): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
--------------------
Entry 1:
00 ► not active
07 ► NTFS file system Windows, BOOT (Windows 10)
02 00 00 00 ► 00 00 00 02 = 2 (266240 absolute)
00 00 40 06 ► 06 40 00 00 = 104857600 = 53687091200 byte = 50 GiB
--------------------
Entry 2:
00 ► not active
05 ► Extended partition (CHS)
D2 05 40 06 ► 06 40 05 D2 = 104859090 (105125328 absolute)
30 42 E8 01 ► 01 E8 42 30 = 31998512 = 16383238144 byte = 15 GiB

EBR Partition Table 2
=====================
Partition entry 1 (C882BA1BE – C882BA1CD): 00 71 E1 FF 82 71 E1 FF 30 02 00 00 00 40 E8 01
Partition entry 2 (C882BA1CE – C882BA1DD): 00 71 E1 FF 05 71 E1 FF 26 4C 28 08 DC DB F5 05
Partition entry 3 (C882BA1DE – C882BA1ED): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Partition entry 4 (C882BA1EE – C882BA1FD): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
--------------------
Entry 1:
00 ► not active
82 ► GNU Linux Swap space (UBUNTU)
30 02 00 00 ► 00 00 02 30 = 560 (105125888 absolute)
00 40 E8 01 ► 01 E8 40 00 = 31997952 = 16382951424 byte = 15 GiB
--------------------
Entry 2:
00 ► not active
05 ► Extended partition (CHS)
26 4C 28 08 ► 08 28 4C 26 = 136858662 (137124900 absolute)
DC DB F5 05 ► 05 F5 DB DC = 99998684 = 51199326208 byte = 47 GiB

EBR Partition Table 3
=====================
Partition entry 1 (1058B849BE – 1058B849CD): 00 71 E1 FF 83 71 E1 FF DC 03 00 00 00 D8 F5 05
Partition entry 2 (1058B849CE – 1058B849DD): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Partition entry 3 (1058B849DE – 1058B849ED): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Partition entry 4 (1058B849EE – 1058B849FD): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
--------------------
Entry 1:
00 ► not active
83 ► GNU Linux files system (UBUNTU)
DC 03 00 00 ► 00 00 03 DC = 988 (137125888 absolute)
00 D8 F5 05 ► 05 F5 D8 00 = 99997696 = 51198820352 byte = 47 GiB

As you can see, this corresponds to the graphical view in Disk utility in Fedora. So this confirms that Disk, fdisk, and parted were all showing the partitions correctly. In other words, Fedora installer did create two primary partitions at the end of the disk; instead of creating two logical partitions like it was supposed to do. It achieved this by resizing (shrinking) the original extended partition that stretched from its current starting sector to the end of the disk. Thus fooling me into thinking that the two primary partitions were logical partitions that (by some magical spell) ended up on the outside of the extended partition, but were set incorrectly to appear as "primary". I could not have been more wrong! The two Fedora partitions are in fact primary partitions!

Why did Fedora do this then?... my guess is that it ran into some kind of error during partitioning and setup process and didn't know how to handle it. I can only assume that it had something to do with the firmware bug in the Intel SATA controller ROM for ICH9R that I recently encountered, where the system would choke during boot whenever AHCI mode is used, unless the CHS ending position for the first partition is set to FE FF FF. Because I have one 128 MiB partition at the beginning of the disk that serves as my system/boot partition, it fits inside the first 1024 cylinders. For this reason, the calculated CHS ending position for this partition was lower than FE FF FF and I was actually having some problems with diskpart to partition the disk initially. I had to reboot and manually set this value to FE FF FF before I could successfully create a new MBR on it (using diskpart, so assuming it did the job of correctly setting the CHS value this time around) and partition the disk and install Windows 10 preview on it, and then Ubuntu 15.04, and then Fedora.

But I actually ended up with a small partition gap at the beginning of the extended partition (as I recall it). I thought it was a bit strange, but I think Ubuntu installer ironed out that bit somehow during install. Then I installed Fedora, and chose to install it on 2 separate and logical partitions. But apparently it managed to fool me, and not do what I asked of it in the "expert partitioner" mode.

So there is any number of reasons this could have gone wrong, right from the beginning. This only proves that I was wrong, and Disk utility (along with fdisk and parted) was right! ;-) I just know for sure that I am not installing Fedora in a multi-boot configuration again anytime soon. The installer just doesn't seem to be as well built as the one used by Ubuntu, at least not for this type of setup.

The graphical view of the partitions inside Windows does match up with what that Fedora is showing. Except for the extended partition. This is likely because Windows doesn't know how to interpret the logical partitions inside the extended partitions, unless they are of some common Windows file system type like NTFS. This breaks the EBR chain for Windows so it only shows the first one (the one it understands) as being inside the extended partition, and assumes the rest of them are regular primary partitions with unknown file system type.

The short answer to this question therefore is: the two Fedora partitions appear that way because they are in fact primary partitions, and not logical partitions.

6
  • Although somewhat related to your question, it most definitely isn’t an answer, sorry.
    – Daniel B
    Jul 2, 2015 at 13:19
  • I will examine the disk in more detail. But I think I'm on the right track. This is a non-standard extended partition. Not the type that DOS and Windows understands anyway. As Linux is a robust system, it can still make use of these partitions.
    – Samir
    Jul 2, 2015 at 20:29
  • I will manually edit the extended partition and make it run to the end of the disk and see what happens. I expect partition 3 and 4 to change into "logical" partitions. If I am right, they are already logical. They are just a bit out of the ordinary. I did state that in the question that I had chosen to create two logical partitions for Fedora in Anaconda. Something might be wrong with the Anaconda installation wizard, I don't think it was supposed to do it like this. I also had a problem later on with the grub.cfg where it referenced the first boot option with /dev/sda4 instead of UUID.
    – Samir
    Jul 2, 2015 at 20:37
  • @sammyg Don’t do that. You can’t magically change partitions to logical volumes by enlarging the Extended Partition. They are also not logical volumes, as was clearly indicated by the various tools you used.
    – Daniel B
    Jul 2, 2015 at 20:39
  • @DanielB You have a better suggestion? I am not using LVM if that's what you mean. Why do you call them logical volumes? I specifically asked both Ubiquity and Anaconda to create logical partitions. I just didn't expect Fedora to chain its partitions to the end of the disk like that. I used a lot of tools and examples. Which tool are you referring to, and which partitions do you think are logical volumes?
    – Samir
    Jul 2, 2015 at 21:20

You must log in to answer this question.

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