2

I am trying to learn and especially understand how partitionning and boot-loaders work. The problem is that I got it all twisted in my mind. In the end I don't understand anything anymore.

I know how to partition a hard drive using fdisk, parted, gdisk. I tried chainloading iso files (such as ubuntu.iso, arch.iso) with syslinux.

To illustrate my confusion, here is what I have done : Creating a linux partition :

$ gdisk /dev/sdb
Command (? for help): n
Partition number (1-128, default 1): 
First sector (34-7821278, default = 36) or {+-}size{KMGTP}: 
Last sector (36-7821278, default = 7821278) or {+-}size{KMGTP}: 
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 
Changed type of partition to 'Linux filesystem'

Command (? for help): p
Disk /dev/sdb: 7821312 sectors, 3.7 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): F7F2BE49-B8D8-4910-8E69-381DEBD954DC
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 7821278
Partitions will be aligned on 4-sector boundaries
Total free space is 2 sectors (1024 bytes)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              36         7821278   3.7 GiB     8300  Linux filesystem

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/sdb.
The operation has completed successfully.

Then I formatted this partition as an ext2 :

$ mkfs.ext2 /dev/sdb1

Now I want to install MBR with syslinux (taken from the very few tutorials I found)

$ syslinux -m /dev/sdb1
syslinux: invalid media signature (not a FAT filesystem?)

So it needs to be a FAT partition. However I read that syslinux supports Fat32, ext2, ext3, ext4 file (https://wiki.archlinux.org/index.php/syslinux#Installation)

1) What is wrong here, since syslinux is supposed to support ext2 partitions?

So I formatted the partition as a Fat32 partition :

$ mkfs.vfat -F 32 /dev/sdb1

Now installing the syslinux MBR works:

$ syslinux -m /dev/sdb1
$ syslinux -i /dev/sdb1

2) Do I have to install a MBR, isn't syslinux compatible with GPT? I read on documentations that GPT has more advantages over MBR, such as allowing the creation of way more primary partitions. Did I misunderstand?

I then found that I need to flag the partition as bootable (http://www.linuxquestions.org/questions/linux-general-1/booting-iso-images-from-a-usb-disk-917161/). Can I do that with gdisk ? It seems to me it is not possible as the manual does not talk about boot flagging. In the other hand, fdisk allows me to do so. However here is another issue :

$ fdisk /dev/sdb

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.

3) Does gdisk automaticaly create a GPT ?

$ gdisk /dev/sdb
GPT fdisk (gdisk) version 0.8.8

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

4) Where does this MBR come from? How can MBR and GPT coexist like this?

As you can see, as soon as I tried doing more in depth partition manipulations, I realized everything was mixed up. I would sincerely appreciate if you could answer my questions and especially provide me with additional documentation : https://wiki.archlinux.org and http://www.syslinux.org/wiki actually made my understanding worse than ever. Many thanks.

1

1) What is wrong here, since syslinux is supposed to support ext2 partitions?

Yes, Syslinux supports ext2 fs via Extlinux. If you are using a UEFI/EFI based system then you need a fat32 partition. For GPT only you don't need to have a fat32 partition, just go with the traditional. i.e. ext?

2) Do I have to install a MBR, isn't syslinux compatible with GPT? I read on documentations that GPT has more advantages over MBR, such as allowing the creation of way more primary partitions. Did I misunderstand?

It's up to you what do you want to use, both partition table msdos and gpt are supported.

In case of GPT you can use gdisk to set legacy bios boot flag. It's necessary to have a legacy bios boot flag on boot partition. After entering in gdisk menu use 'x' to go into expert mode and then use 'a' to set attributes.

3) Does gdisk automaticaly create a GPT ?

Yes, Visit http://linux.die.net/man/8/gdisk

For How To, visit http://wiki.gentoo.org/wiki/Syslinux

| improve this answer | |
  • THanks a lot, the gentoo documention was great. Th truth is, now I totally understand the Arch one! – kaligne Oct 17 '14 at 9:56
0

I think the problem/confusion here is on terminology, first saying "installing an MBR" and then "why is an MBR along with a GPT". The MBR is something necessary for the disk to work, the GPT is a partitioning scheme that exists (is created) beyond the MBR. Partitioning software, like gparted, are presenting you with MBR and GPT as two mutually exclusive things. GPT or lack of GPT would have been more accurate. There are other systems that use other schemes than GPT, still defined within the disk's MBR. So to understand it better on both partitioning schemes the first sector 0-1 is always an MBR, GPT definition begins after it. What we call an MBR partitioning and extended partitioning is something without the GPT (which doesn't need a distinction for extended, it allows as many pieces as they can fit by the minimum size of a partition and the size of the disk).

You don't install an MBR, it exists by default, and it better be there or your disk is trash. You install things into the MBR, like grub's core.img or the syslinux equivalent, which is software helping you to go to the next step. A tiny little operating system helping you "reboot" to the specific other system. A GPT definition exists in MBR for the GPT scheme to work.

It is those *.img operating systems that give you a prompt to do things manually if /boot/grub or /boot/syslinux are erased or have not been created yet. If you mess around with installations long enough someday you will see it. GRUB> try help at that point. The way it helps me understand it is this bootloader operating system produces that menu or the prompt and there you specify to reboot grub/syslinux to the specific target operating system. If it wasn't for rebooting then the bootloader would have been process 1 PID1.

Some of what I am saying may not be 100% accurate, but I think for 96.4% of linux users it helps to move on to what they want to do. Bootloader developers and those working in software for backing up, copying, compressing images of disks, etc. will need more accurate detail. If you search you will find hour long lectures on the problems and dynamics of that first little cell of the disk and what must be there for everything else to exist. Our systems are hanging by this thread of very sensitive information. It is like your map to the labyrinth, otherwise you are just a snack for the Minotaur.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.