Steve Litt on 28 Sep 2017 12:07:36 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Reclaiming inodes


On Thu, 28 Sep 2017 10:19:58 -0700
Rich Freeman <r-plug@thefreemanclan.net> wrote:

> On Thu, Sep 28, 2017 at 9:52 AM, Steve Litt
> <slitt@troubleshooters.com> wrote:
> > On Thu, 28 Sep 2017 11:51:30 -0400
> > "Gavin W. Burris" <bug@wharton.upenn.edu> wrote:
> >  
> >> It's also possible that files that have been deleted are still
> >> being cached, not freed, because they are mapped by some process in
> >> memory.  You can check with lsof, or just reboot to see if it
> >> clears.  Cheers.  
> >
> > On that same note, if the disk is an SSD, run fstrim on its
> > partitions to reclaim deleted inodes.
> >  
> 
> I doubt that fstrim would have any impact on ext4 inodes.
> 
> First, fstrim doesn't have any effect on the filesystem itself.  It
> trims unallocated blocks on the underlying device, so that the SSD can
> more efficiently perform writes (which require block erasures).  If a
> block has been trimmed then the SSD knows it can do a partial write to
> that block without having to move the rest of the block contents to a
> new block.
> 
> Second, I'm pretty sure the inode structures are completely fixed on
> disk at the time of ext4 filesystem creation.  So, they're completely
> allocated the moment the filesystem is created, and will never be
> free.  So, fstrim would never trim those blocks anyway.
> 
> If this were another filesystem that dynamically allocated inodes then
> fstrim still wouldn't have any impact on the number of free inodes,
> but if a large number had been freed up it might trim some of the
> blocks they were previously stored on, which would improve the
> performance of the SSD.

OK, I believe you. So let me rephrase:

If you have an SSD, frequently run fstrim on all your SSD partitions to
reclaim deleted space. Doing so has many benefits.

SteveT

Steve Litt
September 2017 featured book: Manager's Guide to Technical
Troubleshooting Brand new, second edition
http://www.troubleshooters.com/mgr
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug