Forgot Password
Pentax Camera Forums Home
 

Reply
Show Printable Version Search this Thread
12-06-2011, 02:27 PM   #61
Veteran Member
jolepp's Avatar

Join Date: Oct 2010
Location: Finland
Photos: Albums
Posts: 3,196
QuoteOriginally posted by aleonx3 Quote
Simple question, but lots of ideas and discussion, great stuff.

What if there is something wrong with the SD card or you change your mind that you need to salvage (recover) the images? Which one is easier?
A short answer: Recovery after delete is much easirer, it (almost) always works.

A longer answer:

As pointed out the data area containg the actual file contents is intact after both a (quick) format and deleting all files so recovery is not positively impossible in either case. With format the root directory gets overwritten so more of the data of which blocks belonged to which file (or subdirectory) is permanently gone and so a complete recovery is harder to accomplish compared to delete where the directory entries are merely marked ununsed and the rest of the information, in particular, the the first cluster # of the file is still there. In both cases the FAT table slots ordinarily used as a linked list to figure out the rest of the clusters have been overwritten with zeroes to indicate free clusters so undelete cannot be guaranteed in either case. However, as a file almost always occupies adjacent clusters and the size of the file is known from the directory entry, undelete almost always works after a delete. Also, since photo files have a known structure with headers, a recovery utility may be able to work things out using that even when the information of the first cluster is gone or the assumption of adjacent clusters does not hold.


Last edited by jolepp; 12-07-2011 at 12:21 AM. Reason: better wording, typos
12-06-2011, 09:31 PM   #62
Site Supporter
LaurenOE's Avatar

Join Date: Sep 2009
Location: San Francisco Bay Area
Photos: Albums
Posts: 3,482
One of the issues that I have is when a computer decides to write a file on the SD card that you don't know is there.

If you take an SD card with images, and put it in a Windows 7 machine, and you choose Thumbnails, you will get a hidden system file called "Thumbs.db"

I don't know how the "Thumbs.db" file is created and what the link to the original file is, but the Thumbnail is a snapshot of the larger image, which means that the original image file was read and accessed. Therefore the date on the image for creation or last saved or whatever becomes something for the operating system to understand - or in my case - corrupt the header information from my original images.

I have no idea what an Apple computer does or other operating systems do.

By formating an SD card, I am assured there are no hidden system files that might cause issue with the images that are on the card or cause issue with the camera.

Since I have no idea how the Thumbs.db file is created/updated, it only makes sense to get rid of files that represent an earlier batch of images that are no longer on the card.
12-06-2011, 10:52 PM   #63
Senior Member
CP140's Avatar

Join Date: Jun 2011
Location: Greater Vancouver
Photos: Gallery | Albums
Posts: 177
I'm not sure I'm qualified to give a good answer, but I'll throw my two cents in anyway...

1) I format the card in the camera the first time I use the card and I don't buy the cheapest cards available. If (it hasn't happened yet) the card fails to format, it gets one more chance... then it's disposed of.

2) I copy all pictures taken each day to my computer(laptop if travelling) leaving images on the card.

3) I have multiple cards... numbered in sequence. When one card gets close to full, I swap it for the next higher numbered card.

4)When I run out of cards, I start again with card number one, erase all the images (using the camera's utilities) and start again. I have enough cards /capacity to shoot a couple hundred shots a day for two weeks and not run out of room/cards.

5) I only format/erase images using the camera... I don't let Windows touch the card apart from from copying images from the card. The only device that writes to the card is the camera.


As I said, I'm not the font of wisdom and knowledge here.... but after close to 8 months and over 6200 images(according to PhotoMe), I haven't (touch wood) had a problem with cards yet...
12-07-2011, 09:43 AM   #64
Veteran Member




Join Date: Apr 2010
Location: Tennessee
Posts: 1,994
QuoteOriginally posted by CP140 Quote
I'm not sure I'm qualified to give a good answer, but I'll throw my two cents in anyway...

1) I format the card in the camera the first time I use the card and I don't buy the cheapest cards available. If (it hasn't happened yet) the card fails to format, it gets one more chance... then it's disposed of.

2) I copy all pictures taken each day to my computer(laptop if travelling) leaving images on the card.

3) I have multiple cards... numbered in sequence. When one card gets close to full, I swap it for the next higher numbered card.

4)When I run out of cards, I start again with card number one, erase all the images (using the camera's utilities) and start again. I have enough cards /capacity to shoot a couple hundred shots a day for two weeks and not run out of room/cards.

5) I only format/erase images using the camera... I don't let Windows touch the card apart from from copying images from the card. The only device that writes to the card is the camera.


As I said, I'm not the font of wisdom and knowledge here.... but after close to 8 months and over 6200 images(according to PhotoMe), I haven't (touch wood) had a problem with cards yet...
OTOH, I let windows quick format my cards every time I import photos (every time I'm through with a shoot or the card is full). Been doing that for about 7 years and probably 80,000 photos. I've never had a problem with a card, either, other than one that physically came apart on me. So did I format that one too much?

12-07-2011, 01:16 PM   #65
Veteran Member
riff's Avatar

Join Date: Jun 2011
Photos: Albums
Posts: 1,408
What a thread!

I've written a complete interface to memory cards for three different platforms. The low level assembly language code that controls the card, implementing the FAT file system from scratch and providing the high level interface for use by the applications the systems run. There are probably people here who have more experience and know more then I about how FAT and these devices work. There are probably not many of them.

There is so much nonsense in this thread that it should probably be in the Politics and Religion forum.

I did learn something, never participate in computer tech threads on PF.

So to one and all, the never format to the format in camera, naked under a full moon while drinking stump water and rattling chicken bones, live long and prosper.
12-07-2011, 01:31 PM   #66
Veteran Member
Philoslothical's Avatar

Join Date: May 2011
Posts: 1,723
So riff, what's the correct answer in your opinion?

Lemme guess: "Doesn't matter much what you do, either way". Close?
12-07-2011, 01:37 PM   #67
Pentaxian
ducdao's Avatar

Join Date: Dec 2009
Location: Montreal/Vermont
Posts: 2,160
QuoteOriginally posted by riff Quote
What a thread!

I've written a complete interface to memory cards for three different platforms. The low level assembly language code that controls the card, implementing the FAT file system from scratch and providing the high level interface for use by the applications the systems run. There are probably people here who have more experience and know more then I about how FAT and these devices work. There are probably not many of them.

There is so much nonsense in this thread that it should probably be in the Politics and Religion forum.

I did learn something, never participate in computer tech threads on PF.

So to one and all, the never format to the format in camera, naked under a full moon while drinking stump water and rattling chicken bones, live long and prosper.
what are recommendations then?
12-07-2011, 01:48 PM   #68
Pentaxian
normhead's Avatar

Join Date: Jun 2007
Location: Near Algonquin Park
Photos: Gallery | Albums
Posts: 25,043
QuoteQuote:
Norm, this is not accurate. The writes are done a byte ( or sometimes a nibble (4 bits, half a byte)) at a time. This means deleting 100 files will be at least 100 bytes to change and 100 writes. Formating will be more bytes and writes, how much more depends on how the "format" was designed.
Then why, when I do it on my camera does deleting individual files take so much longer... and tie up my camera for so long. Just based on the wait times on the K-x it's shorter. Hey I don't know as much as you about this stuff, but what you're telling me doesn't fit with actual use of the camera. As I invited everyone to do above.

The two best reasons for formatting, using the camera to delete files.... it's faster than using the "delete all files" command.
The other reason for formatting on the camera, you are 100% certain the camera will understand the format.

I've had experience with both of these issues, a camera not understanding a card formatted on a computer and slow camera "delete all files" procedures.

I'll grant you, I might not know what's happening in a format of an SD card, but the results I've observed are indisputable.
As I said, my loading process is automated.. why would I bother dragging and dropping? It's an un-needed step.

12-07-2011, 02:01 PM   #69
Veteran Member
Philoslothical's Avatar

Join Date: May 2011
Posts: 1,723
QuoteOriginally posted by normhead Quote
Then why, when I do it on my camera does deleting individual files take so much longer...
This has been getting worse with each generation of Windows, because Windows does increasingly stupid stuff with files, caching, indexing for search, shadow copies, etc. If you deleted the same files from the command line, or used an OS that doesn't have all that bloat* (just about any linux distro, for example), you would find the process nearly instant.

*I'm suggesting linux for testing and comparing to Windows in this context, I'm not pushing it for day to day use, although it works out well for some people as their main OS.
12-07-2011, 02:38 PM   #70
Veteran Member
jolepp's Avatar

Join Date: Oct 2010
Location: Finland
Photos: Albums
Posts: 3,196
@riff Hmm? My theorizing in this thread hinges on the memory cards being block oriented. If this premise does not hold, the conclusions are of course no good. I would recall this being the case from adapting an SD/MMC card interface for an ARM Linux kernel driver for a proto board some years back. Also, AFAIK, memory cards are based on NAND flash which, AFAIK, is strictly block oriented so the cards having anything but a block oriented interface does not make sense on that account either. Besides, FAT as a disk file system is block oriented itself. Am I missing something? (Or have you perhaps worked on FAT implementations backed by something that was not block-oriented?)

Edit: With a FAT FS residing in memory mapped NOR flash it might be possible to delete a file by overwriting just one byte (***) (this would still leave the space reserved until the same was done to the FAT slots though), however, as an embedded SW engineer (MSc CS ) myself, even after some googling, I still don't see a way around 1) the SD card interface being block oriented (*) and 2) the underlying NAND flash being the same. Here being 'block oriented' means that to change a single byte (or even a bit) one must overwrite the whole block containg it (at the SD card interface this would be at least 512 bytes, NAND flash blocks tend to be larger).

It has been a while since I actually went trough any FAT documentation, but a quick refresh from Wikipedia would seem to indicate that I have had the key points right above, namely: there is a (relatively small) 'superblock' at the beginning of a disk (partition), one or more FATs follow (**) and the rest is used for file data/directories and is allocated in units of 'clusters' (= a fixed number of adjacent native disk blocks). Directory entries contain the file name (***), date, ... and crucially the first cluster # of a file, the rest are recorded in the FATs as what is essentially a singly linked list with no other content than the link (= next cluster # / FAT slot index). There is no list of free clusters, instead a free cluster has its FAT entry zeroed.

(*) A quick browse trough the SD card spec (from https://www.sdcard.org/home/) would seem to validate my recollection of this (?).

(**) two was the norm for actual disk(ette)s, this has probably carried on (?).

(***) the first byte of the file name doubles as multivalue flag with the most important associated meaning of 'directory entry in use'. Due to this there is a related special consideration for memory mapped NOR flash: Since the value 0xE5 is supposed to be used for entries where file was deleted, one can delete a file 'by the spec' by writing a single byte without an erase operation only if the bit pattern of the first character of the file name has no '0' bits in the positions where the value 0xE5 has '1' bits. The erase operation flips *all the bits of a block* to '1's though and this is the only way to get a bit back to '1' once it has been written as '0'

Last edited by jolepp; 12-08-2011 at 03:12 PM.
Reply

Bookmarks
  • Submit Thread to Facebook Facebook
  • Submit Thread to Twitter Twitter
  • Submit Thread to Digg Digg
Tags - Make this thread easier to find by adding keywords to it!
camera, format, k-r, kr, pentax k-r, pics, sd
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads
Thread Thread Starter Forum Replies Last Post
*ist DS "memory card error" - card won't format WMBP Pentax DSLR Discussion 6 04-05-2016 04:39 PM
format the SD card directly Pentax KX macthomas89 Troubleshooting and Beginner Help 13 08-17-2011 09:06 PM
How to format card for firmware update Corvairfan Pentax DSLR Discussion 7 11-06-2010 05:31 PM
Forgot to format new card - can I save my pictures? T K Hull Pentax DSLR Discussion 7 06-13-2010 09:00 PM
Rebuilding the 35 MM Format FA* line to the DA* APS-C Format Adrian Owerko Pentax SLR Lens Discussion 14 01-20-2010 11:04 AM



All times are GMT -7. The time now is 06:56 PM. | See also: NikonForums.com, CanonForums.com part of our network of photo forums!
  • Red (Default)
  • Green
  • Gray
  • Dark
  • Dark Yellow
  • Dark Blue
  • Old Red
  • Old Green
  • Old Gray
  • Dial-Up Style
Hello! It's great to see you back on the forum! Have you considered joining the community?
register
Creating a FREE ACCOUNT takes under a minute, removes ads, and lets you post! [Dismiss]
Top