What happens to free/erased Blocks after restore?

USB Image Tool support forum
Post Reply
ebelcrom
Posts: 2
Joined: Mon Feb 17, 2014 2:25 pm

What happens to free/erased Blocks after restore?

Post by ebelcrom »

Hi folks,

I'm using this tool to "restore" some images (device mode) on SD cards I created using "backup" before. What is happening to the blocks/segments of the SD card that are free resp. not used resp. marked as erased? Are these blocks all marked as used after restore? This would be bad cause in this case there is no free space in which the wear leveling could be processed, right?
Alex
Site Admin
Posts: 272
Joined: Fri Jul 29, 2011 11:59 pm

Re: What happens to free/erased Blocks after restore?

Post by Alex »

Blocks, which are used for wear leveling, do not appear as free blocks for the file system. They are additional blocks, hidden by the firmware/controller. At least this is my knowledge how it is done with SSDs.

USB Image Tool tries to write each block of the image. If it is marked as erased by the file system is not known to USB Image Tool, as it doesn't work on file system level. Nevertheless, a block that is covered by a partition, is always "in use". Even if it is no data currently stored in that area by the file system, it could be used anytime by writing new data. As far as I know, the blocks that appear to a file system are also a logical abstraction by the SD cards/SSDs firmware, which matches them to the physical cells on the flash memory. The wear leveling happens on that logical block to physical cell level.

Note: My knowledge on that might not be 100% accurate, but some google searching shows, that it should be working the way I described it above.

http://electronics.stackexchange.com/qu ... controller
ebelcrom
Posts: 2
Joined: Mon Feb 17, 2014 2:25 pm

Re: What happens to free/erased Blocks after restore?

Post by ebelcrom »

I try to figure out if there is a difference between writing data mounting the SD card or writing it using an image. Since the storage driver should erase segments (e.g. SPI mode, CMD38 ERASE) in case the file system deletes data sitting on the logical segment, unused areas should not be accessed on a mounted card.

Are not used resp. "invalid" segment data marked as such in the image at the backup action? If not how should the storage find out "free" areas from file system are not used yet?
Alex
Site Admin
Posts: 272
Joined: Fri Jul 29, 2011 11:59 pm

Re: What happens to free/erased Blocks after restore?

Post by Alex »

During the backup image, blocks not used by the file system are not marked in any way. The backup just writes the whole image and doesn't know abaout the underlying file system (can even be ext3 or something else not known to Windows). I guess it would be difficult for the storage driver to detect deleted blocks in the newly written image, because the SD cards is accessed on a lower level than the file system driver.
Post Reply