I guess you get an error message when you type
lvremove volgroup/lv-1-*
because the shell tries to expand the name volgroup/lv-1-*
inside you current directory, i.e., if you run that command from /tmp
(for instance) the shell will try to find existing files in subdirectory /tmp/volgroup
whose names start with lv-1-
. As shell finds no such file then it launches the lvremove
command with the argument volgroup/lv-1-*
... and I guess none of your LVs is named lv-1-*
.
Keep in mind that the file name expansion is carried out by the shell, not by the command (lvremove in your case). Asterisk metacharacter has no meaning for the most of commands (like lvremove) and handles as any other character.
The following examples will do what you are trying:
lvremove /dev/volgroup/lv-1-*
or
cd /etc
lvremove volgroup/lv-1-*
In both cases, shell will expand to all matching file names --- From your example above, after the shell expansions my suggested command lines really will be run as:
lvremove /dev/volgroup/lv-1-8a /dev/volgroup/lv-1-846a /dev/volgroup/lv-1-5a
or
cd /etc
lvremove volgroup/lv-1-8a volgroup/lv-1-846a volgroup/lv-1-5a
When the number of arguments is huge, the limit of the command line size may be reached. In that case the find
command is useful:
find /dev/volgroup -type l -exec lvremove -f '{}' ';'
Best regards.