Live data from Hacker News

XCalibur – the microSD in the stone

devpost.com

1–10 of 31 posts

Re: XCalibur – the microSD in the stone

#3
I have seen similarly weird results with flaky USB flash keys. A lot of those don't do any kind of hardware error detection.

The behavior described here can be explained by block device cache: You write a file to a device and the device doesn't report an error, but doesn't actually write the data due to some hardware error. When you read the file back, the content will come from cache in your RAM, not the device itself. Unmounting and mounting the device flushes the cache. When you then read the file again, it will come from the device and have the original content again.

Re: XCalibur – the microSD in the stone

#4
Some of the cheaper cards (and USB keys back in the day) sort of assume you'll use a single FAT[/32] partition and they understand the FAT and use it as poor man's TRIM information. They get super upset if you attempt anything that is not a single FAT[/32] partition. Some will actively forbid it by ignoring writes to the first sector of the disk and of the partition. Perhaps this is one of those cases?

EDIT: technically this is kosher as SD spec mandates FAT32 (just like SDXC spec mandates exFAT)

Re: XCalibur – the microSD in the stone

#6
post #4

Some of the cheaper cards (and USB keys back in the day) sort of assume you'll use a single FAT[/32] partition and they understand the FAT and use it as poor man's TRIM information. They get super upset if you attempt anything that is not a single FAT[/32] partition. Some will actively forbid it by ignoring writes to the first sector of the disk and of the partition. Perhaps this is one of those cases? EDIT: technica…

Wow, that's scary. Imagine a file system that kinda sorta passes the "looks like fat" test but works differently, causing the card to TRIM randomly all over your files :O

Re: XCalibur – the microSD in the stone

#8
post #3

I have seen similarly weird results with flaky USB flash keys. A lot of those don't do any kind of hardware error detection. The behavior described here can be explained by block device cache: You write a file to a device and the device doesn't report an error, but doesn't actually write the data due to some hardware error. When you read the file back, the content will come from cache in your RAM, not the device itse…

what about using sync to flush changes to disk? does it flush the block device cache as well?

Re: XCalibur – the microSD in the stone

#9
post #8
post #3

I have seen similarly weird results with flaky USB flash keys. A lot of those don't do any kind of hardware error detection. The behavior described here can be explained by block device cache: You write a file to a device and the device doesn't report an error, but doesn't actually write the data due to some hardware error. When you read the file back, the content will come from cache in your RAM, not the device itse…

what about using sync to flush changes to disk? does it flush the block device cache as well?

I think you have to play additional games with /proc/sys/vm/drop_caches then

Re: XCalibur – the microSD in the stone

#10
Sounds hasty. There are so many layers between you and your SD card it is hard to know sometimes which ones are broken.

Typically, if you can't use dd(1) to write to it, and the error dd(1) gives is not 'write protected media', then your card is essentially dead.

Post reply on HN