Standardize LVM's PV and VG name for servers
The current stack created by strapon
goes like this:
[ Filesystems ]
[ LVM ]
[ LUKS ]
[ RAID using p3 from each device ]
[p1][p2][p3] ... [p1][p2][p3]
[ disk1 ] ... [ diskN ]
Currently strapon
uses the same value for PV and VG names:
-
VG_NAME
may be set as an environment variable, or usesvg_name
as default. - The PV name is set during the LUKS open operation and currently uses
VG_NAME
. - The VG is then created using
VG_NAME
.
Options to consider:
PV | VG |
---|---|
default |
default |
pv |
vg |
$hostname |
$hostname |
disk |
vg |
disk0 |
vg0 |
From vgrename
's manpage:
All VGs visible to a system need to have different names, otherwise many
LVM commands will refuse to run or give warning messages. VGs with the
same name can occur when disks are moved between machines, or filters are
changed. If a newly connected disk has a VG with the same name as the VG
containing the root filesystem, the machine may not boot correctly. When
two VGs have the same name, the VG UUID can be used in place of the source
VG name.
Pros of using the same PV and VG name for all nodes
- Hostname changes do not interfere in PV/VG naming (this might be frequent given our use of hostnames to determine node's environments in Puppet).
- Less complexity on automation scripts.
- Less complexity during maintenance (eg. it'll always be
lvdisplay vg
).
Cons of using the same PV and VG name for all nodes
- Moving disks or volumes between machines needs to be done more carefully to avoid interference.
Steps to fix
-
Decide on a naming scheme after considering pros and cons: Use default
,default
for now. -
Change strapon
to use the new naming scheme. Mapped: strapon/strapon#9 -
Reinstall test node using up to date(Would be great, but not really needed for now)strapon
.
Edited by drebs