Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Sep 2016 12:58:43 -0400
From:      Anton Yuzhaninov <citrin+bsd@citrin.ru>
To:        "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org>
Subject:   Re: FreeBSD-10.3-RELEASE-i386-memstick.img installer changes contents of USB flash drive?
Message-ID:  <028307a7-0771-6429-d72f-f85f9530f55d@citrin.ru>
In-Reply-To: <56532342-f2d4-377d-605b-2e1b5bfb2160@holgerdanske.com>
References:  <56532342-f2d4-377d-605b-2e1b5bfb2160@holgerdanske.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2016-09-25 23:36, David Christensen wrote:
>         # time dd if=/dev/sdc count=1350917 | sha256sum -b
>         ab104a30627754bb8d39eeff3c5c5a4a15537d32c749e2b9841b34cb08e17eb0 *-
...
> But after using the USB flash drive to install FreeBSD, the checksum has
> changed:
>
>         # dd if=/dev/sdc count=1350917 | sha256sum -b
>         bd159b85486322febe992226bbec9c86d96d70dd1e5a8b7c6f0bb9d29eb50df3 *-
>         691669504 bytes (692 MB) copied, 42.989 s, 16.1 MB/s
>
> Therefore, the FreeBSD-10.3-RELEASE-i386-memstick.img installer has
> changed the contents of the USB flash drive.

AFIK UFS superblock is updated every time filesystem is mounted, even if 
FS is mounted in read-only mode (please correct me if I wrong).

In struct for superblock I see:

struct fs {
         ...
         u_char   fs_fsmnt[MAXMNTLEN];   /* name mounted on */
         ...
         ufs_time_t fs_mtime;            /* Last mount or fsck time. */
         ...
}

If you can mount this USB flash in FreeBSD before and after install you 
can use mtree to check that files was not changed:

$ mtree -c -K sha256 -p /mnt/usb-flash > /tmp/mtree1

use USB flash to install FreeBSD

$ mtree -c -K sha256 -p /mnt/usb-flash > /tmp/mtree2
$ diff -u /tmp/mtree[12]
Only commented lines in mtree header should differ.

And see if files was changed.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?028307a7-0771-6429-d72f-f85f9530f55d>