Re: [SLUG] Reading blocks from SD card

From: Donald E Haselwood (dhaselwood@verizon.net)
Date: Sun Sep 23 2007 - 23:09:11 EDT


On Sunday 23 September 2007 10:54, Eben King wrote:
> On Sun, 23 Sep 2007, ronan wrote:
> >> dmesg shows the device. If it is fomrated correctly with FAT it mounts
> >> the device automatically after it is plugged in (and shows up as
> >> "/media/disk", though the initial message is "system:/media/sdc1").
> >> When I do "dd" I get less than one block (512) and it isn't anything
> >> that is on the card.
> >
> > You can specify a block size and block count with dd:
> >
> > dd if=/dev/sdc1 of=myimage bs=512 count=1024
>
> Or you can read a particular block with
>
> dd if=/dev/sdc1 of=myimage bs=512 count=1 skip=1024
>
> > I don't know if that would put you on the road to solving your problem.
>
> Ditto.

ronan and Eben,

Thanks for the tips on dd usage.

I think I have it sorted out--

If the SD card has (aboslute address) block 0 trashed, or zero'ed, then it has
to be accessed as /dev/sdc. dd will copy the blocks starting at absolute
address zero. To format the SD, which I was also having trouble
doing, /dev/sdc brings up a warning about formatting the whole disk and to
use "-I" to force it. That works.

If block 0 (which has the partition table which contains the address of
the "boot" sector, BPB in FAT terminology), is OK, then "dd" copies blocks
starting at the boot sector address, which in the case of the particular card
I'm using is 0x00006600, and the access is via /dev/sdc1. mkfs.vfat
with /dev/sdc1 brings up an error message of file or directory not found.

It looks like the situation is the same as for a HD, e.g. hda v hda1, where
the suffix 1 indicates a particular partition and without it, it refers to
the whole drive.

So I should be able to write blocks with the micro to log data onto the SD
withoug a file system, then plug it into the PC and run dd with "if=/dev/sdc"
and get the data into the HD.

Don
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 19:19:02 EDT