Gentoo Archives: gentoo-user

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

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] SD memory card not erasing, even with dd. William Kenworthy <billk@×××××××××.au>