Util-Linux package development
 help / color / mirror / Atom feed
* Question on fstrim not operating the way I expected.
@ 2026-05-31 14:26 Michael D. Setzer II
  0 siblings, 0 replies; only message in thread
From: Michael D. Setzer II @ 2026-05-31 14:26 UTC (permalink / raw)
  To: util-linux

Have maintain a disk imaging program going back to 2004, and 
had script to clean partitions by writing nulls to unused sectors.
But with solid state drives that added wear to drives.
Thought fstrim would be a better solution.
My G4L program loads in ram with no partitions mounted. 
It then mounts the partition and runs fstrim once showing the space 
it finds, and then runs again show 0 space to trim.
Then partitions are unmount before backing up the partitions or 
drives. 
But if I run the fstrim again, it shows exactly the same numbers on 
first pass and then zeros on second pass. So looks like fstrim is only 
making changes to memory. Is very fast thou.
Mad an image of a 1T drive with the fstrim process, and it created 
an 82G image file. 
Ran Zerofree which my script offers as a second option, and made 
another image file, and it produced a 78G image file?
fstrim is very fast, but appears to not clear anything on physical 
disk.
zerofree is a much longer process. Takes about 30 minutes on 1TB 
drive, but does only write to non-zero blocks.
Older dd option would write to all unsed blocks, so would put wear.

Creating he image file takes about 34 minutes to image 1TB disk, 
but zerofree taking about 30 minutes make total time 64 minutes.

Usually the fstrim only takes 10 to 30 seconds.

Thanks.

+------------------------------------------------------------+
 Michael D. Setzer II - Computer Science Instructor (Retired)     
 mailto:mikes@guam.net                            
 mailto:msetzerii@gmail.com
 mailto:msetzerii@gmx.com
 Guam - Where America's Day Begins                        
 G4L Disk Imaging Project maintainer 
 http://sourceforge.net/projects/g4l/
+------------------------------------------------------------+




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-05-31 14:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-31 14:26 Question on fstrim not operating the way I expected Michael D. Setzer II

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox