Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Apr 2017 17:42:29 -0700
From:      David Christensen <dpchrist@holgerdanske.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: dd image not working
Message-ID:  <1d37b326-936c-9201-65fb-bf296d4cc9db@holgerdanske.com>
In-Reply-To: <4ce88806-41f9-4323-b0ef-53d5251a380a@unixarea.de>
References:  <4ce88806-41f9-4323-b0ef-53d5251a380a@unixarea.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On 04/20/2017 09:50 AM, Matthias Apitz wrote:
> El jueves, 20 de abril de 2017 18:01:07 (CEST), James B. Byrne
> <byrnejb@harte-lyne.ca> escribió:
>> I am trying to create a bootable USB image for FreeBSD.  The device
>> name of the USB flash memory appears to me to be /dev/sb1
>>
>> # mount -l
>> . . .
>> /dev/sr0 on /media/cdrom0 type iso9660 (ro,noexec,nosuid,nodev)
>> none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
>> /dev/sdb1 on /media/KINGSTON type vfat
>> (rw,nosuid,nodev,uhelper=udisks,uid=500,gid=500,shortname=mixed,dmask=0077,utf8=1,flush)
>>
>> #
>>
>> I dismount that device
>>
>> # umount /dev/sdb1
>>
>> and check
>>
>> # mount -l
>> . . .
>> /dev/sr0 on /media/cdrom0 type iso9660 (ro,noexec,nosuid,nodev)
>> [Bluebirds]
>> none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
>> #
>>
>> Now I run dd
>> # dd
>> if=/var/data/disk_images/FreeBSD/FreeBSD-11.0-RELEASE-i386-memstick.img
>> of=/dev/sbd1 bs=512 conv=sync
>> 1256080+0 records in
>> 1256080+0 records out
>> 643112960 bytes (643 MB) copied, 1.92347 s, 334 MB/s
>> #
>>
>>
>> But the usb key does not appear to have been altered at all.  If I
>> remove it and reinsert then it automounts with the same information as
>> before:
>>  # mount -l
>> . . .
>> /dev/sr0 on /media/cdrom0 type iso9660 (ro,noexec,nosuid,nodev)
>> [Bluebirds]
>> none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
>> /dev/sdb1 on /media/KINGSTON type vfat
>> (rw,nosuid,nodev,uhelper=udisks,uid=500,gid=500,shortname=mixed,dmask=0077,utf8=1,flush)
>>
>> [KINGSTON]
>>
>
> please show
>
> # fdisk /dev/sdb

Using Debian GNU/Linux 8 and dd(1) with the 'list' option:

2017-04-20 17:26:28 root@jesse ~
# fdisk --list /dev/sdb
GPT PMBR size mismatch (1256080 != 7913470) will be corrected by w(rite).
The backup GPT table is corrupt, but the primary appears OK, so that 
will be used.

Disk /dev/sdb: 3.8 GiB, 4051697152 bytes, 7913471 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: EDF16287-85F8-11E6-A2F6-002590EC6166

Device       Start     End Sectors   Size Type
/dev/sdb1        3     125     123  61.5K FreeBSD boot
/dev/sdb2      126 1254029 1253904 612.3M FreeBSD UFS
/dev/sdb3  1254030 1256077    2048     1M FreeBSD swap


Using FreeBSD 11.0 RELEASE and gpart(8) with the 'show' action:

root@p43400e:~ # gpart show da0
=>      3  1256075  da0  GPT  (3.8G) [CORRUPT]
         3      123    1  freebsd-boot  (62K)
       126  1253904    2  freebsd-ufs  (612M)
   1254030     2048    3  freebsd-swap  (1.0M)


> I think you should dd to /dev/sdb and not to sdb1

+1


Also:

1.  sync(1) is useful.  The last time I tried dd(1) with the 'conv=sync' 
option, my USB image was bad (PEBKAC).

2.  A larger block size will increase throughput.


So, using Debian GNU/Linux 8 (untested):

# dd if=FreeBSD-11.0-RELEASE-i386-memstick.img of=/dev/sdb bs=1M; sync


Note that the FreeBSD live system on the USB flash drive will change the 
drive contents once booted.  So, if you're going to checksum the USB 
flash drive, be sure to do it immediately after burning.


David




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1d37b326-936c-9201-65fb-bf296d4cc9db>