[squeak-dev] Image damaged due to IO error while saving

K K Subbu kksubbu.ml at gmail.com
Sun Feb 2 14:03:58 UTC 2020


On 02/02/20 7:57 AM, tim Rowledge wrote:
> The way we used to do this on RISC OS was (is, for the remaining
> users!) to allocate a file of the required size and it would be
> filled with 0. That way if you got a success return code you knew for
> certain (barring fire, flood, bomb or bear attack) that the file
> could be over-written with your real content. Do any other filing
> systems actually really definitely allocate space when you ask for
> it? No idea.

Writing twice into the same file will increase wear and tear in SSDs 
unnecessarily. An image is just an array of bytes, so one of the 
following techniques could be adopted:

* create dummy files in fixed size units (say 128MB) and write the image 
as usual. If the image write returns a disk full error, then delete one 
or more of these dummy files to complete the operation.

* create a two file partitions of max size (say A and B). Alternate 
writing to these partitions and mark the latest successful write as the 
real McCoy.

* create a file with two segments each of max size. Alternate writing 
into these two as in the case above. The header will need a flag to 
identify which one is latest.

Regards .. Subbu


More information about the Squeak-dev mailing list