On Thu, Mar 02, 2017 at 09:06:52PM -0500, fred roller wrote:> On Thu, Mar 2, 2017 at 8:36 PM, Robert Moskowitz <rgm at htt-consult.com> > wrote: > > > dd if=/dev/sdb of=os.img bs=1M count=3210 > > > > I would recommend bs=512 to keep the block sizes the same though not a huge > diff just seems to be happier for some reason and add status=progress if > you would like to monitor how it is doing. Seems the command you have > should work otherwise.The dd blocksize has nothing to do with the disk sector size. the disk sector size is the number of bytes in a minimal read/write operation (because the physical drive can't manipulate anything smaller). the dd blocksize is merely the number of bytes read/written in a single read/write operation. (or not bytes, but K, or Kb, or other depending on the options you use.) It makes sense for the bs option in dd to be a multiple of the actual disk block/sector size, but isn't even required. if you did dd with a block size of, e.g., 27, it would still work, it'd just be stupidly slow. Fred -- ------------------------------------------------------------------------------- Under no circumstances will I ever purchase anything offered to me as the result of an unsolicited e-mail message. Nor will I forward chain letters, petitions, mass mailings, or virus warnings to large numbers of others. This is my contribution to the survival of the online community. --Roger Ebert, December, 1996 ----------------------------- The Boulder Pledge -----------------------------
On 03/02/2017 10:02 PM, Fred Smith wrote:> On Thu, Mar 02, 2017 at 09:06:52PM -0500, fred roller wrote: >> On Thu, Mar 2, 2017 at 8:36 PM, Robert Moskowitz <rgm at htt-consult.com> >> wrote: >> >>> dd if=/dev/sdb of=os.img bs=1M count=3210 >>> >> I would recommend bs=512 to keep the block sizes the same though not a huge >> diff just seems to be happier for some reason and add status=progress if >> you would like to monitor how it is doing. Seems the command you have >> should work otherwise. > The dd blocksize has nothing to do with the disk sector size. > > the disk sector size is the number of bytes in a minimal read/write > operation (because the physical drive can't manipulate anything smaller). > > the dd blocksize is merely the number of bytes read/written in a > single read/write operation. (or not bytes, but K, or Kb, or other > depending on the options you use.) > > It makes sense for the bs option in dd to be a multiple of the actual > disk block/sector size, but isn't even required. if you did dd with a > block size of, e.g., 27, it would still work, it'd just be stupidly slow.Kind of wondered about that. So the blocks reported by fdisk is what I should use as the count, as that matches the drive's real block size? thanks
The following worked: # dd if=/dev/sdb of=cubietruck.img bs=512 count=6268927 6268927+0 records in 6268927+0 records out 3209690624 bytes (3.2 GB, 3.0 GiB) copied, 114.435 s, 28.0 MB/s So bs= IS the drive blocksize. This is the result of trying a number of different values for bs and count. thank you On 03/02/2017 10:02 PM, Fred Smith wrote:> On Thu, Mar 02, 2017 at 09:06:52PM -0500, fred roller wrote: >> On Thu, Mar 2, 2017 at 8:36 PM, Robert Moskowitz <rgm at htt-consult.com> >> wrote: >> >>> dd if=/dev/sdb of=os.img bs=1M count=3210 >>> >> I would recommend bs=512 to keep the block sizes the same though not a huge >> diff just seems to be happier for some reason and add status=progress if >> you would like to monitor how it is doing. Seems the command you have >> should work otherwise. > The dd blocksize has nothing to do with the disk sector size. > > the disk sector size is the number of bytes in a minimal read/write > operation (because the physical drive can't manipulate anything smaller). > > the dd blocksize is merely the number of bytes read/written in a > single read/write operation. (or not bytes, but K, or Kb, or other > depending on the options you use.) > > It makes sense for the bs option in dd to be a multiple of the actual > disk block/sector size, but isn't even required. if you did dd with a > block size of, e.g., 27, it would still work, it'd just be stupidly slow. > > Fred >
On Thu, Mar 02, 2017 at 10:57:51PM -0500, Robert Moskowitz wrote:> > > On 03/02/2017 10:02 PM, Fred Smith wrote: > >On Thu, Mar 02, 2017 at 09:06:52PM -0500, fred roller wrote: > >>On Thu, Mar 2, 2017 at 8:36 PM, Robert Moskowitz <rgm at htt-consult.com> > >>wrote: > >> > >>>dd if=/dev/sdb of=os.img bs=1M count=3210 > >>> > >>I would recommend bs=512 to keep the block sizes the same though not a huge > >>diff just seems to be happier for some reason and add status=progress if > >>you would like to monitor how it is doing. Seems the command you have > >>should work otherwise. > >The dd blocksize has nothing to do with the disk sector size. > > > >the disk sector size is the number of bytes in a minimal read/write > >operation (because the physical drive can't manipulate anything smaller). > > > >the dd blocksize is merely the number of bytes read/written in a > >single read/write operation. (or not bytes, but K, or Kb, or other > >depending on the options you use.) > > > >It makes sense for the bs option in dd to be a multiple of the actual > >disk block/sector size, but isn't even required. if you did dd with a > >block size of, e.g., 27, it would still work, it'd just be stupidly slow. > > Kind of wondered about that. > > So the blocks reported by fdisk is what I should use as the count, > as that matches the drive's real block size? > > thanksif you're copying the entire device, you do not need to tell it how many blocks. just use a large-ish blocksize and let 'er rip. for a single partition, you could use the blocksize and block number you get from fdisk. you would then need to say /dev/sda4, e.g., instead of /dev/sda. when copying an entire drive I tend to use 10M as the blocksize. using a large blocksize just reduces the number of read operations that are needed. that's why a very small blocksize could slow down the copy, as it would require a whole lot more read operations. -- ---- Fred Smith -- fredex at fcshome.stoneham.ma.us ----------------------------- "Not everyone who says to me, 'Lord, Lord,' will enter the kingdom of heaven, but only he who does the will of my Father who is in heaven." ------------------------------ Matthew 7:21 (niv) -----------------------------