Util-Linux package development
 help / color / mirror / Atom feed
From: "Michael D. Setzer II" <mikes@guam.net>
To: util-linux@vger.kernel.org
Subject: Question on fstrim not operating the way I expected.
Date: Mon, 1 Jun 2026 00:26:52 +1000	[thread overview]
Message-ID: <6A1C452C.9366.324AC3@mikes.guam.net> (raw)

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/
+------------------------------------------------------------+




                 reply	other threads:[~2026-05-31 14:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6A1C452C.9366.324AC3@mikes.guam.net \
    --to=mikes@guam.net \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox