<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: I want to corrupt my memory!</title>
	<link>http://ask.metafilter.com/92393/I-want-to-corrupt-my-memory/</link>
	<description>Comments on Ask MetaFilter post I want to corrupt my memory!</description>
	<pubDate>Mon, 26 May 2008 07:33:17 -0800</pubDate>
	<lastBuildDate>Mon, 26 May 2008 07:33:17 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: I want to corrupt my memory!</title>
		<link>http://ask.metafilter.com/92393/I-want-to-corrupt-my-memory</link>	
		<description>How can I corrupt memory?  I have a plain SD card, and I&apos;d like to be able to reliably make the memory corrupt.  Can this be done? &lt;br /&gt;&lt;br /&gt; Basically, I want to get that error that everyone dreads when it shows up on the digital camera.  That the card is corrupted and needs to be formatted.  &lt;br&gt;
&lt;br&gt;
I&apos;ve found many resources on how to recover from corrupt memory, but none that give any idea how to cause it consistently.  The only information I&apos;ve found are the things that might cause it - running on low batteries, unplugging during file copies and the like.&lt;br&gt;
&lt;br&gt;
I&apos;ve spent some time with a hex editor, attacking the headers and such of the memory stick, but none of these have caused corruption.&lt;br&gt;
&lt;br&gt;
Any ideas?</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2008:site.92393</guid>
		<pubDate>Mon, 26 May 2008 07:03:12 -0800</pubDate>
		<dc:creator>ChrisManley</dc:creator>
		
			<category>memory</category>
		
			<category>flash</category>
		
			<category>camera</category>
		
			<category>corrupt</category>
		
	</item> <item>
		<title>By: jenkinsEar</title>
		<link>http://ask.metafilter.com/92393/I-want-to-corrupt-my-memory#1352723</link>	
		<description>if the card is garbage, try microwaving it for a few seconds... the ESD should cause all sorts of entertainment.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92393-1352723</guid>
		<pubDate>Mon, 26 May 2008 07:33:17 -0800</pubDate>
		<dc:creator>jenkinsEar</dc:creator>
	</item><item>
		<title>By: qxntpqbbbqxl</title>
		<link>http://ask.metafilter.com/92393/I-want-to-corrupt-my-memory#1352725</link>	
		<description>I think most of these cards use a FAT32 filesystem.  IIRC, FAT keeps track of which blocks belong to a file in two ways --- with a linked list (each block points to the next), and in the file allocation table (FAT), which is an index to the whole disk that is stored in memory.  Have you tried overwriting the FAT with junk?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92393-1352725</guid>
		<pubDate>Mon, 26 May 2008 07:38:44 -0800</pubDate>
		<dc:creator>qxntpqbbbqxl</dc:creator>
	</item><item>
		<title>By: ChrisManley</title>
		<link>http://ask.metafilter.com/92393/I-want-to-corrupt-my-memory#1352729</link>	
		<description>@qxntpqbbbqxl - I haven&apos;t, no.  How would you go about that?  &lt;br&gt;
&lt;br&gt;
@jenkinsEar - I expect that would work, but I want to be able to recover from the corruption after the fact.  So I don&apos;t want to break the card.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92393-1352729</guid>
		<pubDate>Mon, 26 May 2008 07:42:55 -0800</pubDate>
		<dc:creator>ChrisManley</dc:creator>
	</item><item>
		<title>By: procrastination</title>
		<link>http://ask.metafilter.com/92393/I-want-to-corrupt-my-memory#1352732</link>	
		<description>I would try zeroing out the first 512 bytes. I don&apos;t know how memory sticks are laid out, but most drives have a partition map in the first sector, and removing that may cause the effect you are looking for. Interesting question, though. What size is the card?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92393-1352732</guid>
		<pubDate>Mon, 26 May 2008 07:45:48 -0800</pubDate>
		<dc:creator>procrastination</dc:creator>
	</item><item>
		<title>By: ChrisManley</title>
		<link>http://ask.metafilter.com/92393/I-want-to-corrupt-my-memory#1352736</link>	
		<description>@procrastination - I&apos;m working with a 1gb card at the moment.&lt;br&gt;
