[Arm-dev] making a .img from a mSD card

Manuel Wolfshant wolfy at nobugconsulting.ro
Tue Dec 29 21:33:02 UTC 2015


On 29 decembrie 2015 15:43:40 EET, Robert Moskowitz <rgm at htt-consult.com> wrote:
>So I looked at the dd manpage.  The dd of the Cubietruck image to mSD 
>reports:
>
>3072+0 records in
>3072+0 records out
>3221225472 bytes (3.2 GB) copied, 363.872 s, 8.9 MB/s
>
>So it would seem the following should work, given that I have not 
>changed the partition size(s):
>
>dd if=/dev/sdb of=base.img count=3072 bs=1M
>

dd can use ANY block device as source/dest so instead of working with the entire mSD, restrict the command to the partition of interest.  Just use fdisk to identify the partitioning scheme and then use dd to read from (for backup purposes) and write to (to recover from a known good setup) the desired partition. For instance, assuming your root fs of your CT resides in  /dev/sdb2:
 dd if=/dev/sdb2 of=/path/to/backups/RootImage.bkp bs=4M
resp:
 dd of=/dev/sdb2 if=/path/to/backups/RootImage.bkp bs=4M

Note the block size of 4MB. On MY system, with MY card reader, using 4 and 8 MB block sizes are the fastest options. I've tested with everything from 512k to 32 MB. 4k is way too small and does not exploit the available bandeidth, 1MB is a conservative value but still on the lower end, 16 MB and larger seem to exceed the buffers' sizes. With medium quality no name SDs I get at least 10MB/sec and up to 20-50MB/sec with good quality ones. (man dd, look for SIGUSR).

As usual, YMMV but I strongly suggest to test and compare using bs of 1,2,4,8 and 16 MB.

PS: invest into USB3 interface + card reader if you are still using USB2 on the PC. You will thank me later.



>
>On 12/29/2015 05:46 AM, Robert Moskowitz wrote:
>>
>>
>> On 12/29/2015 12:49 AM, Mandar Joshi wrote:
>>>> Can some one point me to where I can find how to do this?
>>>>
>>> If you are talking about the time it takes to write an image to a
>>> card, I think you should be looking at the block size option with
>dd.
>>> dd if=image.img of=/dev/sdb bs=1M
>>
>> And how do I go the other way that only takes to the end of sdb3, not
>
>> the whole card?
>>
>>> I use 1M because it works flawlessly with my card writer. I had done
>a
>>> google search for it and found a recommendation of 4k. But 1M works
>>> for me, so I've stuck to 1M for now.
>>>
>>>
>>> Regards
>>> Mandar Joshi
>>> _______________________________________________
>>> Arm-dev mailing list
>>> Arm-dev at centos.org
>>> https://lists.centos.org/mailman/listinfo/arm-dev
>>>
>>
>> _______________________________________________
>> Arm-dev mailing list
>> Arm-dev at centos.org
>> https://lists.centos.org/mailman/listinfo/arm-dev
>>
>
>_______________________________________________
>Arm-dev mailing list
>Arm-dev at centos.org
>https://lists.centos.org/mailman/listinfo/arm-dev




More information about the Arm-dev mailing list