Another DOS Format issue with MMC/SD
Thomas.Doerfler at embedded-brains.de
Mon Jan 26 16:43:11 UTC 2009
it makes a big difference whether you format /dev/sd-card-a or
The former will format the whole disk as a MSDOS filesystem (sometimes
called a "superfloppy"), this means, that the partition table residing
in the first sectors is overwritten with msdos information.
The later will format partition 1 of the sdcard, still leaving the
partition table intact.
Possibly you might do the same thing with linux....
Gene Smith wrote:
> After getting the format command to actually write to my MMC card I
> noticed another problem. I am not sure that it might not be a user error
> of some sort.
> When I format with shell cmd
> msdosfmt -t 16 /dev/sd-card-a
> if I mount the card (or if it remained mounted during fmt), the files
> and data are still there but I think just in cache. So it appears the
> cache is not invalidated by fmt code.
> If I restart RTEMS and mount, I can no longer mount /dev/sd-card-a1 but
> have to mount /dev/sd-card-a . Also, the sd-card-a1 partition no longer
> appears when I "ls /dev/", just sd-card-a.
> When I put the card on linux, it automounts as device sdc and not sdc1
> as it would before. If I try to format it with gparted, it claims there
> are problems.
> When I look at the device with dd in=dev/sdc out=t.txt I see that
> previous OEM formatting of the MBR (1st sector) and the FAT boot record
> (many sectors down) are gone. Instead the first block is not the MBR but
> the FAT boot record followed by the FAT tables and after that OK I
> think. So the disk looks like a "partition" (called sdc) w/o a MBR. I
> can mount it and copy files to it OK in linux.
> When I put the card back on RTEMS I can see files and copy them OK but
> still can only mount /dev/sd-card-a.
> Then back on linux with gparted, if I re-partition and then format I get
> a MBR back and can see and mount partition sdc1 and on RTEMS sd-card-a1
> Looking at the RTEMS dos fmt code, it appears that it does not read in
> the current MBR and FAT boot record before reformatting but tries to
> determine the parameters based on other information it has. Also, it
> writes the FAT boot record in the first sector (in the code it calls it
> "MBR") which wipes out the valid MBR in the first sector.
> I have noticed that other fmt tools (gparted, xp format) seem to keep
> the original MBR and FAT boot record (if valid) and only reinitializes
> the fat table and root dir area. They don't delete or change the
> MBR/partition table or move or change the FAT boot record, I think.
> rtems-users mailing list
> rtems-users at rtems.com
embedded brains GmbH
Thomas Doerfler Obere Lagerstr. 30
D-82178 Puchheim Germany
Tel. : +49-89-18 90 80 79-2
Fax : +49-89-18 90 80 79-9
email: Thomas.Doerfler at embedded-brains.de
PGP public key available on request
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
More information about the users