Another DOS Format issue with MMC/SD

Gene Smith gds at chartertn.net
Mon Jan 26 17:06:42 UTC 2009


Thomas,
It just occurred to me too that that might be my user error. But I tried 
formatting /dev/sd-card-a1 on rtems and it seems to get the same result. 
I only see /dev/sd-card-a and can only mount it, not sd-card-a1. I will 
look on linux with dd to see if the result is the same.

Thanks,
-gene

Thomas Doerfler wrote:
> Gene,
> 
> it makes a big difference whether you format /dev/sd-card-a or
> /dev/sd-card-a1.
> 
> 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....
> 
> wkr,
> Thomas.
> 
> 
> 
> 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 
>> again.
>>
>> 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.
>>
>> -gene
>>
>>
>>
>> _______________________________________________
>> rtems-users mailing list
>> rtems-users at rtems.com
>> http://rtems.rtems.org/mailman/listinfo/rtems-users
> 
> 




More information about the users mailing list