Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

testing an USB-flash-stick 32 GB with the command "badblocks"

Need help with peripherals or devices?
Post Reply
Message
Author
Ihamed
Posts: 34
Joined: 2021-01-31 09:23

testing an USB-flash-stick 32 GB with the command "badblocks"

#1 Post by Ihamed »

Hello everyone,

I wanted to test if my approximately 30 GB USB flash drive is in good health.

I tested it with the following command:

Code: Select all

sudo badblocks -wsv /dev/sdd
The USB flash drive was unformatted. And it even had no partition table. It was just empty.

I had thought, that the test would take a long time, maybe 1 hour or 5 hours.
Now I aborted the test after 40 hours.

The output from the terminal just before the abort looked like this:
k20240326-144829.png
What does this mean now?
That so far 12,950,471 blocks have been read, 12,927,936 blocks have been written, and 0 errors have occurred during comparison?

At the beginning (after about 1:53 hours), it displayed the following:
k20240326-145026.png
k20240326-145026.png (5.98 KiB) Viewed 434 times
I assumed that the test would be finished when it reached 12,927,936.
By now, that number has been reached. But it's still testing. Is this as it should be?

I would appreciate a response. Thank you very much.

User avatar
fabien
Forum Helper
Forum Helper
Posts: 688
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 62 times
Been thanked: 161 times

Re: testing an USB-flash-stick 32 GB with the command "badblocks"

#2 Post by fabien »

Hello,
Ihamed wrote: 2024-03-26 14:53

Code: Select all

sudo badblocks -wsv /dev/sdd
You asked for -w option
man 8 badblocks wrote: -w Use write-mode test. With this option, badblocks scans for bad blocks by writing some patterns (0xaa, 0x55, 0xff, 0x00) on every block of the device, reading every block and comparing
the contents.
In your case this means 12927936 * 4 (0xaa, 0x55, 0xff, 0x00) * 2 (write, read)
Note: you asked almost the same question before, remember? :wink:

Ihamed
Posts: 34
Joined: 2021-01-31 09:23

Re: testing an USB-flash-stick 32 GB with the command "badblocks"

#3 Post by Ihamed »

fabien wrote: 2024-03-26 20:39 Note: you asked almost the same question before, remember? :wink:
Oh yes, now I remember. But there I tested a 2 TB HDD and now I wanted to test a 30 GB USB flash drive. But you are right: the command was the same.
fabien wrote: 2024-03-26 20:39 In your case this means 12927936 * 4 (0xaa, 0x55, 0xff, 0x00) * 2 (write, read)
Does this mean at the end (if I had not aborted the process) it would have showed me shortly before the end, this line:

Code: Select all

51'711'744% done, XXX:XX:XX elapsed.  (51'711'743/12'927'936/0 errors)
?

(4 * 12'927'936 = 51'711'743)

User avatar
fabien
Forum Helper
Forum Helper
Posts: 688
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 62 times
Been thanked: 161 times

Re: testing an USB-flash-stick 32 GB with the command "badblocks"

#4 Post by fabien »

Ihamed wrote: 2024-03-26 21:50 Oh yes, now I remember. But there I tested a 2 TB HDD and now I wanted to test a 30 GB USB flash drive.
Your USB drive is probably much slower than your HDD.
Note: I corrected the link in my previous post.
Ihamed wrote: 2024-03-26 21:50 Does this mean at the end (if I had not aborted the process) it would have showed me shortly before the end, this line:

Code: Select all

51'711'744% done, XXX:XX:XX elapsed.  (51'711'743/12'927'936/0 errors)
?

(4 * 12'927'936 = 51'711'743)
I'm not sure how it is presented now, the display in your previous topic is what I knew. But it is done as I said: 12927936 * 4 * 2

Ihamed
Posts: 34
Joined: 2021-01-31 09:23

Re: testing an USB-flash-stick 32 GB with the command "badblocks"

#5 Post by Ihamed »

Thank you.
fabien wrote: 2024-03-26 22:53 I'm not sure how it is presented now, the display in your previous topic is what I knew. But it is done as I said: 12927936 * 4 * 2
As you can see in the first printscreen it took about 40 h for the first "12927936". This means it would take 4*2* 40 h = 320 h = 13.3 days (?)
13.3 days for a 32 GB USB-Flash-Stick? Can this be true?

I guess, when I copy a file of 30 GB to this USB-Stick it may take max. 2h. So when I make this 8 times it will take 16h. (?) Very confusing? Why is this so different?

