2

I've got a USB stick (SanDisk Cruzer Facet 64G) which seems to be worn out. I had filled it to the brim with a lot of small-ish files (500kB each), which went well, no performance issues; and when I wanted to remove them, it took ages to remove even a single file. I suspected that the relatime mount option was a problem as every unlink might hit the block containing the used-blocks chain, resulting in dismal performance. I re-mounted with noatime, and this time the deletion of all files went very fast.

Out of curiosity, I copied some small files on it again, this time it has massive performance problems. Speed went down to few kB per second as soon as the FS cache was full. Same when mounted with sync.

I then re-created the filesystem on it (ext4), but the problem persisted.

I used badblocks -w, but this reported no bad blocks at the start of the stick (the first 2000 blocks or so). (Should I have it run through to the end?) I then re-created a partition on it (flagged lba, sector-aligned, partition start at 4096s), but the problem still persists.

Not sure what to make of this, except that this is a symptom of write amplification: Since the stick was full to the brim with small files, each new write now results in read-delete-modify-write.

I tried TRIM, but that only resulted in fstrim: SAN_M: FITRIM ioctl failed: Remote I/O error. It appears the USB controller doesn't support TRIM.

How can I get this USB stick (it still accepts files, albeit at a dismal performance) back to its old performance, without TRIM?

Thanks.

7
  • 2
    USB sticks commonly fail over time. Just replace it. I only use small USB sticks to prevent using them for any kind of permanent storage.
    – anon
    Commented Sep 6, 2021 at 12:17
  • Just as an intellectual exercise... yes, I think you should let badblocks go through the entire disk. Another thing; if you suspect a large number of small files caused the problem, how about trying to overwrite it with one huge 64GB file? I'm sure you're more proficient with Linux than me, but it sort of seems a logical thing to test :-) Myself, I'm with @John - I'd just replace it. Commented Sep 6, 2021 at 13:11
  • According to Internet, this is a USB 2.0 flash drive. Throw it away and get a new one. USB3 speed grade. Preferably not of Sandisk brand. Commented Sep 7, 2021 at 1:41
  • @Peregrino69 , I'll try that and post how it goes. Commented Sep 7, 2021 at 1:47
  • @Ale..chenski , my hardware is mostly USB 2.0, so I won't benefit from USB3. Also, why not SanDisk? This is the first time one of them fails on me in 10 years. Commented Sep 7, 2021 at 1:55

2 Answers 2

1

USB stick wear leveling isn't very good, and the durability of the memory isn't very good either. Every time you write to it, the drive is that much closer to the grave.

AFAIK, since you can't trim usb sticks, the only option under Linux is to zero the drive with dd dd if=/dev/zero of=/dev/sdc where sdc is the drive in question.

After that it should work better. but you're also wearing out the drive.

Low-level format can be done with Windows, and perhaps Wine under Linux.

Here's some Windows programs: https://m.majorgeeks.com/files/details/usb_low_level_format.html http://hddguru.com/content/en/software/2006.04.12-HDD-Low-Level-Format-Tool/

0

Turns out I can still write large files (>100MB) on the stick with no problems at a rate of ca. 10 MB/s (which is somewhat the IO rate I had before, hub doesn't allow for more apparently). Only lots of small files cause performance degradation as lined out in the question, even with relatime mount option.

2
  • 2
    Please provide additional details in your answer. As it's currently written, it's hard to understand your solution.
    – Community Bot
    Commented Sep 7, 2021 at 7:22
  • @Community I've added a few details, but this answer isn't so much a "I found the problem, here's how I solved it" but more a "The problem goes away if I do XYZ". Not sure what more details are required. Commented Sep 7, 2021 at 7:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .