- Sep 12, 2010
No, you didn't get my point. The problem isn't how it is being written, the problem is that you are writing the whole media, i.e. almost all blocks exposed by the FTL. It simply breaks the wear leveling resulting in data loss because the FTL has not enough free room to react correctly.because its the first time I hear of this, and I find this very hard to believe. if that was true SSDs would also freak out if you wrote a 4GB+ file as this would also be a long continuous write spanning multiple erase blocks.
I'm gonna have to see some external information sources backing what you're saying because those would be the symptoms of a very broken FTL firmware.
with any semi-decent firmware, overwriting the whole media should unfragment a good portion of the FTL remapping, of course this would count as a full erase-write cycle for each erase block, but only once per erase block.
especially if you wipe the whole card first by sending it a TRIM command covering the whole device to be sure wont shuffle old data around.
there's the new BLKDISCARD ioctl command that can be used for this
random IO is what the FTL firmware has to work hard to wear level properly, not huge sequential block writes.
of course, if you're backing and restoring only 64MB of data on a 8GB card, that's a huge waste of time, better to just copy the files.
if you got 7GB of stuff on a 8GB card you want to backup and restore later then you might as well backup/restore the whole image, at least the file directory structure will be only written once, even if you overwrite 1/8th of the card for "no good reason", the file management wont be overwritten multiple times over as the OS is marking free blocks as allocated and updating the directory information.
there's a point where it causes less wear to rewrite the whole thing once rather than file-by-file.
if you want to test, fill an SD card to the brim with stuff like a whole bunch of debian packages.
then copy all those files to a backup folder on your HDD
also make a full backup image of the SD card on your HDD
reformat the card
time how long it takes to copy all files back to the card file by file (cp -r backup/* /media/sdcard)
time how long it takes to restore the image (dd bs=16777216 if=sd.img of=/dev/sd... )
since erasing flash blocks is the slowest operation by far, the time will tell you roughly how hard the FTL had to work.