Renaming an LVM logical volume changes the name LVM reports for the block device and the device path operators usually type. Do it during a maintenance window when a mount, service, script, or backup job still points at the old LV name, because those references will not follow the rename automatically.
The lvrename command can rename an LV by volume group and logical volume names, or by the old and new device paths. The example renames data to projects inside vgdata while leaving the volume group, filesystem contents, and logical volume size unchanged.
Unmount mounted filesystems or stop raw consumers before renaming the LV. Root, boot, clustered, or application-owned logical volumes need extra coordination such as bootloader, initramfs, cluster resource, or service configuration changes; an ordinary data LV that can be taken offline briefly is the safer target.
Steps to rename an LVM logical volume:
- List the current logical volume name and path.
$ sudo lvs --options lv_name,vg_name,lv_path vgdata/data LV VG Path data vgdata /dev/vgdata/data
Replace vgdata/data with the volume group and logical volume that should be renamed.
- Check whether the logical volume is mounted.
$ findmnt --source /dev/vgdata/data --output SOURCE,TARGET,FSTYPE SOURCE TARGET FSTYPE /dev/vgdata/data /srv/data ext4
No output means findmnt did not see that path as a mounted filesystem. Databases, virtual machines, swap, or cluster resources can still use a raw LV without a filesystem mount.
- Unmount the filesystem before renaming the logical volume.
$ sudo umount /srv/data
Stop the application or unmount the filesystem before changing the LV name. Renaming storage that is still in use can leave running processes, scripts, or mount tables referring to the old path.
- Rename the logical volume.
$ sudo lvrename vgdata data projects Renamed "data" to "projects" in volume group "vgdata"
The equivalent path form is sudo lvrename /dev/vgdata/data /dev/vgdata/projects.
- List the renamed logical volume.
$ sudo lvs --options lv_name,vg_name,lv_path vgdata/projects LV VG Path projects vgdata /dev/vgdata/projects
- Update persistent references that use the old logical volume path.
$ sudoedit /etc/fstab
Change path-based entries such as /dev/vgdata/data to /dev/vgdata/projects. Entries that mount by filesystem UUID may not need a path change, but service configs, backup jobs, and scripts can still contain the old LV name.
- Mount the renamed logical volume again.
$ sudo mount /dev/vgdata/projects /srv/data
If /etc/fstab contains the mount point and has already been updated, sudo mount /srv/data is enough.
- Verify that the mount uses the renamed logical volume path.
$ findmnt --source /dev/vgdata/projects --output SOURCE,TARGET,FSTYPE SOURCE TARGET FSTYPE /dev/vgdata/projects /srv/data ext4
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.