From owner-freebsd-fs@FreeBSD.ORG Sat Nov 29 12:31:35 2014 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 40FCD72E for ; Sat, 29 Nov 2014 12:31:35 +0000 (UTC) Received: from mail-wi0-x22a.google.com (mail-wi0-x22a.google.com [IPv6:2a00:1450:400c:c05::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C3B2E17A for ; Sat, 29 Nov 2014 12:31:34 +0000 (UTC) Received: by mail-wi0-f170.google.com with SMTP id bs8so23027848wib.5 for ; Sat, 29 Nov 2014 04:31:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=PAXNUxYXPlVI2e0Jiyg+Vopt0RZuuXIBFPzYkK/Pg10=; b=Ld9lgXQ45hZJ2O/NILeQO1lCLBBooNwBgl95OfGPkJV/gdHOFzsb3hJtxolM1GHJM9 mMqo54POUtXd6xicf2+D+/DY29rtbI54WOx+pVG0RhEXRKlgAgByNPZ5XT166IJk9z+e kthKyQJIyst0zN9drwTlFc61OP0JqjSOEgX9AzV6dQtcZP95fR2zNHJQcMHK+katbMml qr9HyiCc7/UhgMzyNf1NOvgJsrajIBkLv7NKmtvWv21cQHyXYdH0JdKNgSaVyU0p3x6B 1/EX/uPWtlwcPv1qXEjwtSf8BUULRs4egEqZMn6gaZA/N1s9dvpicqSXIGIf5rBCFc6X vAeg== X-Received: by 10.181.8.72 with SMTP id di8mr42394106wid.1.1417264293226; Sat, 29 Nov 2014 04:31:33 -0800 (PST) Received: from localhost ([91.225.202.111]) by mx.google.com with ESMTPSA id h2sm19775259wix.5.2014.11.29.04.31.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Nov 2014 04:31:32 -0800 (PST) Date: Sat, 29 Nov 2014 12:31:30 +0000 From: Mykola Golub To: Lorenzo Perone Subject: Re: Mounting a filesystem on a HAST provider without HAST (was: Re: HAST, zvols, istgt and carp working...) Message-ID: <20141129123130.GA21946@gmail.com> References: <5477B7AF.5020802@yellowspace.net> <54785AA1.10107@yellowspace.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54785AA1.10107@yellowspace.net> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: freebsd-fs@freebsd.org X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2014 12:31:35 -0000 On Fri, Nov 28, 2014 at 12:21:05PM +0100, Lorenzo Perone wrote: > The UFS filesystem on the zvol provider begins after 135168 bytes > (132KB) of hast-header. > > So I tried to create a transparent provider with gnop: > > gnop create -o 135168 /dev/zvol/rtank/vols/jail1@hellotest > > and the mount > > mount -t ufs -o ro /dev/zvol/rtank/vols/jail1@hellotest.nop /mnt > > succeeded. > > Now my new question is: Can I "safely" assume that this header is always > 132K (I assume not - it probably contains the bitmap...)? In this case, > which formula should be applied to calculate the offset? The header contains 4096 bytes of HAST metadata (METADATA_SIZE) + map, which size depends on media size and extent size. You can obtain the offset by running `hastctl dump' command (localcnt field). If you still want to calulate it yourself, see how hastctl calculates hr_localoff in sbin/hastctl/hastctl.c:create_one() with the help of sbin/hastd/metadata.c:activemap_calc_ondisk_size(). In short, you need to calculate number of extents (mediasize / extentsize) and reserve a bit for every extent in the map, rounding up to the sector size. -- Mykola Golub