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.