&lt;br&gt;
I did open it with a hex editor and destroyed the first couple sectors, which looked like header information to me. &lt;br&gt;
&lt;br&gt;
I thought that would do the trick - but both the device and the computer seemed to have no trouble reading from the memory after the headers were whacked.   (In fact, the device actually re-wrote the headers on the fly somewhere along the line.)</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92393-1352736</guid>
		<pubDate>Mon, 26 May 2008 07:49:48 -0800</pubDate>
		<dc:creator>ChrisManley</dc:creator>
	</item><item>
		<title>By: kalessin</title>
		<link>http://ask.metafilter.com/92393/I-want-to-corrupt-my-memory#1352737</link>	
		<description>May I ask why you wish to corrupt it rather than, say, wipe it?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92393-1352737</guid>
		<pubDate>Mon, 26 May 2008 07:55:04 -0800</pubDate>
		<dc:creator>kalessin</dc:creator>
	</item><item>
		<title>By: procrastination</title>
		<link>http://ask.metafilter.com/92393/I-want-to-corrupt-my-memory#1352739</link>	
		<description>Huh. I would suspect then that there is a backup boot record somewhere else on the card. Checking the FAT boot sector specs, it seems that the two bytes at hex offset 32 (or decimal offset 50) contain the sector number of the backup boot record. So, here is what I would try next: go to offset 50 from the start of the disk, and get the two bytes that are there. Convert those to from hex to decimal. Multiply that by 512, and then go to that byte offset on the card. See if the format matches that of the first sector. If so, zero 512 bytes there, then zero the first 512 bytes. That should get both the main and backup boot record.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92393-1352739</guid>
		<pubDate>Mon, 26 May 2008 07:59:15 -0800</pubDate>
		<dc:creator>procrastination</dc:creator>
	</item><item>
		<title>By: Mach5</title>
		<link>http://ask.metafilter.com/92393/I-want-to-corrupt-my-memory#1352741</link>	
		<description>Have a look at &lt;a href=&quot;http://en.wikipedia.org/wiki/Secure_Digital_card#External_links&quot;&gt;these links&lt;/a&gt; and see if you can divine any information from the SD specs.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92393-1352741</guid>
		<pubDate>Mon, 26 May 2008 07:59:46 -0800</pubDate>
		<dc:creator>Mach5</dc:creator>
	</item><item>
		<title>By: ChrisManley</title>
		<link>http://ask.metafilter.com/92393/I-want-to-corrupt-my-memory#1352742</link>	
		<description>Update:&lt;br&gt;
&lt;br&gt;
I tried a different card (a 2gb one) and zeroing the first sector seems to have put it into a corrupt state.&lt;br&gt;
&lt;br&gt;
I&apos;m still not sure why my other card was recovering so well when I did this.  &lt;br&gt;
&lt;br&gt;
@kalessin - I&apos;m working on writing code to interact with a device and need to make sure it deals properly when it encounters a corrupted memory card.  So, I&apos;m trying to find a reliable way to corrupt a card for testing purposes.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92393-1352742</guid>
		<pubDate>Mon, 26 May 2008 08:01:25 -0800</pubDate>
		<dc:creator>ChrisManley</dc:creator>
	</item><item>
		<title>By: rdr</title>
		<link>http://ask.metafilter.com/92393/I-want-to-corrupt-my-memory#1352756</link>	
		<description>&lt;i&gt;I&apos;m working on writing code to interact with a device and need to make sure it deals properly when it encounters a corrupted memory card. So, I&apos;m trying to find a reliable way to corrupt a card for testing purposes.&lt;/i&gt;&lt;br&gt;
&lt;br&gt;
You don&apos;t know what corrupt SD cards look like in the wild. Without that information anything you build will just deal with the cases that you generate. &lt;br&gt;
&lt;br&gt;
&lt;i&gt;The only information I&apos;ve found are the things that might cause it - running on low batteries, unplugging during file copies and the like.&lt;/i&gt;&lt;br&gt;
&lt;br&gt;
You should reproduce the situations that are likely to cause corruption, see what data get trashed, and then build your test cases based on that information.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92393-1352756</guid>
		<pubDate>Mon, 26 May 2008 08:19:30 -0800</pubDate>
		<dc:creator>rdr</dc:creator>
	</item><item>
		<title>By: ChrisManley</title>
		<link>http://ask.metafilter.com/92393/I-want-to-corrupt-my-memory#1352766</link>	
		<description>@rdr - &lt;br&gt;
&lt;br&gt;
I agree it&apos;s not ideal.  However, having at least a basic scenario that is easily re-producible is a good start.&lt;br&gt;
&lt;br&gt;
Currently, any type of corruption causes various crashes in the code.  Being able to debug this is going to be a big help.&lt;br&gt;
&lt;br&gt;
However, going forward, we&apos;re going to have to look at specific cases of corruption - and see what we can do as far as data recovery and the like go.  &lt;br&gt;
&lt;br&gt;
As a first step, I&apos;d like to see the application display reasonable error messages when it encounters a corrupt SD card.&lt;br&gt;
&lt;br&gt;
Thus far, working with the hex editor and killing the headers as suggested by procrastination is working well.  Just need to make sure any back-up headers get destroyed as well.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92393-1352766</guid>
		<pubDate>Mon, 26 May 2008 08:38:24 -0800</pubDate>
		<dc:creator>ChrisManley</dc:creator>
	</item><item>
		<title>By: rdr</title>
		<link>http://ask.metafilter.com/92393/I-want-to-corrupt-my-memory#1352782</link>	
		<description>I don&apos;t mean to drag this out but I don&apos;t understand part of your problem.&lt;br&gt;
