On 29/12/21 20:26, Michael wrote:
On Tuesday, 28 December 2021 20:21:32 GMT Dale wrote:
Howdy,

As some may recall, I have quite a few deer trail cameras that use SD
memory cards.  On occasion some of the cards start acting weird.  I've
got one that is really weird.  Usually I just replace them but this one
is a bit of a puzzle I'd like to solve.  When it stopped working, it had
a dozen or so short videos on it that are about 30MBs on average.  Some
color and large, some black and white night vision and fairly small.
When it stopped working, I tried to reformat the thing.  The files
remained even after that.  I then ran dd and zeroed the thing, files
still there even tho dd reported no problems.  I then used this GUI disk
program that tests memory cards and it claims the card is fine.  It
writes files to it, reads them back.  I also used it to reformat the
card.  The original videos are still there.  Today I decided to play
with it again.  I ran this dd command on the stick.


root@fireball / # dd if=/dev/zero of=/dev/sdh bs=4K conv=notrunc
oflag=direct status=progress
31907364864 bytes (32 GB, 30 GiB) copied, 3956 s, 8.1 MB/s
dd: error writing '/dev/sdh': No space left on device
7791745+0 records in
7791744+0 records out
31914983424 bytes (32 GB, 30 GiB) copied, 3956.94 s, 8.1 MB/s
root@fireball / #


As you can see, no errors. It wrote zeros until it ran out of space.
Guess what, the original videos are still on the card.  File listing:


root@fireball / # ls -al /run/media/dale/2140-2E00/DCIM/100MEDIA/*
-rw-r--r-- 1 dale users        0 May  6  2018
/run/media/dale/2140-2E00/DCIM/100MEDIA/AAAAAAAA.AAA
-rw-r--r-- 1 dale users        0 May  6  2018
/run/media/dale/2140-2E00/DCIM/100MEDIA/BBBBBBBB.BBB
-rw-r--r-- 1 dale users 14335272 May  2  2018
/run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0823.AVI
-rw-r--r-- 1 dale users 50843576 May  6  2018
/run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0824.AVI
-rw-r--r-- 1 dale users 53137560 May  6  2018
/run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0825.AVI
-rw-r--r-- 1 dale users 18398504 May  6  2018
/run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0826.AVI
-rw-r--r-- 1 dale users 18922808 May  6  2018
/run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0827.AVI
-rw-r--r-- 1 dale users 18332888 May  6  2018
/run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0828.AVI
-rw-r--r-- 1 dale users 18726200 May  6  2018
/run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0829.AVI
-rw-r--r-- 1 dale users 18332920 May  6  2018
/run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0830.AVI
-rw-r--r-- 1 dale users 18005288 May  6  2018
/run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0831.AVI
-rw-r--r-- 1 dale users 17612088 May  6  2018
/run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0832.AVI
-rw-r--r-- 1 dale users 17153336 May  6  2018
/run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0833.AVI
-rw-r--r-- 1 dale users 16694584 May  6  2018
/run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0834.AVI
-rw-r--r-- 1 dale users        0 May  6  2018
/run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0835.AVI
root@fireball / #



The zero byte files are broken, my first clue way back that the card
needed replacing.  I see no errors in dmesg or messages.  Usually the
cards produce errors and it remounts read only.  Not in this case tho.
Mount info:


root@fireball / # mount | grep sdh
/dev/sdh1 on /run/media/dale/2140-2E00 type vfat
(rw,nosuid,nodev,relatime,uid=1000,gid=100,fmask=0022,dmask=0022,codepage=43
7,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,
uhelper=udisks2) root@fireball / #



In the past, I've at times been able to copy the files off other cards
going bad but it stays read only.  Reformating fails etc etc.
Sometimes, it just plain doesn't work.  Almost always tho I get a error
of some kind in messages or dmesg if not both.  This one tho, it's just
plain weird.  No errors but nothing removes the files either.  Oh, I've
checked the lock button.  It's not locked.  It is shown that way in
dmesg as well.


[2592841.808336] sd 10:0:0:2: [sdh] Write Protect is off



Obviously I'm not going to trust this thing.  It will end up in the
trash but, does this make sense to anyone else?  Of all the ones I've
worn out, this is the only one that behaves this way.  I'd at least
expect the format to fail or it only mount read only.  At least some
sort of error anyway.

Thoughts?

Dale

:-)  :-)
I don't think I've come across something like this before.  In my case data is
lost, occasionally irretrievably.

I suppose something has switched blocks on the SD as immutable, probably a
controller having a hiccup.

You could try blkdiscard to erase blocks directly - but I haven't tried this
on an SD.  I also haven't tried to know if it will work at all hdparm's secure
deletion.

However, the best option is to see if the OEM offers a reset app for this
particular card and use that.

I have a few SD cards as OS disks on raspberry pi, odroids etc. One has your symptoms like yours - read only when it says its in write mode.  Took two days after the last write to syslog to drop dead - just before Christmas too, luckily it was part of a moosefs cluster so I could leave it in maintenance mode without affecting service - replaced today.  No salvaging it unfortunately - also not the first one that I have had die like this.  I tested some others and have one thats really slow when dd'ing zeros to clear vacant space (I think that's redundant for SD cards, better to trim it?) before making a compressable backup image.  It also drops to RO with no errors in syslog before completing.  So I am down 2 cards and need to order some more spares before another fails :(

BillK



Reply via email to