Mounting a filesystem on a HAST provider without HAST (was: Re: HAST, zvols, istgt and carp working...)

Mykola Golub to.my.trociny at gmail.com
Sat Nov 29 12:31:35 UTC 2014


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 at hellotest
> 
> and the mount
> 
> mount -t ufs -o ro /dev/zvol/rtank/vols/jail1 at 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


More information about the freebsd-fs mailing list