Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Nov 2014 12:31:30 +0000
From:      Mykola Golub <to.my.trociny@gmail.com>
To:        Lorenzo Perone <lopez.on.the.lists@yellowspace.net>
Cc:        freebsd-fs@freebsd.org
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>
In-Reply-To: <54785AA1.10107@yellowspace.net>
References:  <AANLkTim5FRJkf_S0aSV74S=JY%2Bg1DBZLhjYW7X9C0MkP@mail.gmail.com> <5477B7AF.5020802@yellowspace.net> <54785AA1.10107@yellowspace.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20141129123130.GA21946>