how i fixed slow read speeds on my netac portable ssd

i bought a netac portable ssd (1tb) to use for backups. i use this drive with my linux computer and my samsung android phone, so i formatted it as exfat using the phone.

at first, the drive was very fast. i could copy large files quickly on both devices.

but recently, the speed on linux became very slow. a 300gb backup file that i created months ago now took 3 days to read. the speed was not just slow; it was unstable. the read speed would start normally, then drop to 0 mb/s for several seconds, then start again, and then stop again. it kept freezing and restarting.

i thought the drive was broken, but the problem was actually how the software handles "garbage collection" on the drive. here is how i found the problem and fixed it.

the symptoms

the drive (vendor id 0dd8, product id 2320) connected correctly, but reading files was very difficult.

  • before: fast reads and writes.
  • now: reading data (especially small blocks) was very slow.
  • the main problem: the speed would stop completely (0 mb/s) many times. the drive remained connected, but it paused working.
  • context: i used the drive with my android phone for months. android writes files correctly, but it does not clean up deleted files on external usb drives.

finding the problem

1. testing the drive

i used a tool called f3probe to test the drive. this tool usually checks for fake drives, but it also measures speed. the results showed the problem:

average write time: 201µs (normal is ~1-10µs)
probe time: 14 minutes (should be less than 10 seconds)

the write time was 200 times slower than normal.

here is why: the ssd was full of "garbage" data. because i used it with my phone for months, i wrote and deleted many files. but android does not send a command called trim to external drives. trim tells the drive which data is deleted and can be erased. without trim, the drive thinks it is 100% full of valid data.

when i tried to read files on linux, the drive's internal controller had to search through all this old data. it became overloaded, paused all work to organize its memory (causing the drop to 0 mb/s), and then started again.

2. the solution: trim

to fix this, the computer must send the trim (or scsi unmap) command. this command cleans the drive.

i tried to run the trim command on linux:

sudo fstrim -v /mnt/usb
# fstrim: the discard operation is not supported

the error message said "not supported." the usb chip inside the netac enclosure was reporting incorrect information to linux. it said it could not do trim, even though the ssd inside could.

the fix: force the unmap command

i had to force linux to ignore the usb chip's report and send the trim command anyway.

step 1: force the setting

i found the device setting in the system files and changed it to unmap.

(note: replace /dev/sda with your correct device name)

# find the specific id for the disk
ls /sys/block/sda/device/scsi_disk/
# output example: 6:0:0:0

# force 'unmap' mode
echo "unmap" | sudo tee /sys/class/scsi_disk/6:0:0:0/provisioning_mode

then i ran the trim command again:

sudo fstrim -v /mnt/usb
# output: /mnt/usb: 931.4 gib trimmed

it worked! the drive accepted the command and instantly cleaned nearly 1tb of old data from my months of android usage.

step 2: make the fix permanent

the command above stops working when you restart the computer. to make it permanent, i added a rule file.

i created a file named /etc/udev/rules.d/50-netac-trim.rules with this content:

action=="add|change", attrs{idvendor}=="0dd8", attrs{idproduct}=="2320", subsystem=="scsi_disk", attr{provisioning_mode}="unmap"

finally, i reloaded the rules:

sudo udevadm control --reload-rules

the results

after cleaning the drive, i tested the speed again.

measurement before fix (slow) after fix (fast) improvement
write latency 201 µs 1 µs 200x faster
test time 14m 03s 6.77s 125x faster

the "drop to zero" pauses stopped immediately. the drive reads data smoothly again.

conclusion

be careful about not trimming your ssd.
and for devices with custom provisioning_mode, note to:

  1. connect the drive to a linux pc occasionally.
  2. force the provisioning_mode to unmap if necessary.
  3. run sudo fstrim -v /mountpoint to refresh the drive.

other

while looking onto an ssd board i have found these pins, idk how can I use it but might be something useful for later


hardware: netac portable ssd 1tb (usb id 0dd8:2320)
os: linux (kernel 6.x) & android (samsung)