View previous topic :: View next topic |
Author |
Message |
jesnow l33t
Joined: 26 Apr 2006 Posts: 882
|
Posted: Sat Sep 21, 2024 2:24 pm Post subject: Fake high-cap USB drive (corrupts data) detection? |
|
|
Probably everyone is aware that there are fake high-capacity usb thumb drives flooding the market. What these drives do is report every write and read as successful, but they overwrite previously stored data on their (much smaller than advertized) internal flash storage, corrupting it.
This is obviously a huge danger for anybody who uses thumb drives for anything. Imagine putting your bitcoin wallet on such a drive.
There are utilities out there to detect this behavior for windows, eg:
https://www.grc.com/validrive.htm
But nothing even remotely equivalent for linux that I can find. I can think of a variety of brute force ways of accomplishing this task, but they are going to take time for each thumb drive, are going to destroy the data on the drive, and I have a lot of thumb drives. Something that does what validrive does would be a real help.
It would work something like
Code: | $ capcheck
CAPCHECK v.0.1-mockup
1 USB storage device found /dev/sda. Continue? (y/n): y
Device is /dev/sda
USB address idVendor=067b, idProduct=8171
Manufacturer: ROKNYPR
exfat signature found on partition /dev/sda1
File system reports 1.07 TB capacity
Spot Check size is 64K random data
576 spot check regions written/read across 1.07TB
0 r/w errors reported
24 checksums correct
552 checksums failed
Drive fails validation.
Exiting with return code 0
$ |
It occurs to me that this kind of nondestructive read-write testing would be useful for all kinds of drives, and so might be useful to incorporate into fsck. That's above my pay grade.
I don't know how to program such a thing, and while I could learn, I bet there are people who know exactly what needs to be done, or that such a tool already exists somewhere. Note: Validrive itself is said not to work under Wine.
Cheers,
Jon. |
|
Back to top |
|
|
Banana Moderator
Joined: 21 May 2004 Posts: 1729 Location: Germany
|
|
Back to top |
|
|
Goverp Advocate
Joined: 07 Mar 2007 Posts: 2179
|
Posted: Sat Sep 21, 2024 7:20 pm Post subject: |
|
|
The base trouble here is that USB thumb drives are too dumb. If the data you want to put on one is valuable, perhaps better to use a USB SSD that supports SMART, and issue a long test. They're also a lot faster. _________________ Greybeard |
|
Back to top |
|
|
grknight Retired Dev
Joined: 20 Feb 2015 Posts: 1919
|
Posted: Sat Sep 21, 2024 9:18 pm Post subject: |
|
|
This looks interesting, so I made a quick ebuild. app-misc/capacitytester/capacitytester-0.7a.ebuld
Code: | # Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit desktop qmake-utils
DESCRIPTION="Tool to test USB flash drive capacity"
MY_PN="CapacityTester"
HOMEPAGE="https://github.com/c0xc/${MY_PN}"
SRC_URI="https://github.com/c0xc/${MY_PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${MY_PN}-${PV}"
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64"
IUSE=""
RDEPEND="
dev-qt/qtconcurrent:5
dev-qt/qtdbus:5
dev-qt/qtwidgets:5
virtual/udev
virtual/libusb:1
"
DEPEND="${RDEPEND}"
BDEPEND="virtual/pkgconfig"
src_configure() {
eqmake5
}
src_install() {
emake INSTALL_ROOT="${D}" install
einstalldocs
doicon res/capacity-tester.png
domenu res/capacity-tester.desktop
} |
|
|
Back to top |
|
|
|