&lt;br&gt;
Filesystems are supposed to present  a consistent data store to a programmer. The logic for handling filesystems is part of whatever os you&apos;re using. Putting file system consistency checks, or even worse implementing some type of data recovery, in your application code seems odd. If you do this, then your code is going to keep growing until you basically duplicated the operating system logic for filesystem handling and recovery.&lt;br&gt;
&lt;br&gt;
Have you considered doing a consistency check before you access data, perhaps by using a cut down version of fsck.msdos? You wouldn&apos;t have to check the entire filesystem. You&apos;d just need to be sure that you could get to the data that you&apos;re going to be requesting.  Once you&apos;ve done a consistency check you&apos;d know that any crashes you&apos;re seeing are not caused by corruption.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92393-1352782</guid>
		<pubDate>Mon, 26 May 2008 09:03:59 -0800</pubDate>
		<dc:creator>rdr</dc:creator>
	</item><item>
		<title>By: Oktober</title>
		<link>http://ask.metafilter.com/92393/I-want-to-corrupt-my-memory#1352833</link>	
		<description>back in highschool, we used to corrupt floppy disks by starting a format and then unplugging the machine. maybe something similar would work for you here?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92393-1352833</guid>
		<pubDate>Mon, 26 May 2008 10:39:53 -0800</pubDate>
		<dc:creator>Oktober</dc:creator>
	</item><item>
		<title>By: puddpunk</title>
		<link>http://ask.metafilter.com/92393/I-want-to-corrupt-my-memory#1352957</link>	
		<description>Find a Linux/Unix/Mac box and:&lt;br&gt;
&lt;br&gt;
dd if=/dev/random of=/dev/yourdevice bs=128k&lt;br&gt;
&lt;br&gt;
Where yourdevice is the device name of the SD card (try running the mount command to find it)</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92393-1352957</guid>
		<pubDate>Mon, 26 May 2008 13:58:59 -0800</pubDate>
		<dc:creator>puddpunk</dc:creator>
	</item><item>
		<title>By: Lynsey</title>
		<link>http://ask.metafilter.com/92393/I-want-to-corrupt-my-memory#1353083</link>	
		<description>I corrupted a 1GB SD card by deleting all the files on it in my Windows computer, rather than formatting it in my camera, as I usually do. May work for you....</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92393-1353083</guid>
		<pubDate>Mon, 26 May 2008 15:23:22 -0800</pubDate>
		<dc:creator>Lynsey</dc:creator>
	</item><item>
		<title>By: AmbroseChapel</title>
		<link>http://ask.metafilter.com/92393/I-want-to-corrupt-my-memory#1353179</link>	
		<description>Copy a big file to the card then physically remove it while the write is still happening?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92393-1353179</guid>
		<pubDate>Mon, 26 May 2008 16:29:07 -0800</pubDate>
		<dc:creator>AmbroseChapel</dc:creator>
	</item><item>
		<title>By: Skorgu</title>
		<link>http://ask.metafilter.com/92393/I-want-to-corrupt-my-memory#1353263</link>	
		<description>puddpunk: You mean &lt;pre&gt;dd if=&lt;a href=&apos;http://en.wikipedia.org/wiki/Urandom&apos;&gt;/dev/urandom&lt;/a&gt; of=/dev/yourdevice bs=128k&lt;/pre&gt;&lt;br&gt;
&lt;br&gt;
And yes, this will give you a nicely corrupt card.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92393-1353263</guid>
		<pubDate>Mon, 26 May 2008 17:45:08 -0800</pubDate>
		<dc:creator>Skorgu</dc:creator>
	</item><item>
		<title>By: Caviar</title>
		<link>http://ask.metafilter.com/92393/I-want-to-corrupt-my-memory#1353979</link>	
		<description>I have to think that &lt;pre&gt;shred -n 3 /dev/yourdevice&lt;/pre&gt; will also work.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.92393-1353979</guid>
		<pubDate>Tue, 27 May 2008 10:23:13 -0800</pubDate>
		<dc:creator>Caviar</dc:creator>
	</item>
	</channel>
</rss>
