Re: Everchanging bytes at the end of mirror disks

From: Warner Losh <imp_at_bsdimp.com>
Date: Sun, 11 Dec 2022 08:22:46 UTC
On Sat, Dec 10, 2022, 11:52 PM Artem Kuchin <artemkuchin76@gmail.com> wrote:

> Hello!
>
> I am writing a small utility for myseld and part of it is comparing
> gmirror disks. After running some tests i realized that some bytes at
> the very end of disks are constantly changing.
>

The last sector has metadata about the mirror and about the mirror
element.  It's this latter data that differs.

Warner


For example to runs from the compator:
>
> Difference between /dev/ada0p3 [26,0x1A]  and /dev/ada1p3 [95,0x5F] at
> position 495812794495
> Difference between /dev/ada0p3 [217,0xD9]  and /dev/ada1p3 [107,0x6B] at
> position 495812794496
> Difference between /dev/ada0p3 [151,0x97]  and /dev/ada1p3 [0,0x0] at
> position 495812794497
> Difference between /dev/ada0p3 [180,0xB4]  and /dev/ada1p3 [64,0x40] at
> position 495812794498
> Difference between /dev/ada0p3 [96,0x60]  and /dev/ada1p3 [126,0x7E] at
> position 495812794499
> Difference between /dev/ada0p3 [89,0x59]  and /dev/ada1p3 [239,0xEF] at
> position 495812794500
> Difference between /dev/ada0p3 [234,0xEA]  and /dev/ada1p3 [93,0x5D] at
> position 495812794501
> Difference between /dev/ada0p3 [166,0xA6]  and /dev/ada1p3 [76,0x4C] at
> position 495812794502
>
> Difference between /dev/ada0p3 [185,0xB9]  and /dev/ada1p3 [233,0xE9] at
> position 495812794495
> Difference between /dev/ada0p3 [145,0x91]  and /dev/ada1p3 [2,0x2] at
> position 495812794496
> Difference between /dev/ada0p3 [105,0x69]  and /dev/ada1p3 [3,0x3] at
> position 495812794497
> Difference between /dev/ada0p3 [55,0x37]  and /dev/ada1p3 [166,0xA6] at
> position 495812794498
> Difference between /dev/ada0p3 [23,0x17]  and /dev/ada1p3 [99,0x63] at
> position 495812794499
> Difference between /dev/ada0p3 [35,0x23]  and /dev/ada1p3 [144,0x90] at
> position 495812794500
> Difference between /dev/ada0p3 [118,0x76]  and /dev/ada1p3 [212,0xD4] at
> position 495812794501
> Difference between /dev/ada0p3 [30,0x1E]  and /dev/ada1p3 [149,0x95] at
> position 495812794502
>
> End of disk is 495812794880, so, the last changing bytes if 378 bytes
> before the end.
>
> I am most likely missing some information about FS/mirror organization.
> Below is the filesystem configuration.
>
> However, if there a part which changes on both disks independently how
> do i get its offset and size,
>
> so i will not compare it.  Thank you.
>
>
> # gmirror status
>         Name    Status  Components
> mirror/swap  COMPLETE  ada0p2 (ACTIVE)
>                         ada1p2 (ACTIVE)
> mirror/root  COMPLETE  ada0p3 (ACTIVE)
>                         ada1p3 (ACTIVE)
>
> # gpart show
> =>       34  976773101  ada0  GPT  (466G)
>           34        128     1  freebsd-boot  (64K)
>          162    8388608     2  freebsd-swap  (4.0G)
>      8388770  968384365     3  freebsd-ufs  (462G)
>
> =>       34  976773101  ada1  GPT  (466G)
>           34        128     1  freebsd-boot  (64K)
>          162    8388608     2  freebsd-swap  (4.0G)
>      8388770  968384365     3  freebsd-ufs  (462G)
>
>
>
>
>
>