You are not logged in.

#1 2013-02-05 02:27:06

matth
Member
Registered: 2011-11-09
Posts: 24

[Solved] Syslinux GPT and boot partition

I am using GPT and syslinux. I am trying to use a separate boot partition from root as follows:

/dev/sda1 /boot
/dev/sda2 swap
/dev/sda3 /
/dev/sda4 /var
/dev/sda5 /home

Syslinux seems to install fine, but when I try to boot I get No OS message from BIOS.

However, if I don't mount boot and just create the boot folder right on the root partition (install kernel and syslinux there) it boots fine. What about the boot partition makes this not work?


Here are my partitions:

$ gdisk -l /dev/sda
GPT fdisk (gdisk) version 0.8.5

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

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 234441648 sectors, 111.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 3D1148F3-AF40-41BC-861F-ADE6886CCA84
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 234441614
Partitions will be aligned on 2-sector boundaries
Total free space is 0 sectors (0 bytes)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              34         1024033   500.0 MiB   8300  boot
   2         1024034         9412641   4.0 GiB     8200  swap
   3         9412642        40869921   15.0 GiB    8300  arch
   4        40869922        72327201   15.0 GiB    8300  var
   5        72327202       234441614   77.3 GiB    8300  home
$ fdisk -l

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

Disk /dev/sda: 120.0 GB, 120034123776 bytes, 234441648 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
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1   234441647   117220823+  ee  GPT

A second option I tried to see if it was something about sda1 was the following, but this worked fine as well.

/dev/sda1 /
/dev/sda2 swap
/dev/sda3 /home

I'm just hoping to use a separate boot partition, but can't figure out why it won't work.


Edit: to mark as solved.

Last edited by matth (2013-02-07 01:34:34)

Offline

#2 2013-02-05 04:06:57

jynnantonix
Member
Registered: 2012-09-07
Posts: 33

Re: [Solved] Syslinux GPT and boot partition

Sounds like you need to set the boot flag on your boot partition.  This seems relevant https://wiki.archlinux.org/index.php/Sy … le_aka_GPT

Offline

#3 2013-02-05 04:26:13

srs5694
Member
From: Woonsocket, RI
Registered: 2012-11-06
Posts: 719
Website

Re: [Solved] Syslinux GPT and boot partition

jynnantonix wrote:

Sounds like you need to set the boot flag on your boot partition.  This seems relevant https://wiki.archlinux.org/index.php/Sy … le_aka_GPT

