Sponsored Content
Full Discussion: dd bytesize
Top Forums UNIX for Advanced & Expert Users dd bytesize Post 302515149 by programAngel on Tuesday 19th of April 2011 08:29:40 AM
Old 04-19-2011
Quote:
Originally Posted by pludi
"bs" is the block size, not the byte size (a byte is always 8 bits). Reasons you might want to use it:
  • To transfer a certain amount of fixed-size records (using bs and count options)
  • To match the block size of a device, thus reducing I/O blocking (eg. for hard disks and tapes)
  • To make use of a large buffer, thus reducing I/O requests

Simple example: you want to create a backup of the master boot record prior to changing the layout, it's as simple as dd if=/dev/sda of=part_table.backup bs=512 count=1, since the MBR is exactly the 512 bytes at the beginning of the disk (including boot loader, partition table, ...)
thanks you.

regarding the second use "To match the block size of a device", who can I know the block size of a device?
like for example my hard disk
 
MBRLABEL(8)						    BSD System Manager's Manual 					       MBRLABEL(8)

NAME
mbrlabel -- update disk label from MBR label(s) SYNOPSIS
mbrlabel [-fqrw] [-s sector] device DESCRIPTION
mbrlabel is used to update a NetBSD disk label from the Master Boot Record (MBR) label(s) found on disks that were previously used on DOS/Windows systems (or other MBR using systems). mbrlabel scans the MBR contained in the very first block of the disk (or the block specified through the -s flag), then walks through every extended partition found and generates additional partition entries for the disk from the MBRs found in those extended partitions. Each MBR partition which does not have an equivalent partition in the disk label (equivalent in having the same size and offset) is added to the first free partition slot in the disk label. A free partition slot is defined as one with an fstype of 'unused' and a size of zero ('0'). If there are not enough free slots in the disk label, a warning will be issued. The raw partition (typically partition c, but d on i386 and some other platforms) is left alone during this process. By default, the proposed changed disk label will be displayed and no disk label update will occur. Available options: -f Force an update, even if there has been no change. -q Performs operations in a quiet fashion. -r In conjunction with -w, also update the on-disk label. -s sector Specifies the logical sector number that has to be read from the disk in order to find the MBR. Useful if the disk has remapping drivers on it and the MBR is located in a non-standard place. Defaults to 0. -w Update the in-core label if it has been changed. See also -r. SEE ALSO
disklabel(8), dkctl(8), fdisk(8), mbr(8) HISTORY
The mbrlabel command appeared in NetBSD 1.4. BSD
April 5, 2010 BSD
All times are GMT -4. The time now is 11:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy