Friday, January 12, 2007

To Delete or Not: Computer Expert

by Dave New

The problem with in-camera deletion comes from the fact that given various combinations of reads/deletions/stores, there is an almost infinite combination of card file system state.

A good software tester can usually group a large number of those possible test cases using techniques like "equivalence classes," but that can be an inexact science (it depends on knowing sometimes too much about the internals of the filesystem code implementation), and it still typically leaves a lot of "unturned stones."

Consider, also, that actually testing a large number of those combinations may be prohibitive, because the card read/write speed becomes a factor. Most regression test suites aren't designed to take more than a day or so at the most to run. Executives that want products to ship don't have the patience for more testing, it seems.

The upshot is that a lot of potential end-cases probably don't get tested very well, except by poor consumers who end up losing images in the field when they hit the untested combination and uncover a bug in the file system software.

The two most buggy pieces of software traditionally are memory allocators and file systems. They are hard to get exactly right, and most companies that have what looks like good code in those areas will practically set up armed guards to keep newbie programmers from attempting to "improve" the code.

Not even Microsoft's file systems have been completely bug-free. Windows' FAT file system had a long-standing bug that surfaced when you filled a disk and still had pending data in the write buffers: it used to silently close the truncated file and discard the remaining data without reporting the data loss error to the application layer.

If you must delete, delete only the last image (or images, deleting the last recorded one first and working backward), rather than creating "holes" in the file system by pulling images out of the middle of a batch. Also, as a rule, I don't completely fill my cards.

Then, after transferring my images to two backups, I format the card in the camera. Doing a "delete all" in camera doesn't do any good—a format is the only reliable way to reset the file system to a given known state.

No sense tempting fate.

Posted by: DAVE NEW

ADDENDUM by Dave New: Most folks don't download through the USB cable, mainly because it is usually a lot slower than mounting the card directly in a high-speed USB or Firewire reader, or using a PC-Card reader, mounted in a PCMCIA slot.

That said, the rule of thumb should be to only let the camera format, write, and/or delete images.

It's particularly dangerous to format a card on the computer, and then write to it with another device. Likewise, it is dangerous to format or write files on a device, and then use the computer to delete those files.

When you format a card in the PC, it doesn't know the purpose that it is to be used for, and among other things, it doesn't set up any of the required "DCIM" folders, etc., that are used by camera devices.

The safest way to treat your cards is to assume they are "read-only" for all computer-based operations, and "write-only" for camera-based operations.

So, here is a summary of "safe" card usage:

1) Format the card in the camera you intend to use it in (not on the PC, nor in any other camera—you can delay doing this until you are about to use the card, so there will be no confusion as to which camera it has been formatted for).

2) Take pictures. Best practice is not to edit (delete) pictures in-camera in the field. There have been several good reasons given for this previously, some having to do with avoiding possible file system bugs, others having to do with accidental deletion (operator error).

3) To be really safe, don't try to squeeze the last shot out of a card. This is just pure paranoia based on past experience with file system bugs, but it certainly doesn't hurt to be conservative in this case.

4) Remove the card from the camera, and mount it in a card reader device. This really speeds up the download process, and conserves the camera battery. If the camera battery runs down during a USB cable transfer, you run the risk of corrupting images. Even if you ignore this advice, and download your images via a direct USB-to-camera connection, don't be tempted to manipulate images on the card from your PC.

5) Do not modify the card file system from the PC, period. Treat the card as read-only while it is mounted on the PC, and only copy your images from the card to the PC, preferably to two different locations for safekeeping.

6) Remove the card from the PC reader (I place mine upside down in my card case, to identify them as ready to reuse, but delay formatting them until I actually place them in the camera for use).

No comments:

Post a Comment