Safely Rename an LVM Volume with lvrename

lvrename changes the device path an LV answers to, and anything still pointing at the old name breaks the moment you commit. This guide renames the volume, checks for those references first, and confirms the new name with LVM afterwards.

1. Record the volume and check for references

Set shell variables to the real volume group and logical volume names. The values below are placeholders. Do not run the rename until lvs shows the expected object and you have searched for consumers of its old path.

$ VG='vgdata'
$ OLD_LV='lvold'
$ NEW_LV='lvnew'
$ sudo lvs --noheadings --options vg_name,lv_name,lv_attr,lv_size "$VG"
  vgdata lvold -wi-a----- 100.00g

Use the exact names from your output. LVM also accepts an LV path such as /dev/vgdata/lvold; the volume group and LV forms are less ambiguous when variables are involved.

Search configuration and operational scripts for the old device path. This is a read-only check, and the directories shown are examples rather than a claim that every host uses all of them.

$ sudo rg -n --hidden --glob '!proc/**' --glob '!sys/**' \
    '/dev/vgdata/lvold|vgdata/lvold' /etc /srv /opt 2>/dev/null
$ findmnt --source '/dev/vgdata/lvold'

An empty search is useful, but it is not proof no application has the path in an environment variable, a secret store, a container definition or a remote management system. If the LV is mounted, identify the owning service before continuing. A pathname used by /etc/fstab, a systemd unit, a backup job or an application must be updated after the rename.

2. Check the exact command without changing metadata

lvrename supports either VG LV LV_new or LV LV_new. Its --test option disables metadata writing while still reporting success from the command's operation, so it is useful for checking the invocation. It is not a substitute for checking the real LV and its consumers.

$ sudo lvrename --test "$VG" "$OLD_LV" "$NEW_LV"
  TEST MODE: Metadata will NOT be updated and volumes will not be suspended.
  Logical volume "lvold" successfully renamed to "lvnew".

The diagnostic wording can vary with the LVM build. Confirm the exit status as well:

$ printf 'test status: %s\n' "$?"
test status: 0

If the test reports the LV does not exist, stop and correct the variables. Do not add --nolocking to get past an error: the manpage warns that disabling locking can let concurrent commands produce incorrect results.

3. Warn users and perform the rename

Before the real change, stop or quiesce applications that open the LV and confirm no storage operation is running against the volume. Renaming is not a filesystem rename, and it can break software that refers to the old device path. Do not use --yes merely to make a maintenance script quieter: it suppresses confirmation and assumes yes.

Run the same positional form without --test. This is the state-changing command and needs elevated privileges:

$ sudo lvrename "$VG" "$OLD_LV" "$NEW_LV"
  Logical volume "lvold" successfully renamed to "lvnew"

Tip: LVM metadata is changed by this command. The default automatic metadata backup is enabled unless your LVM configuration says otherwise, and the manpage strongly advises automatic backup. Inspect the backup directory used by your host with your normal LVM configuration review before the change, and do not disable backup casually with --autobackup n.

4. Verify both names and update consumers

Ask LVM for the new name and check the old name is absent from the volume group:

$ sudo lvs --noheadings --options vg_name,lv_name,lv_path,lv_attr "$VG"
  vgdata lvnew /dev/vgdata/lvnew -wi-a-----
$ test ! -e "/dev/$VG/$OLD_LV" && echo "old path absent"
old path absent
$ test -e "/dev/$VG/$NEW_LV" && echo "new path present"
new path present

The exact device-node presentation depends on udev and the host's LVM configuration. The authoritative check is the LV report, with the expected volume group, new LV name and new LV path.

Now update every confirmed consumer:

Repeat the reference search and check the mounted source after consumers are updated:

$ sudo rg -n --hidden --glob '!proc/**' --glob '!sys/**' \
    '/dev/vgdata/lvold|vgdata/lvold' /etc /srv /opt 2>/dev/null
$ findmnt --source '/dev/vgdata/lvnew'

If the LV is expected to be mounted, the second command should show the intended mountpoint. If a service fails to start, stop at that service's normal recovery boundary rather than repeatedly retrying writes to the volume.

5. Reverse the change if required

The undo operation is another rename, provided the new name is still free and the LV is the one you intend to change. First stop consumers that use the new path and check the current report:

$ sudo lvs --noheadings --options vg_name,lv_name,lv_path "$VG"
  vgdata lvnew /dev/vgdata/lvnew
$ sudo lvrename "$VG" "$NEW_LV" "$OLD_LV"
  Logical volume "lvnew" successfully renamed to "lvold"

Recovery: verify lvs again, restore any configuration edits made for the new path, and start services using their ordinary recovery procedure. Do not use lvremove: renaming preserves the LV, while removal is a different and destructive operation.

Done means