I have recently been clearing my SD card in my camera by formatting it using the camera. Can this harm the SD card or is it ok?
3 Answers
From the card's perspective, there really isn't any difference between what the camera does while formatting and when it's writing pictures. It's all just data written to blocks on the device* and you're not doing it any harm.
The format done by a camera does a couple of small writes: a fresh partition table and new file system headers. Both of these make the volume look like there's nothing on it. You're actually doing the cards a favor longevity-wise, because this doesn't wear the flash as much as the writes it would take to remove the files individually or to write zeros to every block. This is a very small favor in the grand scheme of things because thousands of blocks are written each time you take a picture.
*The command set used by most memory cards includes a "format" command that tells the device to prepare itself for use. This is a holdover from the days when magnetic disks came out of the factory unformatted, and what it does is vendor- and product-specifc. On memory cards it should do nothing.
Can this harm the SD card or is it ok?
It's more than OK. It can actually be beneficial. You're much more likely to extend the life of the card, as compared to never formatting and only erasing images in the card, by formatting regularly.
The way flash memory cards (and USB flash drives) work is that the memory controller on the card assigns different areas of the card for specific directory locations each time the card is formatted. They do this for what is known as load balancing/wear leveling.
Flash memory has a limited number of write cycles it can tolerate before it fails. The number of write cycles each bit on a flash memory card can handle before it fails is very large but it will eventually wear out. So the controller tries to ensure that each storage location of the entire card is written to roughly the same number of times over the life of the card. What this means is that even after you format the card the controller will continue using parts of the card that have not yet been written to until each storage location on the entire card has been written to before it will go back and begin using the locations that have already been used.
That's good for recovery because it means not much is overwritten until the entire card has been written to once. But then it's going to go back and use the very beginning again if that space is showing as empty. When you delete a file normally the space that file used is marked as empty but the state of each bit in that space is not altered. When you format a card pretty much all of the regular storage space on the card is marked as empty and available for use.
Formatting regularly helps the memory controller on the card do a better job of wear leveling. It also allows for better card performance by increasing the likelihood of sequential write operations. If you leave the same files on half the card and repeatedly write files to the other half, erase them, and rewrite other files then all of the wear is going to go to only half the card and the life expectancy of the card before half of it fails will be shorter!
Additionally, if a memory card's controller has detected bad sectors on the card it will remove those sectors from the listing of available sectors for the card. It does this each time the card is formatted.
Most memory cards have a bit more memory than their listed capacity. When a bad sector is identified, the memory controller will block the use of the bad sector and replace it with some of the 'spare' memory on the card. One of the common differences between top name brand memory cards and generic/no name memory cards is the number of bad sectors mapped out of the card's total memory before it leaves the factory. The greater the amount of memory that must be mapped out, the less reserve memory is available on the card for the controller to use as other sectors fail later on. All of the major brands (Lexar, SanDisk, Transcend, Kingston, etc.) get their components from the same handful of suppliers that actually manufacture the memory chips and controller chips. So do the off-brand names, but they usually buy the leftover components that may or may not have been good enough to pass the QC of the major brands' buyers. One of the thing the buyers look at is how much reserve memory remains on the chips after the bad sectors have been mapped out at the factory.
-
1\$\begingroup\$ I would have marked this the "correct" answer :P \$\endgroup\$ Commented Jul 7, 2019 at 4:31
The hardware of a memory card is robust and the duty cycles are high enough that normal camera use is a statistically improbable cause of a hardware problem.
Your camera has an easy way to format cards by design. It has ways to erase all the files on a memory card too. These erasure methods are less easy by design. The reason for these design decisions is that the most probable cause of memory card problems is corruption of the file system when software deletes and writes to the storage. Formatting places a new clean file system on the memory card so that all potential problems with the previous file system are eliminated along with other data.