From owner-freebsd-questions@freebsd.org Fri Sep 11 19:33:23 2015 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9C72A01643 for ; Fri, 11 Sep 2015 19:33:23 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "wonkity.com", Issuer "wonkity.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id AC3801DC2 for ; Fri, 11 Sep 2015 19:33:23 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.15.2/8.15.2) with ESMTPS id t8BJXMQ7090644 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 11 Sep 2015 13:33:22 -0600 (MDT) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.15.2/8.15.2/Submit) with ESMTP id t8BJXLTl090641; Fri, 11 Sep 2015 13:33:22 -0600 (MDT) (envelope-from wblock@wonkity.com) Date: Fri, 11 Sep 2015 13:33:21 -0600 (MDT) From: Warren Block To: "William A. Mahaffey III" cc: FreeBSD Questions !!!! Subject: Re: followup storage question In-Reply-To: <55F2ED46.6060708@hiwaay.net> Message-ID: References: <55F2D086.6060509@hiwaay.net> <55F2ED46.6060708@hiwaay.net> User-Agent: Alpine 2.20 (BSF 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (wonkity.com [127.0.0.1]); Fri, 11 Sep 2015 13:33:22 -0600 (MDT) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2015 19:33:24 -0000 On Fri, 11 Sep 2015, William A. Mahaffey III wrote: > On 09/11/15 09:31, Warren Block wrote: >> On Fri, 11 Sep 2015, William A. Mahaffey III wrote: >> >>> The Wiki page https://wiki.freebsd.org/RootOnZFS/GPTZFSBoot/9.0-RELEASE >>> illustrates using gnop to enforce 4K alignment of gpt partitions for >>> subsequent use by ZFS. However the gpart commands also use the '-a 4k' >>> arguments, aligning partitions on 4k boundaries as I understand things. Is >>> the gnop command also necessary ? TIA & have a nice weekend. >> >> These are two separate things. gnop(8) is (was) used to force ZFS to use a >> 4K block size. That just means it transfers data in multiples of 4K, not >> necessarily aligned with the 4K sectors on the drive. gpart(8)'s -a flag is >> used to force partitions to begin in alignment with the 4K sectors on the >> drive. >> > > Hmmmm .... OK, however if I carefully 'gpart -a 4k' the underlying partitions > aligned, then wouldn't the resulting ZFS above also be aligned ? Again, these are two different things. Alignment is making sure that the filesystem blocks align with the device blocks. Otherwise, a 4K request from the filesystem could force the drive to read or write two 4K hardware blocks. This can cut performance in half. The gnop trick is to force the *size* of ZFS blocks to be 4K. Otherwise, the filesystem could end up reading 512-byte blocks on a 4K drive. The drive would read and cache a 4K block, but the filesystem would have to request it in eight 512-byte pieces. Writes are not good in this situation either, although the drive might combine them to avoid rewriting the same disk block eight times. Matching the filesystem block size with the disk block size avoids that additional overhead.