Re: DD bs=4M option on USB mem-stick creates false format
On 03/27/2017 05:38 AM, Greg Wooledge wrote:
... the bs= option in dd. All that does is make the dd command run a
tiny bit faster or slower.
As I understand it, writes smaller than a flash page size cause the
flash drive firmware to fetch or erase an available page of flash,
combine the unmodified bytes from the existing page with the new bytes,
and then burn the page (and internal meta-data). So, if flash pages are
8K, burning in 512 blocks could cause 16 such operations, taking longer
and eating up the life of your flash cells. That said, RAM buffering by
the operating system, RAM buffering by the USB flash drive, and firmware
that anticipates serial writes should mitigate these effects.
For example, here is an ADATA 4 marketing-GB USB flash drive:
2017-03-27 10:50:16 root@jesse ~
# dmesg | tail -n 17
[ 2794.868073] usb 3-3: new high-speed USB device number 3 using ehci-pci
[ 2795.003837] usb 3-3: New USB device found, idVendor=125f, idProduct=c08a
[ 2795.003845] usb 3-3: New USB device strings: Mfr=1, Product=2,
SerialNumber=3
[ 2795.003851] usb 3-3: Product: ADATA USB Flash Drive
[ 2795.003856] usb 3-3: Manufacturer: ADATA
[ 2795.003861] usb 3-3: SerialNumber: 1392303332110024
[ 2795.026206] usb-storage 3-3:1.0: USB Mass Storage device detected
[ 2795.026718] scsi2 : usb-storage 3-3:1.0
[ 2795.026845] usbcore: registered new interface driver usb-storage
[ 2796.025404] scsi 2:0:0:0: Direct-Access ADATA USB Flash Drive
0.00 PQ: 0 ANSI: 4
[ 2796.027040] sd 2:0:0:0: Attached scsi generic sg2 type 0
[ 2796.028370] sd 2:0:0:0: [sdb] 7592960 512-byte logical blocks: (3.88
GB/3.62 GiB)
[ 2796.031242] sd 2:0:0:0: [sdb] Write Protect is off
[ 2796.031251] sd 2:0:0:0: [sdb] Mode Sense: 23 00 00 00
[ 2796.032626] sd 2:0:0:0: [sdb] Write cache: disabled, read cache:
enabled, doesn't support DPO or FUA
[ 2796.041663] sdb: sdb1 sdb2
[ 2796.072615] sd 2:0:0:0: [sdb] Attached SCSI removable disk
Burning 10 MB using 'bs=1M':
2017-03-27 11:01:23 root@jesse ~
# time dd if=/dev/urandom of=/dev/sdb seek=3000 count=10 bs=1M && sync
10+0 records in
10+0 records out
10485760 bytes (10 MB) copied, 2.93679 s, 3.6 MB/s
real 0m2.941s
user 0m0.000s
sys 0m1.020s
Burning 10 MB using default bs:
2017-03-27 11:01:57 root@jesse ~
# time dd if=/dev/urandom of=/dev/sdb seek=6144000 count=20480 && sync
20480+0 records in
20480+0 records out
10485760 bytes (10 MB) copied, 5.38085 s, 1.9 MB/s
real 0m5.385s
user 0m0.012s
sys 0m1.388s
David
Reply to: