Project

General

Profile

Bug #9775

format: number of sectors is reported one less in case of GPT

Added by Toomas Soome over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
cmd - userland programs
Start date:
2018-08-28
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:

Description

Disk size reported by format:

format> ver

Volume name = <        >
ascii name  = <WDC-WD4004FZWX-00GBGB0-81.H0A81-3.64TB>
bytes/sector    =  512
sectors = 7814037167
accessible sectors = 7814037134
Part      Tag    Flag     First Sector          Size          Last Sector
  0     system    wm               256       256.00MB           524543    
  1        usr    wm            524544         3.64TB           7814020750    
  2 unassigned    wm                 0            0                0    
  3 unassigned    wm                 0            0                0    
  4 unassigned    wm                 0            0                0    
  5 unassigned    wm                 0            0                0    
  6 unassigned    wm                 0            0                0    
  8   reserved    wm        7814020751         8.00MB           7814037134    

format> 

and at boot time:

Aug  1 12:47:33 beastie sata: [ID 663010 kern.info] /pci@0,0/pci15d9,805@1f,2 :
Aug  1 12:47:33 beastie sata: [ID 761595 kern.info]     SATA disk device at port 0
Aug  1 12:47:33 beastie sata: [ID 846691 kern.info]     model WDC WD4004FZWX-00GBGB0                  
Aug  1 12:47:33 beastie sata: [ID 693010 kern.info]     firmware 81.H0A81
Aug  1 12:47:33 beastie sata: [ID 163988 kern.info]     serial number K7GSWXJB            
Aug  1 12:47:33 beastie sata: [ID 594940 kern.info]     supported features:
Aug  1 12:47:33 beastie sata: [ID 981177 kern.info]      48-bit LBA, DMA, Native Command Queueing, SMART, SMART self-test
Aug  1 12:47:33 beastie sata: [ID 996592 kern.info]     SATA Gen3 signaling speed (6.0Gbps)
Aug  1 12:47:33 beastie sata: [ID 349649 kern.info]     Supported queue depth 32
Aug  1 12:47:33 beastie sata: [ID 349649 kern.info]     capacity = 7814037168 sectors

Checking the source, indeed, we use efi_last_lba, which is last addressable LBA, and is set as capacity - 1 (see [[http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libefi/common/rdwr_efi.c#196]])

#1

Updated by Electric Monk over 2 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

git commit b982c112ede0da29fbc4152cdc6690d85ddf7207

commit  b982c112ede0da29fbc4152cdc6690d85ddf7207
Author: Toomas Soome <tsoome@me.com>
Date:   2018-08-29T03:32:43.000Z

    9775 format: number of sectors is reported one less in case of GPT
    Reviewed by: Andrew Stormont <andyjstormont@gmail.com>
    Reviewed by: Dan McDonald <danmcd@joyent.com>
    Approved by: Robert Mustacchi <rm@joyent.com>

Also available in: Atom PDF