Olympus-OM
[Top] [All Lists]

Re: [OM] deleting image files in camera.

Subject: Re: [OM] deleting image files in camera.
From: Chuck Norcutt <chucknorcutt@xxxxxxxxxxxxxxxx>
Date: Mon, 09 Feb 2009 09:15:06 -0500
It has to do with the ability to recover from accidentally formatting 
the card or (very much less likely) development of read errors in the 
directory.

A FAT16 or FAT32 formatted card/disk consists of a directory containing 
file names, a pointer to the address where that file begins and a count 
of the number of storage clusters used (a cluster is the smallest 
storage allocation unit and consists of a group of 512 byte sectors, the 
smallest storage unit on the disk)  For FAT16 format (CF cards of 2GB or 
less) cluster size can range from as small as one sector (512 bytes) to 
as large as 64 sectors (32KB).  For FAT32, clusters are always 8 sectors 
and 4KB.

When FAT format files are written they are initially written 
sequentially.  If you delete a file it opens a hole in the chain of 
storage locations.  Depending on the storage allocation logic in use by 
your camera that hole may or may not be used when it comes time to store 
the next image.  If it's smart code it will not reuse that space until 
the card is otherwise full.  If it's not so smart or if you've filled 
the card from beginning to end, storing another image requires finding 
the space freed by your deletions.  But it's unlikely that the size of 
the file about to be written is exactly the same size as the original 
file that had been in that space.  If will either be smaller or larger. 
  If smaller the original space will be occupied by the new file plus a 
tail end fragment of the old file.  If larger the old space will be 
occupied by a portion of the new file and the remainder will be 
allocated to another chunk of empty space that might be anywhere. 
Furthermore, that space may not be contiguous but may in turn be broken 
into many smaller non-contiguous chunks.  The directory also keeps track 
of these non-contiguous storage areas via use of a linked list that 
tells which clusters are used for that file and where they are all located.

When you format a disk or CF card on your computer you can do either a 
full format or a "quick" format.  A full format completely erases all 
the directory information and all of the data by writing a fixed bit 
pattern into all storage locations.  It may also read back the erasure 
data pattern to check the health of each sector.  A quick format (what 
the camera does) only erases the directory information.  All of the file 
data still exists but the list of file names and where they start and 
end has been lost.

If you were to accidentally format your CF card or if the card developed 
errors in the directory a smart utility can recover everything if all of 
the files have been written sequentially.  It doesn't have any pointers 
to know start or end positions but, if it knows the format of the JPEG 
or raw files, it can recognize the starting position of a new file by 
recognizing certain file header or descriptive information at the 
beginning of the file that is independent of the actual image data.  It 
then infers the size of the file by searching for the next image header. 
  If there have been no erasures the end of one file will be marked by 
the beginning of the next and there's no ambiguity.  The original file 
name will not be known but the file will be successfully recovered.  If 
there have been erasures but that space hasn't been reused then the 
recovery utiliyt will recover the file that you thought was deleted.  If 
the space has been reused that new image will likely be corrupted unless 
it just happens to exactly fit the old space allocation.  If smaller it 
may pick up some piece of the image previously stored there.  If larger, 
other pieces of the image will be stored in one or more non-contiguous 
locations and there is no way to know how to reconstruct them.

Fortunately, this has only happened to me once.  I picked up the wrong 
CF card, put it into the camera and realized about 1/2 second too late 
that I was formatting the wrong card.  Because I had manually erased a 
number of images on that card the recovery utility only successfully 
completely recovered a subset of images.  Fortunately the couple that I 
really needed were intact.

Lesson learned.  Never erase images in-camera unless absolutely required.

Chuck Norcutt


John Hudson wrote:
> Someone posted a message recently opining that unwanted image files should 
> not be deleted in camera.
> 
> What was the reason for suggesting that unwanted images should not be 
> deleted by exercising the trash-can button on the camera?
> 
> jh
>  
> 
> 

-- 
_________________________________________________________________
Options: http://lists.thomasclausen.net/mailman/listinfo/olympus
Archives: http://lists.thomasclausen.net/mailman/private/olympus/
Themed Olympus Photo Exhibition: http://www.tope.nl/

<Prev in Thread] Current Thread [Next in Thread>
Sponsored by Tako
Impressum | Datenschutz