# How to verify that 4K blocks are properly set up with ZFS?



## ajm83 (Jan 16, 2014)

How do I check that 4K blocks are properly set up for an existing pool? The drives are 4k but report 512 as the sector size. My ashift reported by `zdb|grep ashift` is 12, but that is not enough to determine that everything is working according to @Sebulon's post here: viewtopic.php?p=174638#p174638.

I inherited the pool after somebody else created it so I don't know exactly how it was set up.

Here is the info of one of my disks:

Diskinfo output from one disk:

```
# diskinfo -v ada0
ada0
        512             # sectorsize
        3000592982016   # mediasize in bytes (2.7T)
        5860533168      # mediasize in sectors
        4096            # stripesize
        0               # stripeoffset
        5814021         # Cylinders according to firmware.
        16              # Heads according to firmware.
        63              # Sectors according to firmware.
        WD-WMC1T0974497 # Disk ident.
```
Gpart output from the same disk:

```
# gpart list ada0
Geom name: ada0
modified: false
state: OK
fwheads: 16
fwsectors: 63
last: 5860533134
first: 34
entries: 128
scheme: GPT
Providers:
1. Name: ada0p1
   Mediasize: 262144 (256k)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 1024
   Mode: r0w0e0
   rawuuid: 89d9f7ef-92dd-11e2-a4a3-6805ca115e16
   rawtype: 83bd6b9d-7f41-11dc-be0b-001560b84f0f
   label: (null)
   length: 262144
   offset: 17408
   type: freebsd-boot
   index: 1
   end: 545
   start: 34
2. Name: ada0p2
   Mediasize: 3000590401536 (2.7T)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e2
   rawuuid: 89f60ed7-92dd-11e2-a4a3-6805ca115e16
   rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
   label: bdldisk0
   length: 3000590401536
   offset: 1048576
   type: freebsd-zfs
   index: 2
   end: 5860530175
   start: 2048
Consumers:
1. Name: ada0
   Mediasize: 3000592982016 (2.7T)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e3
```

There is both 512 and 4096 in the gpart output from the disks, I'm really confused about how to tell now what is going on. I have read the manpage but I am none the wiser as to what sectorsize, stripesize and stripeoffset actually mean.

Raw disk performance of the pool seems poor (6 disks in striped mirror configuration) which is why I am investigating this.

Any clues welcomed, thanks!


----------



## wblock@ (Jan 16, 2014)

*Re: How to verify that 4K blocks are properly set up with ZF*

Please show the output of `gpart show` to see if the partitions are aligned.  ashift being 12 means that ZFS is using 4K blocks, which is good.  If the alignment is also correct, all is well.


----------



## ajm83 (Jan 17, 2014)

*Re: How to verify that 4K blocks are properly set up with ZF*

A, of course, thanks @wblock@ and thanks to the moderator for fixing the formatting of my post.


```
gpart show ada0
=>        34  5860533101  ada0  GPT  (2.7T)
          34         512     1  freebsd-boot  (256k)
         546        1502        - free -  (751k)
        2048  5860528128     2  freebsd-zfs  (2.7T)
  5860530176        2959        - free -  (1.5M)
```

Is 2048 the correct starting point for that partition? It seems like it having read other posts.


----------



## wblock@ (Jan 17, 2014)

*Re: How to verify that 4K blocks are properly set up with ZF*

Yes, 2048*512 = 1M, an even multiple of 4K.  Or an easier way of working that backward is to divide the number of 512-byte blocks by eight.  If the result is an integer, the number was an even multiple of 4K.

2048/8 = 256.  Now for the size: 5860528128/8 = 732566016.  So the both the start and size are an even multiple of 4K.  It's good.


----------



## ajm83 (Jan 20, 2014)

*Re: How to verify that 4K blocks are properly set up with ZF*



			
				wblock@ said:
			
		

> Yes, 2048*512 = 1M, an even multiple of 4K.  Or an easier way of working that backward is to divide the number of 512-byte blocks by eight.  If the result is an integer, the number was an even multiple of 4K.
> 
> 2048/8 = 256.  Now for the size: 5860528128/8 = 732566016.  So the both the start and size are an even multiple of 4K.  It's good.



That's excellent, thank you very much @wblock@.  :beer


----------

