# 2 questions on ZFS (4k alignment and auto-expand)



## mrjayviper (May 16, 2014)

Hello.


 4k alignment
I found a guide (http://ivoras.sharanet.org/blog/tree/20 ... rives.html) on how to make 4K-aligned ZFS pool. In this example, `gnop create -S 4096 /dev/adaX` was run for all disks.

But I recall seeing another guide (whose link I can't find or remember) two years ago stating I only need to run `gnop` on one disk. So is running `gnop` on 1 disk enough?
auto-expand

I also found another guide (http://jsosic.wordpress.com/2013/01/01/ ... pool-raid/ - though this seems a Solaris implementation?) that says I need to turn off auto-expand to off and then turn it on again before the actual pool expands to its new size. I thought setting it to on before I start replacing the disk will display the new size once the last disk has been replaced.
Thanks


----------



## SirDice (May 16, 2014)

mrjayviper said:
			
		

> So is running `gnop` on 1 disk enough?


No, it has to be done for each disk individually. 



> I thought setting it to on before I start replacing the disk will display the new size once the last disk has been replaced


I recently upgraded my home server replacing 4 x 2 TB for 4 x 3 TB. I checked the autoexpand and it was turned on before I started. The additional space will become available after _all_ the disks in the pool have been replaced and resilved.


----------



## mrjayviper (May 16, 2014)

How do I check if autoexpand is on? `zpool status` doesn't really say. thanks again and thanks for the answers.


----------



## SirDice (May 16, 2014)

mrjayviper said:
			
		

> How do I check if autoexpand is on?


Similar to the `zfs` command, zpool(8) also has a number of properties you can set/get.

`zpool get autoexpand <name of pool>`


----------



## mrjayviper (May 18, 2014)

Thanks! 

-----------------

scenario: I want to rebuild my pool from scratch. But this time instead of 6x 1GB HDDs, I'll be using 6x1GB + 2x 3GB HDDs. If I replace all the 1GB HDDs with larger drives, will it auto-expand as well. I suppose it should as long as the autoexpand setting is enabled but I just want to confirm.

Thanks again


----------



## phoenix (May 23, 2014)

> But I recall seeing another guide (whose link I can't find or remember) two years ago stating I only need to run `gnop` on one disk. So is running `gnop` on 1 disk enough?



Yes, you only need to use it on one disk per vdev.  The ashift is set to the largest sector size of all disks in the vdev.



> I also found another guide (http://jsosic.wordpress.com/2013/01/01/ ... pool-raid/ - though this seems a Solaris implementation?) that says I need to turn off auto-expand to off and then turn it on again before the actual pool expands to its new size. I thought setting it to on before I start replacing the disk will display the new size once the last disk has been replaced




Depends on the version of FreeBSD. You may need to use `zpool online -e` to get the new space to appear.


----------



## wblock@ (May 24, 2014)

Let me repeat again: *gnop(8) is not for alignment*.  gnop(8) is used to make ZFS use 4K blocks.  Size of blocks, not alignment.

Alignment is making sure that the 4K blocks on the drive are evenly aligned with the 4K filesystem blocks.  Generally, that means making sure the partition starts on an boundary that is an integer multiple of 4K.


----------



## mrjayviper (May 24, 2014)

I used alignment because numerous guides uses it too.

Thanks for the help!


----------



## wblock@ (May 24, 2014)

Lots of guides confuse the two concepts because block size and alignment interact.


----------

