New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lvremove pitfall/user experience #34
Comments
The way I remember this is that an LV name on its own is meaningless: it must always be qualified by a VG name. In LVM2 the canonical way of referring to an LV is always If you need an online reminder then the man page for
I agree the tool |
I think it would also be helpful if the I would be a bit cautious about SIGKILLing LVM2 processes - they hold locks while operating and may in some cases carry out repairs or other modifications to the device metadata (as well as the operation specified on the command line). It's unlikely but the wrong timing could leave your devices in an inconsistent state. |
If there would be any kind of change like that - it would like had to be some sort of 'extra' trap case to check if this is the 'missing /' situation - since in some commands lvm2 may 'deduce' unspecified VG name if it was specified with some other LV (or there is also envvar LVM_VG_NAME which can be used in cases of missing VG name) So technically lvm2 should do an analysis ahead of starting command - it would figure out the vgname with name of lv_name does not exist - and could probably exit early |
If SIGKILL can leave the devices in an inconsistent state, then so can a system crash, which is bad as it means that lvm2 is not crash-safe. |
Unsure what do you mean by 'crash-safe' app here ? Lvm2 normally stops signal handling for critical section operations - so we protect against SIGINT, SIGTERM.. and other regular signal. Clearly NO user-space app can protect itself against SIGKILL (by linux kernel definition) So if you kill lvm2 command within critical section code processing - you can generally kill your system - i.e. if lvm2 has suspend your rootfs volume - and there is nothing to resume it since lvm2 has been killed. So yes lvm2 command can stop your working system - and users should never need SIGKILL-it - we do our best to avoid it - but clearly - we are still 'just user-space app'.... |
In this case I would argue that this is a kernel bug, inasmuch as killing any process other than PID 1 should not leave the system in an unrecoverable state. |
I'm not going to argue about Linux architecture - it's the way it is... Users should not be 'randomly' killing their process and then wondering their system gots frozen. It's very much the same like to argue about user should not be able to destroy his system with 'rm -rf /*'.... lvm2 is highly privilege process and as such it can kill your machine (mostly equivalent as if it would be kernel task). Normal user space app typically does not have such ability. |
@zkabelac Okay, valid. That makes lvm2 the equivalent of a storage daemon needed by the rootfs. |
This may not be a common experience, but I want to share it, along with a couple of simple solutions to make it a little better, and less terrifying to use lvremove.
I rarely have to remove a logical volume, but every time it happens I know I'm going to fall into this trap. First of all, I never remember the arguments, so I check
lvremove -h
. The output of that gives an arbitraryVG|LV|Tag|Select ...
as the first argument, with no clarification as to what the format of any of these are. There is--longhelp
, but it redirects you to a manpage. So invariably I try to run this command (an argument syntax that matches lvcreate):lvremove my_vg my_lv
This command is absolutely terrifying to run the first time because it will start telling you every lv it cannot delete because they are in use. On top of that, SIGINT is being trapped, so you cannot use CTRL-C to abort this operation. Run this on a system with dozens of LVs, and you're stuck opening another terminal to send a SIGKILL to get control back.
My request here is for two changes:
lvremove
as an example to the end of thelvremove --help
outputThese two changes are minor, will take years to reach the environment I work in, but they could make another user's life a little more pleasant.
The text was updated successfully, but these errors were encountered: