Gentoo Archives: gentoo-user

From: Dale <rdalek1967@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] SD memory card not erasing, even with dd.
Date: Tue, 28 Dec 2021 20:21:50
Message-Id: d8203e8f-fbfe-96e9-a552-0b94fad9dd00@gmail.com
1 Howdy,
2
3 As some may recall, I have quite a few deer trail cameras that use SD
4 memory cards.  On occasion some of the cards start acting weird.  I've
5 got one that is really weird.  Usually I just replace them but this one
6 is a bit of a puzzle I'd like to solve.  When it stopped working, it had
7 a dozen or so short videos on it that are about 30MBs on average.  Some
8 color and large, some black and white night vision and fairly small. 
9 When it stopped working, I tried to reformat the thing.  The files
10 remained even after that.  I then ran dd and zeroed the thing, files
11 still there even tho dd reported no problems.  I then used this GUI disk
12 program that tests memory cards and it claims the card is fine.  It
13 writes files to it, reads them back.  I also used it to reformat the
14 card.  The original videos are still there.  Today I decided to play
15 with it again.  I ran this dd command on the stick. 
16
17
18 root@fireball / # dd if=/dev/zero of=/dev/sdh bs=4K conv=notrunc
19 oflag=direct status=progress
20 31907364864 bytes (32 GB, 30 GiB) copied, 3956 s, 8.1 MB/s
21 dd: error writing '/dev/sdh': No space left on device
22 7791745+0 records in
23 7791744+0 records out
24 31914983424 bytes (32 GB, 30 GiB) copied, 3956.94 s, 8.1 MB/s
25 root@fireball / #
26
27
28 As you can see, no errors. It wrote zeros until it ran out of space. 
29 Guess what, the original videos are still on the card.  File listing:
30
31
32 root@fireball / # ls -al /run/media/dale/2140-2E00/DCIM/100MEDIA/*
33 -rw-r--r-- 1 dale users        0 May  6  2018
34 /run/media/dale/2140-2E00/DCIM/100MEDIA/AAAAAAAA.AAA
35 -rw-r--r-- 1 dale users        0 May  6  2018
36 /run/media/dale/2140-2E00/DCIM/100MEDIA/BBBBBBBB.BBB
37 -rw-r--r-- 1 dale users 14335272 May  2  2018
38 /run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0823.AVI
39 -rw-r--r-- 1 dale users 50843576 May  6  2018
40 /run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0824.AVI
41 -rw-r--r-- 1 dale users 53137560 May  6  2018
42 /run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0825.AVI
43 -rw-r--r-- 1 dale users 18398504 May  6  2018
44 /run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0826.AVI
45 -rw-r--r-- 1 dale users 18922808 May  6  2018
46 /run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0827.AVI
47 -rw-r--r-- 1 dale users 18332888 May  6  2018
48 /run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0828.AVI
49 -rw-r--r-- 1 dale users 18726200 May  6  2018
50 /run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0829.AVI
51 -rw-r--r-- 1 dale users 18332920 May  6  2018
52 /run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0830.AVI
53 -rw-r--r-- 1 dale users 18005288 May  6  2018
54 /run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0831.AVI
55 -rw-r--r-- 1 dale users 17612088 May  6  2018
56 /run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0832.AVI
57 -rw-r--r-- 1 dale users 17153336 May  6  2018
58 /run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0833.AVI
59 -rw-r--r-- 1 dale users 16694584 May  6  2018
60 /run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0834.AVI
61 -rw-r--r-- 1 dale users        0 May  6  2018
62 /run/media/dale/2140-2E00/DCIM/100MEDIA/WGI_0835.AVI
63 root@fireball / #
64
65
66
67 The zero byte files are broken, my first clue way back that the card
68 needed replacing.  I see no errors in dmesg or messages.  Usually the
69 cards produce errors and it remounts read only.  Not in this case tho. 
70 Mount info:
71
72
73 root@fireball / # mount | grep sdh
74 /dev/sdh1 on /run/media/dale/2140-2E00 type vfat
75 (rw,nosuid,nodev,relatime,uid=1000,gid=100,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
76 root@fireball / #
77
78
79
80 In the past, I've at times been able to copy the files off other cards
81 going bad but it stays read only.  Reformating fails etc etc. 
82 Sometimes, it just plain doesn't work.  Almost always tho I get a error
83 of some kind in messages or dmesg if not both.  This one tho, it's just
84 plain weird.  No errors but nothing removes the files either.  Oh, I've
85 checked the lock button.  It's not locked.  It is shown that way in
86 dmesg as well. 
87
88
89 [2592841.808336] sd 10:0:0:2: [sdh] Write Protect is off
90
91
92
93 Obviously I'm not going to trust this thing.  It will end up in the
94 trash but, does this make sense to anyone else?  Of all the ones I've
95 worn out, this is the only one that behaves this way.  I'd at least
96 expect the format to fail or it only mount read only.  At least some
97 sort of error anyway. 
98
99 Thoughts?
100
101 Dale
102
103 :-)  :-) 

Replies

Subject Author
Re: [gentoo-user] SD memory card not erasing, even with dd. Michael <confabulate@××××××××.com>