15

After choosing "Guided - Use entire disk" during installation of Ubunsut Server 12.04 I find that the first partition starts on sector 34. Why that specific sector and not the first one?

(parted) print
Model: ATA WDC WD30EZRX-00M (scsi)
Disk /dev/sda: 5860533168s
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start    End          Size         File system  Name  Flags
 1      34s      390659s      390626s      fat32              boot
 2      390660s  890660s      500001s      ext2
 3      890661s  5860533118s  5859642458s

(parted)

In case you prefer bytes as the unit:

(parted) unit B
(parted) print
Model: ATA WDC WD30EZRX-00M (scsi)
Disk /dev/sda: 3000592982016B
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start       End             Size            File system  Name  Flags
 1      17408B      200017919B      200000512B      fat32              boot
 2      200017920B  456018431B      256000512B      ext2
 3      456018432B  3000592956927B  3000136938496B
Deleted
  • 848

4 Answers4

13

The size of the EFI label is usually 34 sectors, so partitions start at sector 34. This feature means that no partition can start at sector zero (0)

Source.

Uri Herrera
  • 15,328
  • 1
    Great answer! Just to add some information for the curious: The size of the EFI label is usually 34 sectors, so partitions start at sector 34. This feature means that no partition can start at sector zero (0). is from: http://82.157.70.109/mirrorbooks/solaris10examprep/0789734613/ch01lev1sec13.html – Deleted Oct 12 '12 at 22:37
13

Colin Ian King's answer is correct; however, it should be noted that hard disks that use the Advanced Format feature (4096-byte physical sectors and 512-byte logical sectors) require partition start sectors to be multiples of 8 in order to get optimal performance. See this article I wrote for all the gory details. Most partitioning tools today (late 2012) align partitions on 1MiB (2048-sector) boundaries by default. Since 2048 is a multiple of 8, such partitions work fine with these disks. Most disks sold today, and certainly most of the larger models, use Advanced Format. Thus, unless you're certain that your disk does not use Advanced Format, it's best to align on 8-sector boundaries. Note that 34 is not divisible by 8; 40 is the smallest start sector for a GPT disk with a standard partition table size that works well with Advanced Format disks.

What version of Ubuntu are you installing, Kent? I haven't checked recently, but I thought that the last version or two used 2048-sector partition alignment. If you're installing something older, you might want to consider installing a newer Ubuntu, since that will give you much more up-to-date software.

Rod Smith
  • 45,160
  • 7
  • 66
  • 108
  • I got that partitioning structure when installing the 64-bit version of Ubuntu Server 12.04 (so, latest LTS). – Deleted Oct 13 '12 at 20:41
  • Thanks! I sometimes wish one could up-vote more than once. :-) And of course I want the gory details, thanks for the link, your answer and your article! – Deleted Oct 13 '12 at 20:42
  • 1
    I tried 40s as the start sector, but can't get the partition to align properly according to Parted. Maybe I can get some wisdom from you if you have the time? http://askubuntu.com/questions/201164/proper-alignment-of-partitions-on-an-advanced-format-hdd-using-parted – Deleted Oct 15 '12 at 01:30
  • 6
    Parted is just being conservative. Using the 2048-sector alignment results in such a puny waste of disk space that it's not worth worrying about it; just use the 2048-sector alignment. – Rod Smith Oct 15 '12 at 16:46
  • The "gory details" link appears to be dead. – Aaron Wright Aug 27 '24 at 22:21
1

If installed on a GPT disk, sector 34 is the first sector than can be used as sectors 0-33 overhead sectors used for the Protective MBR, the GPT header, and the GPT partition tables. This is a reasonable answer as to why it starts at sector 34.

Hoot
  • 11
  • 1
0

I agree with the answer from "Colin Ian King" and "Rod Smith" (for 512e Advanced Format Disks) BUT both using 34s or 40s as partition start gives the WARNING "Warning: The resulting partition is not properly aligned for best performance." when running "parted -a optimal /dev/sdb mkpart first-partition 34s 40s" or "parted -a optimal /dev/sdb mkpart first-partition 40s 47s" (when running "parted mkpart" the end sector is included and using 40s...47s results in 8 sectors size partition which would align nicely to 4KiB alignment that should be used on 512e AF Disks).

BECAUSE according to Windows Vista support for large-sector hard disk drives: ... In Windows Vista, the default starting offset will generally be sector 0x800 (2048s) ... 2048s*512B = 1048576B = 1MiB

AND parted has aligned its partition start/handling to Windows Vista: parted.git: https://git.savannah.gnu.org/gitweb/?p=parted.git;a=blobdiff;f=libparted/labels/dos.c;h=0a606e506e11030e7f9d1d17e0deec67a7a5d594;hp=fda8a79ed1c4ca813256459720f7be5d963c662d;hb=51e774269002a7a9c0aecf497d4d98486c918918;hpb=40bfba3a317f33e7bc55fdd8cd5073ac69ae280a

AND therefore the first partition needs to start at: 1048576B = 1MiB (running "parted -a optimal /dev/sdb mkpart first-partition 2048s 2055s" on a 512e Disk (the end sector of course can be chosen >=2055s that is just the minimum))

becke-ch
  • 151