swisstech.net

tech and photography

Keeping Data on SSDs fresh for a long time

2026-02-01

Since SSDs lose data over time, they’re not the greatest medium for long term storage. But SSDs are here and they’re not going away. I have plenty of used M.2 drives with the original operating system out of the used computers I buy for homelabbing and experimenting.

So to “refresh” such a drive, I read the entire disk using dd and give the drive some extra time for maintenance and hope, that’ll do it.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10

# read the full disk at a reduced speed
dd if=/dev/sda status=progress bs=1M | pv -L 100M | dd of=/dev/null bs=1M

# sync should tell the drive to flush internal caches
sync

# logically remove the drive from the system, this should also tell the drive,
# to write any remaining volatile data - lsblk won't show the drive anymore.
echo 1 | tee /sys/block/sda/device/delete

After that I’ll leave the drive powered on for a bit and then disconnect it.