While how Linux or another OS handles bad blocks varies both OS, drive type, and file system type, as well as application used (in your case, DD) you would have better luck trying to ask that on Superuser.stackexchange.com
But just for completion's sake, DD when ran with the noerror
flag, will skip over bad blocks/read errors, instead of stopping. Without the sync
flag, it will simply skip those errors, so your output file will be smaller. The sync flag does:
Pad every input block with NULs to ibs-size; when used with block or unblock, pad with spaces rather than NULs
So if you use notrunc,noerror,sync
, any read errors will be written as \x00
or NUL
, and the output will be the same size as the input.
As for how the SD card handles it, SD cards are Nand Flash memory with an embedded controller, which handles wear leveling, bad block management, and mapping the virtual file system to physical locations in the Nand memory. Part of it is that memory sectors have spare blocks, for if a few blocks in a sector die. It tries to write the data to the main block, read back to check if valid, then if not, uses those spares. It then marks the bad block as such. It's unknown if when a spare block section is used up if the entire sector is marked bad or not.
But this is all on the SD's internal controller's side. None of this is ever reported back to the OS. Bad Blocks in the Nand are not managed by the User/Application.