Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #171162

Re: ISO Verif: Is the "default 512 block size" == "I/O sector" size?

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From "Thomas Schmitt" <scdbackup@gmx.net>
Newsgroups linux.debian.user
Subject Re: ISO Verif: Is the "default 512 block size" == "I/O sector" size?
Date Wed, 17 Aug 2016 10:50:01 +0200
Message-ID <s74HT-71z-1@gated-at.bofh.it> (permalink)
References <s6YCt-34T-7@gated-at.bofh.it>
X-Mailbox-Line From debian-user-request@lists.debian.org Wed Aug 17 08:41:56 2016
Old-Return-Path <scdbackup@gmx.net>
X-Amavis-Spam-Status No, score=-8.987 tagged_above=-10000 required=5.3 tests=[BAYES_00=-2, FREEMAIL_FROM=0.001, LDO_WHITELIST=-5, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, RP_MATCHES_RCVD=-1.287] autolearn=ham autolearn_force=no
Content-Type text/plain; charset="utf-8"
Content-Transfer-Encoding 8bit
X-Provags-ID V03:K0:jcX/njKNtEphJhoDjATg5r2UyIJvhB3hOBhRIYsmAra3XlTURwE i7KZXFLx4Vh3+JGt5+Le0ExRE7oeXwhPkoPjJpOR+PMM3JnnbELs8h456wglRa/hwrlepZ1 JHOIj5/7jCFCCwxCDOiYSXebF5fuLbdf7KIISa/AAs/BoJbgRe+6mjjvfNGj2tNoa+Srflw cMKE9MNiJsoTlJgDNaSJA==
X-Ui-Out-Filterresults notjunk:1;V01:K0:ow530YKmZdY=:sbVHsYrY6MZJyAHItZeLwi lS2N7O17Wg+UBFdxN5pB2qnMSHKx7qxEd/BAQwdMpKVvbGt75hemr0aQV1CSrZQypDVOlNON6 uErfSW9KjscXFAftYGOT+5D9FwEnjAFYPuQfrOEOrPN01uo49t+HWgrVpFHRlschfUKMFQyLz qq3KuyinxqbqFPkQbTXQFY2608/7JkYOqZ9MFitmH6QYD8/H+7m6h3oQ5CALbAp9Y2ewzf8T+ EVZJ0LN7QMDtU201cnUuvOYojzQTxgG2mD/V/PqAQ2Cp637rZ5J50ru8z1KUgonqa7bzeXda4 NqzhQH8oWi0/aYVzDOUgZX++8rn6MstPqhZbDjqJmvps2Rv+GM6jgYyaN1S0TiGeRC/FkqjuA 9PadhKzdFM01YBPELV1OodxSfpEGVm5Hm137wA2byJX4RxrFa+Fi/NW5ieY9rTxj1YLzY4sBg RY8CT6IqLg2+4Q4OevJ84ruSgH+PhXAXFL/nGlmI7hteowezUN2hfNheV73L/WPU8rWtRYJFG TK64pZQojsIgD/SqLDJCI5wU3k0vbc9qfTArkuTaJGLUE3ikGrqTrwpYdFeMvntRKBsid6dHv 3b2FD/SHVyTxv1Cf1NWvYJHzoHTbCdDRRLoAi5GaaI+uRBMc4Z/ZK9b5Xc40SEkfOWJ4xiGsN 7glZHnCPMp6zwd+FYKowuvmUwx44s5rTNQZNNqcwjKiiDDEetPXfVQ46WTYC9Agp1F8Bl/aVv JTApt5CDI3XGB8cILVLCFBCUWc2OEbNqYxuPDyufNCjPvruPlyyEbTTrc/CrkNEiB/t2Qku5C 1jPJuIJ
X-Mailing-List <debian-user@lists.debian.org> archive/latest/710684
List-ID <debian-user.lists.debian.org>
List-URL <https://lists.debian.org/debian-user/>
List-Archive https://lists.debian.org/msgid-search/4679588318869811007@scdbackup.webframe.org
Approved robomod@news.nic.it
Lines 93
Organization linux.* mail to news gateway
Sender robomod@news.nic.it
X-Original-Cc andrew.comly@protonmail.com
X-Original-Date Wed, 17 Aug 2016 10:43:21 +0200
X-Original-Message-ID <4679588318869811007@scdbackup.webframe.org>
X-Original-References <cZQdM32POAtOjHMAEVMXA5R-iPRMlYrdrjI8I1v5xd3qPjFYVykrdTFmx96OBFG3NOeGlmfiz7fgMB5uJL3mjTVhDpDv9zav75DGqBVbeoc=@protonmail.com>
Xref csiph.com linux.debian.user:171162

