How to rename lvm name?
This page describes the steps needed to change an LVM (Logical Volume Manager) Volume Group name which includes the the Root partition ("/"). The problem is that the Root partition LVM Device Mapper is referenced in different configuration files and embedded in the Kernel initramfs.
We will demonstrate the LVM Volume Group name change from "nst_localhost" to "nst20".
The Fedora System Storage Manager utility: ssm is used to display the current storage layout on the example system.
The vgrename utility will be used to change LVM Volume Name from "nst_localhost" to "nst20":
Use an editor (e.g., vi) to change the LVM Volume Group Device Mapper name in the file system configuration file: "/etc/fstab" to the new "nst20" name for the "root" and "swap" Logical Volumes.
Before:
After:
Use an editor (e.g., vi) to change the LVM Volume Group Device Mapper name in the file system configuration file: "/boot/grub2/grub.cfg" to the new "nst20" name for the "root" and "swap" Logical Volumes for all relevant entries.
Before (Note: Only one Grub2 menu entry is shown for example purposes. All relevant entries need to be changed.):
After:
The Kernel initramfs image needs to be rebuild to reflect the LVM Volume Group name change. The mkinitrd will be used to accomplish this task which uses the "dracut" tool.
Example for Kernel: 3.12.5-302.fc20.x86_64
After all the above changes have been made, use the systemctl utility to reboot your system:
You can rename the LVM logical volume by using the lvrename command, then modify the volume name in the cluster load, unload, and monitor scripts. The command does not change the volume group name. The LVM cluster resource must be offline while you rename the logical volume and modify the scripts.
- sudo vgrename
- sudo vgchange -ay.
- Modify files that contain references to logical volumes from the old volume group: /etc/fstab. /boot/grub/grub. cfg. /etc/initramfs-tools/conf. d/resume.
- sudo update-initramfs -u -k all.
- sudo shutdown -r now.