NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: GPT BIOS boot



    Date:        Fri, 31 May 2019 17:00:13 +0200
    From:        manu%netbsd.org@localhost (Emmanuel Dreyfus)
    Message-ID:  <1o8g9t3.1xh6erjzo45luM%manu%netbsd.org@localhost>

  | Sorry, I do not get it: how can I know if the disk has 4k sectors,

It will tell you when asked - which the kernel does when it attaches
the drive, a typical drive says something like ...

wd1: 1863 GB, 3876021 cyl, 16 head, 63 sec, 512 bytes/sect x 3907029168 sectors

I tried plugging in my 4K/sector drive (it is USB, which most like that
are - drives with IDE interfaces rarely expose a larger sector size)
but it seems that either the scsi driver doesn't print that value at
startup, or in this case it doesn't, as the drive is always powered down
just before it is connected, and takes far longer to power up than the
kernel waits before attaching it.

But once up, disklabel says ...

# /dev/rsd0:
type: SCSI
disk: My Book 1230    
label: fictitious
flags:
bytes/sector: 4096
sectors/track: 32
tracks/cylinder: 64
sectors/cylinder: 2048
cylinders: 357694
total sectors: 732558336
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0 
4 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a: 732558336         0     4.2BSD      0     0     0  # (Cyl.      0 - 357694*)
 d: 732558336         0     unused      0     0        # (Cyl.      0 - 357694*)

The label is fictitous (ie: the kernel generated it from info reported
by the drive) as it isn't on the drive - this one uses GPT partitioning.

Notice that 732558336 * 4096 == 3000558944256 (this is a 3TB drive,
when I acquired it, a few years ago, it was as big as was reasonable
to obtain).


  | and if it does,

If you don't know already, it doesn't - this isn't something that
is optional.   The underlying hardware might use almost anything as
a sector size, what matters is what it exposes to its external interface,
that is, what units the block numbers are in when you ask it to read block
1234 for you - and what the minimum transfer size is.

  | how can I rework the disklabel so that it can describe a 6
  | TB filesystem?

If it were, you'd simply list the size and offset in units of 4K, rather
than units of 512.   The numbers still have to fit in 32 bits (as the
732558336 does above - which it wouldn't if it were in 512 byte units,
which would make it be 5860466688 which is > 2^32 (4294967296)).

Since the whole world believes (these days) that disk blocks simply *must*
be 512 bytes, that's what the manufacturers provide - my guess is that
drives like the one shown above delivered 4K sectors as that was the only
way that they could make the space they contained available at the time.
This was before support for GPT became common.   Now, with GPT, you can
just use that, and manufacturers don't need to worry any more (or not
until the drives get MUCH bigger).

kre

ps: the first system I ran unix on has disks with 256 bytes/sector (which
were faked to be 512 by simply multiplying all block numnbers by 2 in the
driver...)



Home | Main Index | Thread Index | Old Index