Advanced Format Drives, ZFS and Partitions

Status
Not open for further replies.

mhugelmann

Cadet
Joined
Mar 16, 2012
Messages
8
Hey all,

I've spent some time over the last few years using and fiddling around with FreeBSD, FreeNAS and the ZFS file system. Also, since newer hard drives are all advanced format drives with 4KiB sector sizes (instead of the old 512 B sector sizes), I did research about the change and how it would affect my ZFS zpool setup. Up until last night, I thought I had a pretty sound understanding of my setup, and I was confident that I had configured my drives correctly. However, I came across a thread on the FreeBSD forums which made me question my drives, zpools and configuration.

So here's my question: Does gpart need to be used to create a main partition on a disk before creating a zpool of block-level devices to ensure sector alignment? Or does running gnop create -S 4096 for each device, then creating the zpool suffice?

The forum post I'm referring to is here. I know gpart is used to create partitions on a drive, however I thought ZFS preferred whole disks. I realize ZFS can use partitions and even files as vdevs to create a zpool, but the documentation suggests whole disks should be used as vdevs. Since my drives are WD EARS drives (meaning: the drives do use 4 KiB sectors physically, but report to the OS that they use 512 B sectors), the process I used to create my zpool is this:

Code:
# gnop create -S 4096 /dev/ada0
# gnop create -S 4096 /dev/ada1
# gnop create -S 4096 /dev/ada2
# gnop create -S 4096 /dev/ada3
# zpool create pool /dev/ada0.nop /dev/ada1.nop /dev/ada2.nop /dev/ada3.nop
# zpool export pool
# gnop destroy /dev/ada0.nop
# gnop destroy /dev/ada1.nop
# gnop destroy /dev/ada2.nop
# gnop destroy /dev/ada3.nop
# zpool import pool


I know I'm going against the FreeNAS recommended set up by not using a slice of each drive for SWAP, but should I have at least created one main partition on each disk using gpart before using gnop and creating my zpool? To my understanding, the previous commands only affect the ashift of the zpool, and the ashift is what ZFS uses to determine the smallest IO operation it can perform. But, as one of the posts in the cited thread states, that doesn't mean the drive is aligned. On the other hand, I'm really not sure if I need to worry about alignment at all as my disks contain no partitions and ZFS uses the whole disk.

To be honest, I'm not entirely concerned about the performance of my disks or set up as it stands right now, I'm just more curious if my process was flawed or if I'm misunderstanding something.

Any insight would be appreciated. Thanks :)

-----


On a side-note, the output of diskinfo -v on each of my drives is not consistent. Some devices report the stripesize and some (nearly half) do not. However, all the drives report the stripeoffset as 0. Should I be concerned about this variance among the drives?
 

palmboy5

Explorer
Joined
May 28, 2012
Messages
60
Doesn't the web management pool creation dialog have a checkbox to force 4096 byte sectors? Why do you need to go through with this manual stuff?

EDIT:
The checkbox at the bottom:
http://i.imgur.com/tmiAM.png

It will look very different for you since you'll have drives to choose from, as there are additional settings below the checkbox that will show up.
 

louisk

Patron
Joined
Aug 10, 2011
Messages
441
When you allocate devices to ZFS, the are partitioned with gpart to allocate some swap and the rest to ZFS. You can check the box for 4k if you need to.
 

paleoN

Wizard
Joined
Apr 22, 2012
Messages
1,403
Neither of which really addresses the question:
Does gpart need to be used to create a main partition on a disk before creating a zpool of block-level devices to ensure sector alignment? Or does running gnop create -S 4096 for each device, then creating the zpool suffice?
I don't think you need to worry about alignment as you aren't using partitions. There's nothing to align.:)

You can also just change swap size to zero under Advanced Settings to not use swap. It's what I did. FYI, FreeNas does create 4k aligned partions:
Code:
# gpart show
=>        34  3907029101  ada0  GPT  (1.8T)
          34          94        - free -  (47K)
         128  3907029007     1  freebsd-zfs  (1.8T)


I realize ZFS can use partitions and even files as vdevs to create a zpool, but the documentation suggests whole disks should be used as vdevs.
I read the documentation the same way at first. I believe it's a non issue though as long as you are only using the drive for ZFS. Usually when a drive has multiple partitions the other partitions get used. Obviously ZFS wants to be the only thing using that drive. Of course I don't actually know if that's what whole disk means. Perhaps someone who does know can comment.


I'm curious as to the ouput of:
Code:
zdb | grep whole_disk
I forgot to check when I was messing around with a whole disk before.

On a side-note, the output of diskinfo -v on each of my drives is not consistent. Some devices report the stripesize and some (nearly half) do not.
How are the drives connected motherboard, add-in card, ...?
 
Status
Not open for further replies.
Top