Messages in this thread | ![/](/images/icornerl.gif) | | From | Paul <> | Subject | Re: Fwd: File system corruption | Date | Wed, 8 Jan 2003 21:35:32 +1000 |
| |
Roger,
Thanks for the programme Roger!
I'm not sure if I did this right but.....
I ran the programme as follows: (I called it sandisktest :)
# ./sandisktest -b | dd of=/dev/hdc
then I dd'd the image of the flash disk to my local disk and viewed the file through midnight commander.
What I have found is that just after the start of a sector, usually 43 to 45 bytes, 6 bytes are skipped and the sequence starts again. This continues until the next sector starts, where the sequence corrects. This appears to happen every 65536 bytes or some multiple of 65536. It may skip three blocks of 65536 and then corrupt on the next block of 65536 bytes.
I would greatly appreciate some other ideas to try, I'm not game to start hacking the kernel code quite yet :)
Paul.
BTW: I also tried a EXT2 FS and it corrupted files just as the FAT16 filesystem had.
On Tue, 7 Jan 2003 10:08 pm, Rogier Wolff wrote: > On Mon, Jan 06, 2003 at 03:06:20PM +0000, Alan Cox wrote: > > Might be interesting to see what it does given a totally not FAT > > environment (eg fill the disk start to end with each sector filled > > with its sector number repeatedly) and see what comes out the other > > end. > > How about the following program to do this. > > Roger. > > > /* Written By R.E.Wolff@BitWizard.nl > * > * This program is distributed under GPL. */ > > #include <stdio.h> > #include <stdlib.h> > #include <unistd.h> > #include <string.h> > > int main (int argc, char **argv) > { > int i; > int ascii = 0; > int size = 512; > long long secno; > char *buf; > int s; > > for (i=1;i<argc;i++) { > if (strcmp (argv[i], "-a") == 0) { > ascii = 1; > } > if (strcmp (argv[i], "-b") == 0) { > ascii = 0; > } > > if (strncmp (argv[i], "-s", 2) == 0) { > if (strlen (argv[i]) > 2) > size = atoi (argv[i]+2); > else > /* Sorry. Will crash if you specify -s as the last argument */ > size = atoi (argv[++i]); > } > } > > buf = malloc (size + 16); > > if (!buf) { > fprintf (stderr, "Can't allocate buffer.\n"); > exit (1); > } > > secno = 0; > while (1) { > if (ascii) { > sprintf (buf, "%lld\n", secno); > s = strlen (buf); > for (i=s;i<size;i+=s) > sprintf (buf+i, "%lld\n", secno); > } else { > for (i=0;i<size;i+=sizeof (long long)) > *(long long *)(buf+i) = secno; > } > if (write (1, buf, size) < 0) > break; > secno++; > } > exit (0); > } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| ![\](/images/icornerr.gif) |