fabien wrote: 2024-03-26 22:53 Your USB drive is probably much slower than your HDD.
That's what you can obviously observe here. But I don't understand it. They always say that flash memory is faster than the old mechanical technology of HDDs. (?)

User avatar
sunrat
Administrator
Administrator
Posts: 6511
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 119 times
Been thanked: 489 times

Re: testing an USB-flash-stick 32 GB with the command "badblocks"

#6 Post by sunrat »

Ihamed wrote: 2024-03-27 09:18They always say that flash memory is faster than the old mechanical technology of HDDs. (?)
Who is "they"? I have had several flash keys which are positively glacial for write performance. Some are absolute rubbish. Very few are as fast as even a modest modern HDD. I have a couple of USB3.2 ones which may be close to my 4TB 5400rpm WD Blue disk.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

User avatar
fabien
Forum Helper
Forum Helper
Posts: 688
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 62 times
Been thanked: 161 times

Re: testing an USB-flash-stick 32 GB with the command "badblocks"

#7 Post by fabien »

Ihamed wrote: 2024-03-27 09:18
fabien wrote: 2024-03-26 22:53 Your USB drive is probably much slower than your HDD.
That's what you can obviously observe here. But I don't understand it. They always say that flash memory is faster than the old mechanical technology of HDDs. (?)
It is said of SSDs, certainly not flash drives.

USB flash drive File transfer speeds
USB flash drives usually specify their read and write speeds in megabytes per second (MB/s); read speed is usually faster. These speeds are for optimal conditions; real-world speeds are usually slower. In particular, circumstances that often lead to speeds much lower than advertised are transfer (particularly writing) of many small files rather than a few very large ones, and mixed reading and writing to the same device.

In a typical well-conducted review of a number of high-performance USB 3.0 drives, a drive that could read large files at 68 MB/s and write at 46 MB/s, could only manage 14 MB/s and 0.3 MB/s with many small files.
hdparm will give you an idea of the reading speed of your devices.

Code: Select all

#> hdparm -t /dev/sdX; sleep 1; hdparm --direct -t /dev/sdX
Replace X with the device you want to test. You can compare your HDD and your USB drive.

Ihamed
Posts: 34
Joined: 2021-01-31 09:23

Re: testing an USB-flash-stick 32 GB with the command "badblocks"

#8 Post by Ihamed »

Thank you again:

Code: Select all

$ sudo hdparm -t /dev/sdd; sleep 1; sudo hdparm --direct -t /dev/sdd

/dev/sdd:
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 14 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 Timing buffered disk reads: 112 MB in  3.04 seconds =  36.82 MB/sec

/dev/sdd:
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 14 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 Timing O_DIRECT disk reads: 118 MB in  3.00 seconds =  39.27 MB/sec
I don't risk doing the test with the HDD because it contains important data. (You never know what will happen.)

What does "SG_IO: bad/missing sense data" mean?
Is something wrong with my USB-Flash-Stick?

User avatar
fabien
Forum Helper
Forum Helper
Posts: 688
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 62 times
Been thanked: 161 times

Re: testing an USB-flash-stick 32 GB with the command "badblocks"

#9 Post by fabien »

Ihamed wrote: 2024-03-27 12:55 I don't risk doing the test with the HDD because it contains important data. (You never know what will happen.)
Nothing can happen since you have made a backup of your important data, right?
hdparm -t is harmless anyway.
Ihamed wrote: 2024-03-27 12:55 What does "SG_IO: bad/missing sense data" mean?
Is something wrong with my USB-Flash-Stick?
sg_decode_sense from the sg3-utils package makes sense of the message

Code: Select all

$> sg_decode_sense 70 00 05 00 00 00 00 14 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Fixed format, current; Sense key: Illegal Request
Additional sense: Invalid command operation code
A command has been issued which is not understood by the device, nothing serious.

User avatar
donald
Debian Developer, Site Admin
Debian Developer, Site Admin
Posts: 1106
Joined: 2021-03-30 20:08
Has thanked: 189 times
Been thanked: 248 times

Re: testing an USB-flash-stick 32 GB with the command "badblocks"

#10 Post by donald »

@Best_Threads
Typo perfectionish.


"The advice given above is all good, and just because a new message has appeared it does not mean that a problem has arisen, just that a new gremlin hiding in the hardware has been exposed." - FreewheelinFrank

Post Reply