Show key headers only | View raw


Hi,

Andrew F Comly wrote:
> You said earlier that 512 is the default block size.

The default of program "dd", to be exacting.

Block size is normally a property of devices and filesystems.
Many devices offer direct random access only at the granularity of
their block size.
E.g. a CD can be read in chunks of 2 KiB. If software needs to address
in finer steps then it has to load full blocks and pick from them
the bytes which are desired.

Filesystems use block addresses to point from name to data. It is
technically desirable that file system block size is an integer multiple
of the device block size. (Multiplication factor 1 is normal.)


> I looked up that "bs" also refers to block size.

Option bs= is the combination of dd options ibs= and obs=. The program
uses these sizes for single read or write operations. (One may experience
surprises if the input does not deliver full blocks or the output demands
larger ones.)
The advise to use large bs= when curbing data reading from a device or file
is merely to improve the read and write speed. Copying many small chunks
can impose substantial overhead.


> So it appears that we have two "block sizes".

In the case of buffered i/o on a USB stick or DVD you may more or less
use any block size which divides without remainder the desired amount of
bytes.
(Giant sizes should be avoided because they bring no improvement while
 filling giant memory buffers.)


> $ fdisk -l

fdisk seems to assume block size 512 with data files.
With devices it obviously inquires their block size.
E.g. with a CD:

  $ /sbin/fdisk -lu /dev/sr4
  ...
  Units: sectors of 1 * 2048 = 2048 bytes


> 255 heads, 63 sectors/track, 1988 cylinders,

The Cylinder/Head/Sector addresses of disk-like devices are quite bogus
nowadays. They are uphold for legacy software (and to confuse programmers
like me).
Regrettably MBR partition tables show these numbers, so one has sometimes
to find the factors sector-per-head and heads-per-cylinder from comparing
Logical Block Addresses with CHS adresses.
(Mathematically this is equivalent to the task of finding those points of
 a 2D-parabola which have integer coordinates.)

255 heads (per cylinder) and 63 sectors/track is a poor guess, of course,
as 16358768640 consists entirely of prime factors 2, 3, and 43.
The numbers 255 and 63 contain prime factors 5, 7, and 17 which spoil
any attempt to match above big number by integer multiplication.

The reason for 255, 63 is simply that they are the largest values
possible for heads-per-cyl and sec-per-head in the CHS address fields
of a MBR partition table.
The range of CHS addressing ends at 8,422,686,720 bytes, because MBR
partition table entries can only record up to 1024 cylinders.

So with your 32 GB stick, CHS is a mere ornament.


> Is my hypothesis that the "512 block size" is the "I/O" or "sector" size
> correct?

Roughly yes. But mainly in the case of fdisk, not so much in the case of dd.
WIth fdisk the number 512 stems either from device properties or from the
default of fdisk, if no device properties can be inquired (as from a data
file).

Unless the input of dd is a device which may deliver less than the block
size in a single read operation, you are free to choose a dd blocksize.
(It can become tricky with pipes as input. Even if you choose a block size
 lower than the pipe buffer size, you imay get less input bytes per block
 than expected.)


Have a nice day :)

Thomas

Back to linux.debian.user | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

ISO Verif: Is the "default 512 block size" == "I/O sector" size? Andrew F Comly   康大成 <andrew.comly@protonmail.com> - 2016-08-17 04:20 +0200
  Re: ISO Verif: Is the "default 512 block size" == "I/O sector" size? "Thomas Schmitt" <scdbackup@gmx.net> - 2016-08-17 10:50 +0200

csiph-web