• Home
  • Disclaimer
  • Contact
  • Archives
  • About
  • Subscribe
  • Support
  • Advertise

Kernel Talks

Unix, Linux, & Cloud!

  • How-to guides
    • Howto
    • Disk management
    • Configurations
    • Troubleshooting
  • OS
    • HPUX
    • Linux
  • Miscellaneous
    • Software & Tools
    • Cloud Services
    • System services
    • Virtualization
  • Certification Preparations
    • AWS Certified Solutions Architect – Associate
    • AWS Certified Solutions Architect – Professional
    • AWS Certified SysOps Administrator – Associate
    • AWS Certified Cloud Practitioner
    • Certified Kubernetes Administrator
    • Hashicorp Certified Terraform Associate
    • Oracle Cloud Infrastructure Foundations 2020 – Associate
  • Tips & Tricks
  • Linux commands
You are here: Home / Disk management

How to rename logical volume in Linux and HPUX

Published: January 20, 2017 | Modified: June 20, 2020



Learn how to rename logical volume in Linux or Unix. Understand what happens in the background when you change the logical volume name of existing LVOL.

LVM i.e. logical volume manager is one of the widely used volume managers in Linux and Unix. A logical volume is a portion of the volume group which can be mounted on a mount point. Once mounted, space belonging to that logical volume is available for use to end-user.

In this post, we are going to see step by step how to rename logical volume. In Linux, lvrename is a direct command which does this stuff for you. But first, we will see how it works in the background so that you know the flow and you can rename LV even without lvrename command.

LV renaming procedure follows below flow :

  1. Stop all user/app access to related mount point (on which lvol is mounted) using fuser
  2. Un-mount LV using umount
  3. Rename device names of lvol using mv
  4. Mount LV using mount
  5. Edit /etc/fstab entry related to this lvol using vi

Let’s see an example where we are renaming /dev/vg01/lvol1 which is mounted on /data to /dev/vg01/lvol_one. See the below output for the above-mentioned steps (HPUX console).

# bdf /data
/dev/vg01/lvol1 524288 49360 471256 9% /data
# fuser -cku /data
/data:   223412c(user1)
# umount /data
# mv /dev/vg01/lvol1 /dev/vg01/lvol_one
# mv /dev/vg01/rlvol1 /dev/vg01/rlvol_one
# mount /data
# bdf /data
/dev/vg01/lvol_one    524288    49360   471256  9%   /data

In the above output, you can see how we renamed logical volume just by renaming its device files.

In Linux, we have a single command lvrename which do all the above steps in the background for you. You just need to provide it with old and new lvol names along with the volume group where this lvol belongs. So, the above scenario will have below command –

# lvrename vg01 lvol1 lvol_one
  Renamed "lvol1" to "lvol_one" in volume group "vg01"

You can see in the output that single command renamed lvol1 to lvol_one! This command also supports below option :

  • -t For test
  • -v Verbose mode
  • -f Forceful operation
  • -d debug
⇠ Previous article
How to establish passwordless ssh between two servers
Next article ⇢
How to check and test APA in HPUX

Related stuff:

  • How to remove lost physical volume from volume group
  • XFS filesystem in Linux
  • LVM commands tutorial : Part 1 : Physical Volume (pvchange, pvmove)
  • HPUX: Add persistent device names in VG
  • How to scan new lun / disk in Linux & HPUX
  • Basics of LVM legends
  • LVM cheatsheet
  • Move disks/LUN from one server to another without losing data
  • Difference between ext2, ext3 and ext4
  • LVM commands tutorial : Part 2 : Volume group (vgcreate, vgdisplay, vgscan)
  • LVM commands tutorial : Part 2 : Volume group (vgcfgbackup, vgcfgrestore, vgchange)
  • Upgrade EXT filesystem in Linux (RHEL, CentOS, Ubuntu)

Filed Under: Disk management Tagged With: how to rename lvol, how to use lvrename, lvm task, lvrename, rename lvol in hpux, renaming logical volume

If you like my tutorials and if they helped you in any way, then

  • Consider buying me a cup of coffee via paypal!
  • Subscribe to our newsletter here!
  • Like KernelTalks Facebook page.
  • Follow us on Twitter.
  • Add our RSS feed to your feed reader.

Comments

  1. vishal says

    April 27, 2018 at 1:03 pm

    Hi,

    Your information is helpful. I need to know that I need to rename file system /oradata to /oradata_old and use new file /oradata1 lets say. Can I simply change /oradata with mv /dev/mapper/1500g-oradata/oradata /dev/mapper/1500g-oradata/oradata_old. Please share your help on this.

    /dev/mapper/1500g-oradata 1548046564 1065192004 404194976 73% /oradata

    Regards, Vj

    Reply
    • Shrikant Lavhate says

      April 27, 2018 at 11:12 pm

      Hope I understood correctly. You need /oradata to be /oradata1.
      VG name is 1500g and LV name is oradata

      # mkdir /oradata1
      # umount /oradata (Make sure /oradata is not being accesses by anyone with fuser)
      # mount /dev/1500g/oradata /oradata1

      Edit /etc/fstab to make change permanent over reboot.

      Reply

Share Your Comments & Feedback: Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get fresh content from KernelTalks

  • Email
  • Facebook
  • RSS
  • Twitter

Get Linux & Unix stuff right into your mailbox. Subscribe now!

* indicates required

This work is licensed under a CC-BY-NC license · Privacy Policy
© Copyright 2016-2023 KernelTalks · All Rights Reserved.
The content is copyrighted to Shrikant Lavhate & can not be reproduced either online or offline without prior permission.