From owner-freebsd-questions@freebsd.org Tue Sep 27 15:12:36 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B38D6BEB4DA for ; Tue, 27 Sep 2016 15:12:36 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from sola.nimnet.asn.au (paqi.nimnet.asn.au [115.70.110.159]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1496822D for ; Tue, 27 Sep 2016 15:12:35 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from localhost (localhost [127.0.0.1]) by sola.nimnet.asn.au (8.14.2/8.14.2) with ESMTP id u8RFCN7m072298; Wed, 28 Sep 2016 01:12:23 +1000 (EST) (envelope-from smithi@nimnet.asn.au) Date: Wed, 28 Sep 2016 01:12:23 +1000 (EST) From: Ian Smith To: David Christensen cc: freebsd-questions@freebsd.org Subject: FreeBSD-10.3-RELEASE-i386-memstick.img installer changes contents of USB flash drive? In-Reply-To: Message-ID: <20160927032651.T6806@sola.nimnet.asn.au> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Sep 2016 15:12:36 -0000 In freebsd-questions Digest, Vol 643, Issue 1, Message: 5 On Sun, 25 Sep 2016 20:36:15 -0700 David Christensen 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