Skip to content

zzhou1/fstrim-throttle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 

Repository files navigation

usage: nice_trim.py [-h] [-a] [-b] [-d] [-v]

A wrapper of fstrim. It runs fstrim in chunks and sleep in between.

It intends to throttle fstrim and leave the room for the normal WRITE request
IO to get through to the backend block device. A plain fstrim might initiate
DISCARD requests, disturb ongoing IO too much, cause the long freeze, and harm
the critical service.

The human readable format includes K/KiB, M/MiB, G/GiB, T/TiB, KB, MB, GB, TB.

optional arguments:
  -h, --help     show this help message and exit
  -a, --all      auto-detect all trimmable. This overrides any mount point
  -b, --bytes    print SIZE in bytes rather than in human readable format
  -d, --debug    debugging information
  -v, --verbose  duplicate the log INFO to STDOUT as well

information options:
  
  mount_point    mount points we are trimming. Internally, fstrim will convert any
                 directory path to the corresponding mount point or block device.
  -c, --chunk-size <bytes>
                 to search for free blocks to discard. kernel will internally
                 round it up to a multiple of the filesystem block size. Also
                 this tool will round it up to the filesystem block size to avoid
                 fstrim error report if too small (default: 4GiB)
  -m, --min-extent <bytes>
                 the minimum contiguous free range to discard. kernel will
                 internally round it up to a multiple of the filesystem block
                 size. Zero is to discard every free block (default: 16MiB)
  -s, --sleep-range <min,max> in seconds (default: 0.5)
                 MIN would give a reasonable sleep between fstrim chunks.
                 MAX would give a bigger random sleep to avoid all virtual machines or
                 physical machines to stress the storage system all at once.
                 eg. a random range '0.5,600'
                 eg. 0.5 is equal to '0.5,0.5'
  -l, --log-file <path> (default: /var/log/nice_trim.log)

Example: nice_trim.py -a

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages