If you remove a file, file system generally just marks in its
metadata that previously occupied blocks can now be used for
other files – that operation is usually cheap, unless the file
has millions of segments (that is such a rare case, only seen in
experimental InnoDB features that Oracle thought was a good
idea).
This changes a bit with SSDs – if you update underlying device
metadata, it can have smarter compaction / grooming / garbage
collection underneath. Linux file systems have ‘discard’ option
that one should use on top of SSDs – that will extend the life
time of their storage quite a bit by TRIM’ing underlying blocks.
Now, each type of storage device will react differently to that,
some of them support large TRIM commands, some of them will
support high rate of them, some of them won’t, etc – so one has
to take that into account when removing files in production
environments.
Currently Linux block …
[Read more]