Opened 10 years ago

Closed 10 years ago

#12110 closed bug (invalid)

Editing file on FAT32 causes data corruption

Reported by: haiqu Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: File Systems/FAT Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

Opened the Raspbian Wheezy image and edited 'cmdline.txt' per instructions at:

https://www.urspringer.de/2015/02/20/headless-setup-raspberry-pi-2-model-b/

The file became corrupted, and all data in the line before the edit was missing.

Attachments (1)

cmdline.txt (120 bytes ) - added by haiqu 10 years ago.
Config file from Raspbian

Download all attachments as: .zip

Change History (12)

comment:1 by pulkomandy, 10 years ago

We will need a bit more details:

  • Which filesystem is used on the raspbian image? (ext4? fat32?)
  • Please attach the corrupted file (and if possible the file before corruption)
  • Ideally, please attach an image of the corrupted partition (you can extract this with dd for example)
  • Does running fsck on the corrupted partition notice any problems with it?

comment:2 by haiqu, 10 years ago

DriveSetup identifies it as Ext2 file system.

Best way to get file before/after corruption would be to d/l image and write to that file. The act of extracting and posting it may cause further issues. The image itself is 3.05GB so I can't post that obviously.

Haiku doesn't have fsck by default.

comment:3 by haiqu, 10 years ago

Correction: The boot partition is actually FAT32 and that's where the file lives. Copy of unmolested file attached below.

by haiqu, 10 years ago

Attachment: cmdline.txt added

Config file from Raspbian

comment:4 by diver, 10 years ago

Component: File SystemsFile Systems/FAT
Summary: Editing file on Linux file system causes data corruptionEditing file on FAT32 causes data corruption

comment:5 by haiqu, 10 years ago

Workaround available. I modified the file under WinXP and from there it's obvious that the character at EOL - which shows as a rectangle, so is unprintable - shouldn't be tampered with.

I can now boot the image and ping the Pi via a direct network connection from Haiku.

comment:6 by pulkomandy, 10 years ago

I meant to run fsck from Linux, to see if it notices something wrong with the FS layout. If it doesn't, it would mean only the file data was corrupted.

Since the FAT32 partition is small, and mostly empty, it should be possible to do a dump of just that and upload it here for reference.

in reply to:  5 comment:7 by mmlr, 10 years ago

Replying to haiqu:

Workaround available. I modified the file under WinXP and from there it's obvious that the character at EOL - which shows as a rectangle, so is unprintable - shouldn't be tampered with.

That EOL looks like a normal new line character. Windows programs just usually don't handle new lines alone (i.e. without their expected carriage return) and show them as unprintable. I don't think the corruption was related to that character.

Did you do anything other than editing the file with that partition mounted? Especially anything relating to deleting directories? Did you unmount the partition properly and did you notice the corruption while the volume was still mounted or only after re-mounting it?

I have two patches pending that deal with incomplete reads and deleted directory entries corrupting file data in fat. Having the corrupted file to check for plausibility of them being related would be helpful.

comment:8 by haiqu, 10 years ago

pulkomandy: I don't normally run Linux, so can't run fsck here.

mmlr: Followed the instructions to the letter actually. Made the minimum edit, saved and then unmounted the microsd properly before fitting it to the Pi.

I have noticed corruption on re-opening the file, even before unmounting it.

FWIW I'll try to send you the corrupted file, but as I say it may be inconclusive.

comment:9 by haiqu, 10 years ago

Grrr. Can't reproduce the problem now. Whatever was happening has now stopped. :-/

comment:10 by haiqu, 10 years ago

Pretty convinced now that this was a hardware error. The microSD failed shortly after this, and I've also noticed data corruption related to lack of current from the USB port. The RasPi2 REQUIRES an external power supply, 5V@0.5A isn't sufficient for reliable operation.

Please close as invalid.

comment:11 by diver, 10 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.