Writing files to MultiMedia Card (MMC) using USB reader/writer
Hi all,
First of all apologies if this is not the right forum for this question. I have a 4-in-1 USB CompactFlash/MemoryStick/SmartMedia/MultiMedia card reader/writer which works like a dream. Installation is simply a case of making sure the necessary kernel modules are loaded at boot-time (or added with insmod) and writing /etc/fstab entries that correspond to the first partition of each drive. Cards can then be mounted/unmounted and read/written to with ease. Recently however, I have been trying to write some mp3s to an MMC card for use in my mobile phone and have discovered an interesting problem. Reading from the card (and writing to disk) is fine but writing to the card (from disk) only appears to work. When I try to read the file back from the card (i.e., play the mp3 I've just written) I discover that the file is corrupted. Neither my computer nor my phone can play the mp3 without jumps and kicks and sometimes the file won't play at all. I am using the 'cp' command to write the file and I have noticed that the actual 'writing' activity only occurs when I unmount the card. My question is this: Should I be using a different command to write to the card? 'dd' perhaps with no conversion? AHMATIA. sebyte |
That is how it works.
The kernel doesn't write to disk immediately, but waits till theres not much else going on. When you unmount a drive the kernel will write any data pending to the drive. If you remove the card without unmounting it the kernel may not have written everything to it so the files will be incomplete, hence them being unplayable. cp is the correct command - just make sure you always unmount before removing the card. |
Ahh (great nick)... Thanks for your interest but I have been unmounting and waiting till all USB light flicker activity has ceased before removing the card. My mp3s are still corrupted for some reason....
sebyte |
Sorry it didn't help.
I can only suggest maybe a bad card or reader. |
Not at all. Thanks for trying. It's good to know that the 'write while unmounting' behaviour is as it should be.
I don't think it can be a bad card reader and I don't really see how it can be a bad card. Let me explain. Earlier, I was sent an mp3 file via Bluetooth (mobile phone to mobile phone) and saved it on the card. Listening to it, it sounded fine. I mounted the card and copied the file to disk and it still sounded fine. This must mean that both the card reader and the card are working, at least in one direction, and I know that the SmartMedia card reader/writer works perfectly in both directions so I am going to assume the problem lies elsewhere. I decided to 'format' the card using the phone's 'Format' option, and try once more to write something from disk-to-card. No joy. Listening to the mp3 on the card (using a Linux app) the jumping around was worse than ever and snatches of one song could even be heard in the middle of another!!! Obviously a corrupt filesystem I thought. (I think this particular card may be destined for the bin :-) I don't know if you're familiar with the GNU 'shred' command? Well I decided to shred /dev/sdc1 and recreate a FAT32 filesystem using GNU parted. I've never done either before but so what! I'm beyond caring about whether the card works in the phone. The shredding produced a fantastic long listing, a snippet of which is below: Code:
# ls -al /media/usb/MultiMedia I've no idea what I've done and no idea if GNU parted will come to the rescue but I'll keep you posted! sebyte P.S. If I have a question it's probably this: Is parted the right command to format the card and is FAT32 likely to be the right filesystem to use? |
FAT32 would be the right format, but I have never formatted a card in Linux.
If you know where the card is, e.g. /dev/sda1 or whatever, maybe fdisk will format it. |
fdisk....
Good point. |
All times are GMT -5. The time now is 07:18 AM. |