You're probably correct, but I want to clarify some terminology, since this can be very confusing:

  • Legacy BIOS bootable attribute -- This is the official name of the relevant feature, as described in the UEFI specification (version 2.3.1, p. 105, Table 19). It's set by setting the "legacy_boot flag" in parted or its relatives, or by setting attribute bit #2 using the "a" option on the experts' menu in gdisk. (The wiki to which you linked describes doing this with sgdisk.) It's used by SYSLINUX's GPT support to identify a partition that holds second-stage boot code.

  • The "boot flag" on MBR disks -- On MBR disks, the "boot flag" is a bit that can be set using either fdisk or parted. It's analogous to the GPT legacy BIOS bootable attribute, since it serves the same purpose. Note that on a GPT disk, it's possible (although technically a violation of the spec) to set this flag on the protective 0xEE partition. You can do this with fdisk, but not with parted, since the latter lacks a user interface to do anything explicit with the protective 0xEE MBR partition. (This is reportedly changing with in-development versions of parted, but AFAIK the changed version hasn't been released.) Some buggy BIOSes require the MBR boot flag to be set on the 0xEE protective partition to boot the disk in BIOS mode.

  • The parted "boot flag" on GPT disks -- This is parted's way of identifying an EFI System Partition (ESP), and it has nothing to do with either the legacy BIOS bootable attribute or an MBR boot flag. This "flag" really changes the partition type code. gdisk reports a partition on which parted has set this "flag" as having a type code of EF00.

Offline

#4 2013-02-05 17:22:54

haul4ss
Member
Registered: 2013-02-05
Posts: 4

Re: [Solved] Syslinux GPT and boot partition

Some quick thoughts off the top of my head...

During the install, are you mounting all of your additional partitions in their respective subdirectories of /mnt? So, are you making /mnt/boot and mounting /dev/sda1 there?

Before you run the Syslinux install command, did you install gptfdisk? You'll need that to mark a GPT partition with the legacy BIOS bootable attribute. Running "syslinux-install_update -a" after installing gptfdisk will set the flag properly.

Offline

#5 2013-02-06 01:25:13

matth
Member
Registered: 2011-11-09
Posts: 24

Re: [Solved] Syslinux GPT and boot partition

Thanks everyone for the suggestions, however so far I have tried all of these things.

jynnantonix wrote:

Sounds like you need to set the boot flag on your boot partition.  This seems relevant https://wiki.archlinux.org/index.php/Sy … le_aka_GPT

Yes, that is set. You can see the * in Boot section of fdisk.
Also,

sgdisk /dev/sda --attributes=1:show
1:2:1 (legacy BIOS bootable)
haul4ss wrote:

Some quick thoughts off the top of my head...

During the install, are you mounting all of your additional partitions in their respective subdirectories of /mnt? So, are you making /mnt/boot and mounting /dev/sda1 there?

Before you run the Syslinux install command, did you install gptfdisk? You'll need that to mark a GPT partition with the legacy BIOS bootable attribute. Running "syslinux-install_update -a" after installing gptfdisk will set the flag properly.

Yes, I mounted all subdirectories under part of /mnt and all of the files installed to that partition properly when I install them in the arch-chroot system.

gptfdisk is installed, and actually syslinux-install_update throws errors when trying to write the boot flags to the GPT partitions without gptfdisk installed.


When installing without using the boot partition and creating the boot folder right on root everything seems the same as far as I can tell as far as the partition flags go.

Offline

#6 2013-02-06 07:41:08

cinelli
Package Maintainer (PM)
From: Los Angeles, California
Registered: 2012-08-10
Posts: 22
Website

Re: [Solved] Syslinux GPT and boot partition

Lets have a look at your syslinux.cfg

Also, paste what ls /boot shows from within chroot

Yes, I mounted all subdirectories under part of /mnt and all of the files installed to that partition properly when I install them in the arch-chroot system.

You are aware that arch-chroot does not mount /boot for you ?

Also, looking back at your origional post, are you back to using the 5 partition setup? I'm kind of confused by what's actually being used for a partition setup at the moment.


aur::dotshare.it::blog
"Stay true."

Offline

#7 2013-02-06 13:00:59

haul4ss
Member
Registered: 2013-02-05
Posts: 4

Re: [Solved] Syslinux GPT and boot partition

While you're copy/pasting, paste your /etc/fstab as well. This way we can verify that all of the partitions are listed in there, and that the options are correct. You may not even be getting that far in the boot process, though.

Also, wild guess and probably not relevant: when you re-created the partitions the other times, did you change the partition alignment at all? Mine are aligned on 2048-sector boundaries, which is gdisk's default.

Thanks for your patience as we take stabs in the dark. smile

Offline

#8 2013-02-06 13:10:57

haul4ss
Member
Registered: 2013-02-05
Posts: 4

Re: [Solved] Syslinux GPT and boot partition

Oh good grief, I just looked out your gdisk output again... your boot partition has the wrong type code. It needs to be ef02, not 8300. It's one of the options as you're creating the partitions in gdisk.

Offline

#9 2013-02-06 13:23:16

msthev
Member
Registered: 2012-04-05
Posts: 177

Re: [Solved] Syslinux GPT and boot partition

haul4ss wrote:

It needs to be ef02, not 8300.

It's not true.
https://wiki.archlinux.org/index.php/Pa … ern_Method

Warning: If planning to use the GPT partitioned SSD as a boot-disk on a BIOS based system (most systems except Apple computers and some very rare motherboard models with Intel chipset) one may have to create, preferably at the disk's beginning, a 2 MiB partition with no filesystem and with the partition type as BIOS boot or bios_grub partition (gdisk type code EF02) for booting from the disk using GRUB. For Syslinux, one does not need to create a separate 2 MiB bios_grub partition, but one needs to have separate /boot partition and enable Legacy BIOS Bootable partition attribute for that partition (using gdisk). See GPT for more information.

I only have 8300 partitions (/boot, / and /home) and I don't have any problems.

@topic
If you have the legacy BIOS bootable attribute set, try installing Syslinux without the -a switch.

Offline

#10 2013-02-06 14:27:14

haul4ss
Member
Registered: 2013-02-05
Posts: 4

Re: [Solved] Syslinux GPT and boot partition

msthev wrote:

I only have 8300 partitions (/boot, / and /home) and I don't have any problems.

You learn something new every day...

Offline

#11 2013-02-06 15:03:15

CrashLog
Member
From: Finland
Registered: 2013-01-13
Posts: 136

Re: [Solved] Syslinux GPT and boot partition

To be fair it says so right in the Beginners' guide smile

The Guide wrote:

If you have a BIOS motherboard (or plan on booting in BIOS compatibility mode) and you want to setup GRUB on a GPT-partitioned drive, you will need to create a 2 MiB "BIOS Boot Partition". Syslinux doesn't need one.

OP, I'm just wondering if you've done as the guide says here?
https://wiki.archlinux.org/index.php/Be … e#Syslinux


"There are no problems, only opportunities for solutions."

Offline

#12 2013-02-07 00:31:01

matth
Member
Registered: 2011-11-09
Posts: 24

Re: [Solved] Syslinux GPT and boot partition

Wow, a lot of replies today. Thanks everyone! I'm back at it again. Heres replies to everything.

cinelli wrote:

You are aware that arch-chroot does not mount /boot for you ?

Yes, I mounted all of the partitions under /mnt before using arch-chroot /mnt/boot /mnt/home etc...

cinelli wrote:

Also, looking back at your origional post, are you back to using the 5 partition setup? I'm kind of confused by what's actually being used for a partition setup at the moment.

Yes, I am using the 5 partition setup. That is the one I want, the others were just tests trying to figure out why it wasn't working.


haul4ss wrote:

While you're copy/pasting, paste your /etc/fstab as well. This way we can verify that all of the partitions are listed in there, and that the options are correct. You may not even be getting that far in the boot process, though.

Files below. When I have syslinux on /boot it doesn't even start syslinux... so it isn't getting to fstab

haul4ss wrote:

Also, wild guess and probably not relevant: when you re-created the partitions the other times, did you change the partition alignment at all? Mine are aligned on 2048-sector boundaries, which is gdisk's default.

I was using cgdisk to partition the hard drive, so I used whatever the default for that was. It was the same time every time I did it.

CrashLog wrote:

OP, I'm just wondering if you've done as the guide says here?
https://wiki.archlinux.org/index.php/Be … e#Syslinux

Yes, This is what I used to setup syslinux.


Here comes the files!

/etc/fstab

# 
# /etc/fstab: static file system information
#
# <file system>	<dir>	<type>	<options>	<dump>	<pass>
y
# /dev/sda3
UUID=2833a1a0-0aaf-4ae9-b231-f6bb41a694cf	/         	ext4      	defaults,relatime	0 1

# /dev/sda1
UUID=734f8016-f5cb-4b61-aa88-f26b2d099de5	/boot     	ext4      	defaults,relatime	0 2

# /dev/sda4
UUID=7bb985e3-71c1-455d-923b-2c4b849669f9	/var      	ext4      	defaults,relatime	0 2

# /dev/sda5
UUID=e26904cf-d004-4347-822f-0fad576c4f49	/home     	ext4      	defaults,relatime	0 2

# /dev/sda2
UUID=ca5a8b50-6f84-47e3-b94a-8d3680da176a	none      	swap      	defaults  	0 0

/boot/syslinux/syslinux.cfg - This is just default as it defaults to /dev/sda3 as root, which is my root

# Config file for Syslinux -
# /boot/syslinux/syslinux.cfg
#
# Comboot modules:
#   * menu.c32 - provides a text menu
#   * vesamenu.c32 - provides a graphical menu
#   * chain.c32 - chainload MBRs, partition boot sectors, Windows bootloaders
#   * hdt.c32 - hardware detection tool
#   * reboot.c32 - reboots the system
#   * poweroff.com - shutdown the system
#
# To Use: Copy the respective files from /usr/lib/syslinux to /boot/syslinux.
# If /usr and /boot are on the same file system, symlink the files instead
# of copying them.
#
# If you do not use a menu, a 'boot:' prompt will be shown and the system
# will boot automatically after 5 seconds.
#
# Please review the wiki: https://wiki.archlinux.org/index.php/Syslinux
# The wiki provides further configuration examples

DEFAULT arch
PROMPT 0        # Set to 1 if you always want to display the boot: prompt 
TIMEOUT 50
# You can create syslinux keymaps with the keytab-lilo tool
#KBDMAP de.ktl

# Menu Configuration
# Either menu.c32 or vesamenu32.c32 must be copied to /boot/syslinux 
UI menu.c32
#UI vesamenu.c32

# Refer to http://syslinux.zytor.com/wiki/index.php/Doc/menu
MENU TITLE Arch Linux
#MENU BACKGROUND splash.png
MENU COLOR border       30;44   #40ffffff #a0000000 std
MENU COLOR title        1;36;44 #9033ccff #a0000000 std
MENU COLOR sel          7;37;40 #e0ffffff #20ffffff all
MENU COLOR unsel        37;44   #50ffffff #a0000000 std
MENU COLOR help         37;40   #c0ffffff #a0000000 std
MENU COLOR timeout_msg  37;40   #80ffffff #00000000 std
MENU COLOR timeout      1;37;40 #c0ffffff #00000000 std
MENU COLOR msg07        37;40   #90ffffff #a0000000 std
MENU COLOR tabmsg       31;40   #30ffffff #00000000 std

# boot sections follow
#
# TIP: If you want a 1024x768 framebuffer, add "vga=773" to your kernel line.
#
#-*

LABEL arch
	MENU LABEL Arch Linux
	LINUX ../vmlinuz-linux
	APPEND root=/dev/sda3 ro
	INITRD ../initramfs-linux.img

LABEL archfallback
	MENU LABEL Arch Linux Fallback
	LINUX ../vmlinuz-linux
	APPEND root=/dev/sda3 ro
	INITRD ../initramfs-linux-fallback.img

#LABEL windows
#        MENU LABEL Windows
#        COM32 chain.c32
#        APPEND hd0 1

LABEL hdt
        MENU LABEL HDT (Hardware Detection Tool)
        COM32 hdt.c32
 
LABEL reboot
        MENU LABEL Reboot
        COM32 reboot.c32
 
LABEL off
        MENU LABEL Power Off
        COMBOOT poweroff.com

ls -l /boot

total 19992
-rw-r--r-- 1 root root 13789578 Feb  4 15:25 initramfs-linux-fallback.img
-rw-r--r-- 1 root root  2998347 Feb  4 15:25 initramfs-linux.img
drwx------ 2 root root    12288 Feb  4 14:52 lost+found
drwxr-xr-x 2 root root     1024 Feb  4 15:40 syslinux
-rw-r--r-- 1 root root  3668864 Jan 28 04:07 vmlinuz-linux

ls -l /boot/syslinux

total 1389
-rw-r--r-- 1 root root  38568 Feb  4 15:58 chain.c32
-rw-r--r-- 1 root root 348888 Feb  4 15:58 hdt.c32
-r--r--r-- 1 root root  37376 Feb  4 15:58 ldlinux.sys
-rw-r--r-- 1 root root  55140 Feb  4 15:58 menu.c32
-rw-r--r-- 1 root root 780537 Feb  4 15:58 pci.ids
-rw-r--r-- 1 root root    239 Feb  4 15:58 poweroff.com
-rw-r--r-- 1 root root    800 Feb  4 15:58 reboot.c32
-rw-r--r-- 1 root root      0 Feb  4 15:58 SYSLINUX_AUTOUPDATE
-rw-r--r-- 1 root root   2369 Oct 23 10:44 syslinux.cfg
-rw-r--r-- 1 root root 154128 Feb  4 15:58 vesamenu.c32

Offline

#13 2013-02-07 00:50:38

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,130

Re: [Solved] Syslinux GPT and boot partition

Have you tried installing syslinux manually? See https://wiki.archlinux.org/index.php/Sy … le_aka_GPT.

I'd be suspicious about your partition set up. It is not at all normal to align on 2-sector boundaries or to begin at 34.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#14 2013-02-07 00:54:14

matth
Member
Registered: 2011-11-09
Posts: 24

Re: [Solved] Syslinux GPT and boot partition

msthev wrote:

@topic
If you have the legacy BIOS bootable attribute set, try installing Syslinux without the -a switch.

Wow, that one seemed to do it!

I had tried booting into setup.. mounting all of the partitions. arch-chroot to /mnt
syslinux-install_update -i -a -m check over everything and reboot to No OS...

This time.. The same thing except syslinux-install_update -i -m and it works!


Thank you very much everyone for all of the help!!

Offline

#15 2013-02-07 00:55:41

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,130

Re: [Solved] Syslinux GPT and boot partition

I would still be suspicious of that partitioning.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#16 2013-02-07 01:07:36

matth
Member
Registered: 2011-11-09
Posts: 24

Re: [Solved] Syslinux GPT and boot partition

cfr wrote:

Have you tried installing syslinux manually? See https://wiki.archlinux.org/index.php/Sy … le_aka_GPT.

Yup, I tried that too with the same result.. but as I just replied in the previous post installing it without the -a flag seemed to work.

cfr wrote:

I'd be suspicious about your partition set up. It is not at all normal to align on 2-sector boundaries or to begin at 34.

I would really like to learn more about this. Why is it not normal to align on on 2-sector boundaries or begin at 34? I don't know a lot about partitioning so I go with either a guide or the tool's defaults.

These settings are what cgdisk defaulted to when setting it up... so I went with the defaults like I always used to with MBR and fdisk.

For example... for the first partition, I did the following.
  1. New Partition on free space
  2. It prompted with First sector with default=34 showing
  3. I went with default
  4. Next prompt is for Size in sectors or {KMGTP}
  5. I put in 500M
  6. Next was Hex code (8300) then partition name
  7. Now the second one New Partition on free space
  8. It prompted with First sector with default=1024034 showing
  9. I went with default
10. Next prompt is for Size in sectors or {KMGTP}
11. I put in 4G
12. And so on to partition all of the drive.

Offline

#17 2013-02-07 01:12:05

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,130

Re: [Solved] Syslinux GPT and boot partition

From man cgdisk:

Align  Change the sector alignment value. Disks with more logical sectors than physical sectors (such as modern  Advanced  Format
              drives),  some  RAID  configurations,  and many SSD devices, can suffer performance problems if partitions are not aligned
              properly for their internal data structures. On new disks, GPT fdisk attempts to align partitions  on  2048-sector  (1MiB)
              boundaries  by  default,  which  optimizes  performance  for  all of these disk types. On pre-partitioned disks, GPT fdisk
              attempts to identify the alignment value used on that disk, but will set 8-sector alignment on disks larger  than  300  GB
              even if lesser alignment values are detected. In either case, it can be changed by using this option.

gdisk has always used the defaults when I've used it on both hdds and sdds. (I've tended to use gdisk rather than cg/sgdisk but I don't think that should matter.)

EDIT: You can also use these programmes to verify that partitions are aligned correctly.

Last edited by cfr (2013-02-07 01:15:03)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#18 2013-02-07 01:32:59

matth
Member
Registered: 2011-11-09
Posts: 24

Re: [Solved] Syslinux GPT and boot partition

cfr wrote:

gdisk has always used the defaults when I've used it on both hdds and sdds. (I've tended to use gdisk rather than cg/sgdisk but I don't think that should matter.)

EDIT: You can also use these programmes to verify that partitions are aligned correctly.

Thanks. I just tried creating a new partition table with gdisk to see what it would do. It created one with the First usable sector at 34 and the partitions aligned on 2048-sector boundaries.

I wonder if I should re-partition now... it is still early enough to start over.

Offline

#19 2013-02-07 01:47:39

srs5694
Member
From: Woonsocket, RI
Registered: 2012-11-06
Posts: 719
Website

Re: [Solved] Syslinux GPT and boot partition

matth wrote:

I would really like to learn more about this. Why is it not normal to align on on 2-sector boundaries or begin at 34? I don't know a lot about partitioning so I go with either a guide or the tool's defaults.

As the author of GPT fdisk (gdisk, cgdisk, and sgdisk), I think I can shed some light on this. In the distant past, partitions were aligned on cylinder boundaries because this provided performance benefits. Over the years, though "cylinder boundaries" became a convenient fiction, then an inconvenient fiction, and they're now a downright harmful fiction. On many types of modern disks (most notably Advanced Format disks, SSDs, and some types of RAID arrays), it's beneficial to align partitions on certain power-of-2 multiples of sectors. For Advanced Format disks, that value is 8 sectors, since an Advanced Format disk has 4096-byte physical sectors that the disk presents to the computer as 8 512-byte sectors. Most filesystems use data structures that are sized in multiples of 4096 bytes, too. Thus, if you start a partition on something other than a multiple of 8 sectors, the 4096-byte filesystem data structures will straddle two physical sectors. This isn't too much of a problem for disk reads, but writes get slowed down, since to write that 4096-byte data structure, the disk must read two sectors, modify their contents, and then write both sectors back out. This requires at least one full rotation of the disk. I ran some benchmarks on this that were published here. The results are really quite stunning: A performance drop of up to 25x, meaning that an operation that takes 1 second on a properly-aligned partition could take up to 25 seconds on a misaligned partition. To be sure, that problem was worst with ReiserFS, which isn't all that popular these days, but no filesystem was completely unaffected.

There are similar problems with SSDs and RAID arrays, but for them, the proper alignment is on larger values, which vary depending on the device. Typical values for proper alignment are in the 32KiB to 256KiB range, but some can be higher than this. Thus, to give a little "breathing room" above this value, Microsoft began aligning partitions on 1MiB values (2048 sectors) with Windows Vista. Such alignment works properly on everything from Advanced Format disks up to most SSDs and RAID arrays, with the tiny cost of a small amount of wasted space at the start of the disk. Linux tools were slow to follow, but most of them now do the same, although there are variants on this. GPT fdisk, in particular, attempts to determine the disk's existing alignment, so as to avoid nagging users about "misalignment" when the user set up a disk with other than 2048-sector alignment because they know what they're doing. GPT fdisk will still increase the default alignment to 2048 sectors on disks over a certain size, since such disks are usually Advanced Format disks; but on smaller disks, it'll use the existing alignment if it's something smaller than that.

Thus, my suspicion is that matth's disk was originally partitioned with something other than gdisk. Perhaps it was even an MBR disk partitioned with the old software that aligns on cylinder boundaries -- with such disks, the first partition normally starts at sector 63. After converting to GPT and deleting the old partitions, GPT fdisk would start the first partition at sector 34, which is the first usable sector on a GPT disk with a standard-sized partition table.

Since your disk is 112GiB in size, matth, I see two possibilities for what it is:

  • An older spinning disk -- If the disk is an older spinning disk, it's almost certainly not an Advanced Format model, since AFAIK the smallest Advanced Format disks are 360GB or thereabouts in size. If this is the case, there's no problem with starting your first sector at 34.

  • A newer SSD -- In this case, the disk will have a design that makes it work best with partitions aligned to some value or other that's probably measured in the tens to hundreds of KiB, on a power-of-2 multiple. Since 34 is not such a value, using that type of alignment will almost certainly degrade performance and could even contribute to accelerated failure of the disk, since there will be more writes than necessary to the device. In this case, re-aligning the partitions (using GParted or by doing a backup, re-partition, and restore) is in order.

Offline

#20 2013-02-07 02:16:56

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,130

Re: [Solved] Syslinux GPT and boot partition

Just curious. Information about my hdd says that it uses 4,096 byte sectors and 512 emulation. It doesn't specifically mention "advanced format", though, and not only is my disk only 320G but the same information is supposed to apply to 160G and 250G models as well.

I used gdisk to partition and used the defaults so mine is aligned in any case but I'm just idly curious about whether I needed to be sure of that or not. I know gdisk does it by default but I always checked anyway with the verify option and just looking at the table.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#21 2013-02-07 02:18:03

matth
Member
Registered: 2011-11-09
Posts: 24

Re: [Solved] Syslinux GPT and boot partition

srs5694 wrote:

Thus, my suspicion is that matth's disk was originally partitioned with something other than gdisk. Perhaps it was even an MBR disk partitioned with the old software that aligns on cylinder boundaries -- with such disks, the first partition normally starts at sector 63. After converting to GPT and deleting the old partitions, GPT fdisk would start the first partition at sector 34, which is the first usable sector on a GPT disk with a standard-sized partition table.

Since your disk is 112GiB in size, matth, I see two possibilities for what it is:

  • An older spinning disk -- If the disk is an older spinning disk, it's almost certainly not an Advanced Format model, since AFAIK the smallest Advanced Format disks are 360GB or thereabouts in size. If this is the case, there's no problem with starting your first sector at 34.

  • A newer SSD -- In this case, the disk will have a design that makes it work best with partitions aligned to some value or other that's probably measured in the tens to hundreds of KiB, on a power-of-2 multiple. Since 34 is not such a value, using that type of alignment will almost certainly degrade performance and could even contribute to accelerated failure of the disk, since there will be more writes than necessary to the device. In this case, re-aligning the partitions (using GParted or by doing a backup, re-partition, and restore) is in order.

Wow, thank you very much. That was very informative. It is awesome to see the author of GPT fdisk replying to this.

This is indeed an older spinning disk. This is an older laptop that used to have a Windows Vista install on it.. so it was configured with an MBR partition for that. I simply used cgdisk and converted it to a GPT partition table to start from scratch.

Would you recommend starting over and using the 2048-sector alignment or keep the 2 sector alignment that it created?

Offline

#22 2013-02-07 12:55:00

matth
Member
Registered: 2011-11-09
Posts: 24

Re: [Solved] Syslinux GPT and boot partition

Well, I went ahead and started over last night and had gdisk create a new GPT partition table (with what it defaulted to, 2048-sector alignment and starting at 34).

I went through setting it up and used syslinux-install_update -i -a -m to install syslinux as the beginners guide suggests and everything went perfectly.

One thing I noticed is now the protective MBR doesn't have the boot flag set and it is working fine without it. What I am thinking is it had the boot flag from the start, as I don't remember not seeing it there in all of my testing. My guess is because I had cgdisk convert the MBR to GPT and every time I tried re-partitioning I only deleted the partitions and creating them. I never actually had it create a new partition table.

Anyway, all is working as it should be. Thank you everyone for the help! I learned a lot more about partitioning.

Offline

#23 2013-02-07 17:32:23

srs5694
Member
From: Woonsocket, RI
Registered: 2012-11-06
Posts: 719
Website

Re: [Solved] Syslinux GPT and boot partition

cfr wrote:

Just curious. Information about my hdd says that it uses 4,096 byte sectors and 512 emulation. It doesn't specifically mention "advanced format", though, and not only is my disk only 320G but the same information is supposed to apply to 160G and 250G models as well.

The 360GB figure I quoted in my previous message was from memory. Checking the GPT fdisk source code, I see it's set to force at least an 8-sector alignment on disks over 300GB, since the smallest Advanced Format disk I knew of was 320GB in size. It's entirely possible that my knowledge was incomplete or that manufacturers introduced a smaller Advanced Format disk since then.

If your disk has 4096-byte physical sectors then it's an Advanced Format disk. AFAIK, all such disks sold today "translate" to 512-byte logical sectors, at least on their ATA interfaces. (Some external disks present 4096-byte logical sectors, though.) See the Wikipedia article for more details.

I used gdisk to partition and used the defaults so mine is aligned in any case but I'm just idly curious about whether I needed to be sure of that or not.

Given the potential performance costs, I recommend checking and aligning properly if in doubt.

matth wrote:

Would you recommend starting over and using the 2048-sector alignment or keep the 2 sector alignment that it created?

I realize you've already repartitioned, but the first Advanced Format disk line was introduced in December of 2009; it was a series of 1-2TB 3.5-inch disks from Western Digital. Thus, if your disk predates that, or even if it postdates it by a few months (given its capacity), there's no chance that it's an Advanced Format disk, and you're perfectly safe using 1- or 2-sector alignment. Given what cfr has said about a 160GB Advanced Format disk, there's a slim chance that a recent 120GB model might use Advanced Format.

matth wrote:

My guess is because I had cgdisk convert the MBR to GPT and every time I tried re-partitioning I only deleted the partitions and creating them. I never actually had it create a new partition table.

This seems likely. cgdisk provides a minimal user interface that lacks an option to create a fresh partition table, although you can delete all your existing partitions, and the program will automatically create a fresh partition table if it's fed a completely blank disk. If you start with an MBR disk, cgdisk will pick up whatever alignment was used on the existing partitions and use it for the GPT partitions. I doubt if there was any harm in this in your case; this approach will only create problems if a disk was set up with improper alignment before cgdisk handles it.

Offline

#24 2013-02-07 22:19:02

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,130

Re: [Solved] Syslinux GPT and boot partition

@srs5694,
Thanks very much for the information. I just wasn't sure if "advanced format" meant anything over and above the sector size and emulation. My disk is Seagate and the information applies to 160G and 250G disks in the same line as well. So I guess they must indeed have started making even smaller disks with this format.

By the by, I really like gdisk - I don't understand when people suggest I use gparted instead. I find gdisk more intelligible than any of the other partitioning tools I've used so far in Linux. Thanks very much for providing it.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

Board footer

Powered by FluxBB