FreeBSD-10.3-RELEASE-i386-memstick.img installer changes contents of USB flash drive?

Anton Yuzhaninov citrin+bsd at citrin.ru
Wed Sep 28 16:58:56 UTC 2016


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.


More information about the freebsd-questions mailing list