Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Bizzare filesystem bug
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Carnildo
Guru
Guru


Joined: 17 Jun 2004
Posts: 595

PostPosted: Sun Oct 23, 2011 7:30 pm    Post subject: Bizzare filesystem bug Reply with quote

I've got a 4GB CompactFlash card I'm trying to set up as the boot disk for one of my computers. I've got it partitioned and formatted as ext2, and I'm copying the filesystem over one top-level directory at a time using "cp -x -a". However, some of the files aren't being copied correctly.

For example, after copying, the new /bin/tempfile contains the contents of "/usr/portage/x11-plugins/wmjsql/wmjsql-0.5.ebuild", enough nulls to pad to the 4096-byte mark, the contents of "/usr/portage/x11-plugins/wmjsql/ChangeLog", enough nulls to pad it out to the 8192-byte mark, the contents of "/usr/portage/x11-plugins/wmjsql/Manifest", and enough nulls to pad it out to the original file's size. The new /bin/cpio starts with what looks like the directory entry for "/usr/portage/x11-plugins/wmifs/wmifs-1.3_beta1-r2.ebuild", followed by various files from that general area of the Portage tree.

When I was partitioning the disk, I had to use fdisk, as cfdisk quit with the message "FATAL ERROR: Bad primary partition 0: Partition ends in the final partial cylinder". The card is slightly smaller than another 4GB card that I'm successfully using as a hard disk, at 3997163520 bytes versus 4034838528 bytes. It also has a very different logical geometry: 245 heads, 63 sectors/track, 505 cylinders versus the working card's 128 heads, 63 sectors/track, 977 cylinders.

Any ideas?
Back to top
View user's profile Send private message
hoacker
Guru
Guru


Joined: 04 Aug 2007
Posts: 507
Location: Bürstadt, Germany

PostPosted: Sun Oct 23, 2011 9:01 pm    Post subject: Reply with quote

I'd think of three possibilities:
1) The original files are already broken
2) "cp" is doing something really weird
3) The CF card is broken

I'd say that 3) is the most likely. Do you have a spare CF card to test?
Back to top
View user's profile Send private message
Carnildo
Guru
Guru


Joined: 17 Jun 2004
Posts: 595

PostPosted: Sun Oct 23, 2011 10:39 pm    Post subject: Reply with quote

1) isn't the case: the source files I've checked look fine, and if some of the corrupted files (eg. libc.so) were corrupted at the source, the system would be totally non-functional. I think I can rule out 2), first because only a few files are corrupted, and second because copying the files that were corrupted one at a time works fine.

There are two other options I can think of.
4) The computer's disk controller isn't correctly handing a CompactFlash card connected to a PATA socket (this shouldn't be an issue, though, since the only difference between CF and PATA is the size of the socket)
5) Something's wrong with the partition information or logical geometry that's causing data to not be read/written correctly.
Back to top
View user's profile Send private message
s_bernstein
Apprentice
Apprentice


Joined: 11 Mar 2006
Posts: 172
Location: Bremen, Germany

PostPosted: Mon Oct 24, 2011 6:10 am    Post subject: Reply with quote

I would try another CF. I had some weird problems with partially broken CFs in the past, like important files magically vanishing from the file system. I didn't realized early enogh, that it was the card that was broken, so a few month later the card suddenly stopped working.
Back to top
View user's profile Send private message
MacGyver031
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jul 2004
Posts: 141
Location: Ilavalai, Sri Lanka

PostPosted: Mon Oct 24, 2011 6:39 am    Post subject: Reply with quote

Could you do a badblocks scanning to verify that the CF is fully functional?
Code:
badblocks -w /dev/sd...

Be aware that the CF is not mounted and you might have to format CF after check.

As flash-memory has limited write cycles, an used CF might have some sectors which have their write cycles used up. This causes corrupted files. The other method to verify the copied information by using rsync instead of cp.
_________________
Sincerely your
Joanand K.

MacBook Pro 5.1: 2.4GHz Core2 Duo, 4096MB, 500GB, NVidia 9400/9600 M GT
Gentoo, Kernel 3.4.9, XOrg, Fluxbox.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Mon Oct 24, 2011 1:25 pm    Post subject: Reply with quote

Make sure you don't have a cheap ripoff card that reports a fake size but implements it as a circular buffer over tiny storage. They exist.
Back to top
View user's profile Send private message
Carnildo
Guru
Guru


Joined: 17 Jun 2004
Posts: 595

PostPosted: Tue Oct 25, 2011 3:57 am    Post subject: Reply with quote

hoacker wrote:

3) The CF card is broken

I'd say that 3) is the most likely. Do you have a spare CF card to test?


Carnildo wrote:
4) The computer's disk controller isn't correctly handing a CompactFlash card connected to a PATA socket (this shouldn't be an issue, though, since the only difference between CF and PATA is the size of the socket)


MacGyver031 wrote:
Could you do a badblocks scanning to verify that the CF is fully functional?
Code:
badblocks -w /dev/sd...

Be aware that the CF is not mounted and you might have to format CF after check.

As flash-memory has limited write cycles, an used CF might have some sectors which have their write cycles used up. This causes corrupted files. The other method to verify the copied information by using rsync instead of cp.


Ant P. wrote:
Make sure you don't have a cheap ripoff card that reports a fake size but implements it as a circular buffer over tiny storage. They exist.


The card is a Kingston card (not a commonly-forged brand) from Newegg (not a seller known for distributing fake cards). It's a fairly recent purchase, very lightly used (so, it shouldn't be having wear problems).

Running badblocks doesn't show any errors.

I plugged the card into a CF reader attached to a different computer, re-formatted using mke2fs, stuffed it full of data (copied files on to it until "cp" returned a disk-full error), and then compared the files. Every file was copied correctly.

I'm starting to suspect the computer has an intermittent fault with the hard-drive controller: after powering it down to remove the CF card, the first four bootup tries failed with either spontaneous reboots or CRC errors decompressing the kernel. If so, it's not surprising I haven't noticed this before: the computer normally acts as my router, and I've got it set up so it can go months or years between hard drive accesses.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum