Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Sep 2016 01:12:23 +1000 (EST)
From:      Ian Smith <smithi@nimnet.asn.au>
To:        David Christensen <dpchrist@holgerdanske.com>
Cc:        freebsd-questions@freebsd.org
Subject:   FreeBSD-10.3-RELEASE-i386-memstick.img installer changes contents of USB flash drive?
Message-ID:  <20160927032651.T6806@sola.nimnet.asn.au>
In-Reply-To: <mailman.125.1474891202.61703.freebsd-questions@freebsd.org>
References:  <mailman.125.1474891202.61703.freebsd-questions@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
In freebsd-questions Digest, Vol 643, Issue 1, Message: 5
On Sun, 25 Sep 2016 20:36:15 -0700 David Christensen <dpchrist@holgerdanske.com> wrote:

 > Using Debian GNU/Linux 7.11, I downloaded
 > FreeBSD-10.3-RELEASE-i386-memstick.img and burned it to a USB flash drive:
 > 
 >         # time dd if=FreeBSD-10.3-RELEASE-i386-memstick.img of=/dev/sdc
 >  bs=1M conv=sync; sync
 >         659+1 records in
 >         660+0 records out
 >         692060160 bytes (692 MB) copied, 141.567 s, 4.9 MB/s
 > 
 >         real    2m21.571s
 >         user    0m0.004s
 >         sys     0m1.696s
 > 
 > 
 > If I compute the checksum immediately after burning, it matches the
 > published checksum:
 > 
 >         # time dd if=/dev/sdc count=1350917 | sha256sum -b
 >         ab104a30627754bb8d39eeff3c5c5a4a15537d32c749e2b9841b34cb08e17eb0 *-
 >         1350917+0 records in
 >         1350917+0 records out
 >         691669504 bytes (692 MB) copied, 43.252 s, 16.0 MB/s
 > 
 >         real    0m43.257s
 >         user    0m7.236s
 >         sys     0m3.496s
 > 
 >         # grep
 > ab104a30627754bb8d39eeff3c5c5a4a15537d32c749e2b9841b34cb08e17eb0
 > CHECKSUM.SHA256-FreeBSD-10.3-RELEASE-i386
 >         SHA256 (FreeBSD-10.3-RELEASE-i386-memstick.img) =
 > ab104a30627754bb8d39eeff3c5c5a4a15537d32c749e2b9841b34cb08e17eb0
 > 
 > 
 > But after using the USB flash drive to install FreeBSD, the checksum has
 > changed:
 > 
 >         # dd if=/dev/sdc count=1350917 | sha256sum -b
 >         1350917+0 records in
 >         1350917+0 records out
 >         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.

Just checking .. did you only access the stick by reading with dd? That 
is, that you never mounted it for a look around - requiring mounting it 
-o ro, or at least noatime, to avoid directory atime updating on reads?
 
 > Why?

Where?  i.e, where on the memstick does it first differ from its 
memstick.img file?  You can use cmp(1) to locate the first difference, 
reduce the byte count to sectors (N) then perhaps:

  dd if=memstick.img skip=$((N-1)) count=8 | hd > image.4k.hd
  dd if=/dev/da$whatever skip=$((N-1)) count=8 | hd > stick.4k.hd
  diff -u image.4k.hd stick.4k.hd

I just checked my FreeBSD-10.3-RELEASE-amd64-memstick.img vs the stick 
I'd dd'd it to, to find amongst others in the first lot of differences 
"/media" which is a local directory I'd mounted it on at some stage .. 
this was just past 8k into the image, so I didn't need to skip further.

If anything but atimes are modified, that would be very interesting .. I 
thought installation didn't write anything to the source stick at all.

Like Perry H, I'd like to add a small partition to memsticks to write 
stuff to, at least from 'live CD' mode, if not a shell from installer.

cheers, Ian



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