======================================= FreeBSD dd bs ======================================= dd is a standard Unix and FreeBSD command-line utility used to copy and convert raw data directly at the byte or block level. In the dd command, bs= stands for block size. It sets the exact number of bytes dd reads from the input (if=) and writes to the output (of=) in a single operation. If you do not set bs=, dd defaults to 512 bytes per chunk. On modern disks and USB drives, reading and writing 512 bytes at a time causes massive system call overhead and makes large transfers agonizingly slow. 2hrs vs 2mins. ======================================= Recommended bs Values By Task --------------------------------------- Writing an ISO/IMG to a USB Stick (bs=1m or bs=4m): A block size of 1m (1 megabyte) or 4m (4 megabytes) drastically speeds up flashing FreeBSD installer images to flash drives. Cloning or Wiping Hard Drives / SSDs (bs=1m to bs=16m): Using 1m or 4m saturates modern SATA and NVMe buses cleanly without wasting extra RAM. ZFS or Storage Benchmarking (bs=128k or bs=1m): Match the block size to the workload or dataset recordsize (which defaults to 128k on ZFS) when testing sequential throughput. Extracting or Patching Specific Sectors (bs=512 or bs=4k): When surgical precision is required—such as backing up a partition table, MBR, or bootloader—match the physical disk sector size (512 bytes or 4k) so count= and skip= land on exact sector boundaries. ======================================= Syntax & FreeBSD-Specific Tips --------------------------------------- Use Lowercase Suffixes: FreeBSD dd uses lowercase suffixes for sizes: k (1024 bytes), m (1024² bytes), and g (1024³ bytes). Unlike GNU dd on Linux, FreeBSD dd does not accept uppercase M or G—using bs=4M will throw an illegal numeric value error. Be Careful When Combining bs= and count=: Because count=N specifies how many blocks to copy, changing bs= changes the total amount of data copied (total bytes = bs × count). For example, bs=1m count=10 copies 10 MB, whereas bs=512 count=10 copies only 5 KB. Check Live Progress: While dd is running on FreeBSD, press Ctrl+T in your terminal. FreeBSD's kernel sends a SIGINFO signal that prints the current bytes transferred and transfer speed without interrupting the copy. Avoid Pipes with bs=: If you are reading from a network stream or pipe (ssh ... | dd), use ibs= and obs= instead of bs=, because partial reads from a pipe can cause dd to write short blocks prematurely. In almost every real-world FreeBSD scenario, bs=1m and bs=4m perform nearly identically, with bs=4m occasionally squeezing out a tiny bit more speed on cheap USB flash drives or high-throughput NVMe arrays. ======================================= How bs=1m vs bs=4m Compare --------------------------------------- System Call Overhead: bs=1m makes 1,024 read/write system calls per gigabyte, while bs=4m makes 256. On any CPU built in the last 15 years, both numbers are so small that CPU overhead is practically zero. Cheap USB Flash Drives: Budget USB sticks often have large internal NAND erase blocks (frequently 4 MB or 8 MB). Writing in bs=4m chunks aligns better with their internal controller buffers and can avoid small write penalties, making bs=4m slightly faster or smoother on USB drives. Modern SSDs, HDDs, and NVMe: FreeBSD's storage subsystem (GEOM) automatically splits or coalesces I/O requests into maximum transfer sizes (MAXPHYS, which defaults to 1m on modern FreeBSD 13/14+ systems). Because the kernel breaks a 4m request down into 1m I/O transactions underneath anyway, bs=1m and bs=4m hit the exact same hardware throughput ceiling. Ctrl+T Responsiveness: On very slow devices (like an old USB 2.0 stick writing at 5 MB/s), bs=1m updates progress every 0.2 seconds when you press Ctrl+T, whereas bs=4m waits nearly a full second per block to complete. ======================================= Practical Rule of Thumb --------------------------------------- Default to bs=1m for general disk cloning, wiping, and FreeBSD MAXPHYS alignment (it is also the official block size used throughout the FreeBSD Handbook). Use bs=4m when writing images to USB flash drives or SD cards. ======================================= Make A Bootable Stick In 2min --------------------------------------- dd if=FreeBSD-15.1-RELEASE-amd64-dvd1.iso of=/dev/da0 bs=4m conv=sync status=progress ======================================= Done =======================================