[linux-lvm] Reserve space for specific thin logical volumes
jbrassow at redhat.com
Tue Sep 12 23:25:41 UTC 2017
I’m the manager of the LVM/DM team here at Red Hat. Let me thank those of you who have taken the time to share how we might improve LVM thin-provisioning. We really do appreciate it and you ideas are welcome.
I see merit in the ideas you’ve presented and if I’ve got it right, there are two main ones:
1) don’t allow creation of new thinLVs or snapshots in a pool that is beyond a certain threshold
2) allow users to reserve some space for critical volumes when a threshold is reached
I believe that #1 is already handled, are you looking for anything else?
#2 doesn’t seem crazy hard to implement - even in script form. In RHEL7.4 (upstream = "Version 2.02.169 - 28th March 2017”), we introduced the lvm.conf:dmeventd/thin_command setting. You can run anything you want through a script. Right now, it is set to do lvextend in an attempt to add more space to a filling thin-pool. However, you don’t need to be so limited. I imagine the following:
- Add a “critical” tag to all thinLVs that are very important:
# lvchange --addtag critical vg/thinLV
- Create script that is called by thin_command, it should:
- check if a threshold is reached (i.e. your reserved space) and if so,
- report all lvs associated with the thin-pool that are NOT critical:
# lvs -o name --noheadings --select 'lv_tags!=critical && pool_lv=thin-pool’ vg
- run <command> on those non-critical volumes, where <command> could be:
# fsfreeze <mnt_point>
The above should have the result you want - essentially locking out all non-critical file systems. The admin can easily turn them back on via fsfreeze one-by-one as they resolve the critical lack of space. If you find this too heavy-handed, perhaps try something else for <command> instead first.
If the above is sufficient, then great. If you’d like to see something like this added to the LVM repo, then you can simply reply here with ‘yes’ and maybe provide a sentence of what the scenario is that it would solve. (I know there are already some listed in this thread, but I’m wondering about those folks that think the script is insufficient and believe this should be more standard.)
More information about the linux-lvm