Home > Techie > Renaming a Logical Volume (how to rename)

Renaming a Logical Volume (how to rename)

Today I was asked to rename a logical volume (something I hadn’t done before, but figured it was quite easy). Here’s what I ran:

lvm help

Which showed me the option of:

lvrename Rename a logical volume

Ah.. I thought to myself, this should be easy enough. So I did a quick poke at the man pages of lvmrename which netted me

lvrename [-A|--autobackup {y|n}] [-d|--debug] [-f|--force] [-h|--help] [-t|--test] [-v|--verbose] [--version]
VolumeGroupName OldLogicalVolumeName NewLogicalVolumeName

note: ugggg sorry for the formatting.. thank you wordpress.

So off I went, and here’s what I did:

sudo umount /mountpoint
sudo lvrename /dev/volgroupname/lgvold /dev/volgroupname/lgvnew
sudo vi /etc/fstab
fixed the required fstab settings
sudo mount -a (or you can mount each one individually, but in my situation I was able to just run umouna -a).

That’s it. Simple as that.

If you do happen to rename while mounted you’ll not be able to unmount. In that case just change to the new location in fstab and bounce the box (yes, that’s the easiest way.. sinec the device will keep showing busy, even though lsof and everything reports it shouldn’t be).

That’s it.. hope someone finds this helpful.

Note: Thanks Chris for the reminder. He points out a good point that I left out, and that being updating the logical volume pointer within fstab if you’re doing mounting using fstab.

Categories: Techie Tags: , ,
  1. Chris
    February 10th, 2009 at 06:44 | #1

    Don’t forget to also update /etc/grub.conf (if you update your / -root-) lvm.
    Also; you don’t need to unmount the logical volume prior to renaming it.

  1. No trackbacks yet.