Softpanorama

May the source be with you, but remember the KISS principle ;-)
Home Switchboard Unix Administration Red Hat TCP/IP Networks Neoliberalism Toxic Managers
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and  bastardization of classic Unix

Logical Volume Renaming

News

Linux Disk Management

Recommended Books

Recommended Links

 Grub

Recommended Papers

LVM Cheatsheet

Linux Logical Volume Snapshots
Linux Disk Partitioning Operations on Logical Volumes Create a new volume Logical Volume Renaming Moving a volume group to another system LVM Tools Recover LVM volumes Ext3 filesystem
Basic LVM commands Create and mount a partition Get information about free space Extend the partition  Resize the logical partition Shrinking LVM logical volume with ext3/ext4 filesystem    
Linux Troubleshooting modprobe FATAL could not load modules.dep Controlling LVM Device Scans with Filters Partition labels Software RAID Loopback filesystem Humor Etc

Renaming a logical volume is a three step process:

  1. Rename the LV
  2. Remount the file system
  3. Update /etc/fstab

Remounting the file system is necessary in order for the user space to see the name change.

We will assume you already have a logical volume (LV) created on your system use the command

In older version of LVM you do not need "full path" and can use just labels (as it should be)

lvrename VG00 LogVol02  tmp

But on SLES 11 you need to use "full path"

lvrename VG00 /dev/VG01/LogVol02 /dev/VG01/tmp

For example:

# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda3             11904620   3259964   8030172  29% /
/dev/mapper/VolGroup00-LogVol01
                      11902896    225052  11063444   2% /var
/dev/mapper/VolGroup00-LogVol02
                      15870920   2233504  12818216  15% /tmp
/dev/sda1               497829     17029    455098   4% /boot
tmpfs                  2020820         0   2020820   0% /dev/shm
/dev/mapper/VolGroup00-LogVol00
                     198384608   1432960 186711648   1% /Accelrys
# lvrename VolGroup00 LogVol02 tmp
  Renamed "LogVol02" to "tmp" in volume group "VolGroup00"
# lvrename VolGroup00 LogVol01 var
  Renamed "LogVol01" to "var" in volume group "VolGroup00"
# lvs
  LV       VG         Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  accelrys VolGroup00 -wi-ao 195.31G
  tmp      VolGroup00 -wi-ao  15.62G
  var      VolGroup00 -wi-ao  11.72G
# vi /etc/fstab
# mount
/dev/sda3 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/mapper/VolGroup00-LogVol01 on /var type ext3 (rw)
/dev/mapper/VolGroup00-LogVol02 on /tmp type ext3 (rw)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/mapper/VolGroup00-LogVol00 on /Accelrys type ext3 (rw)											
											

Top Visited
Switchboard
Latest
Past week
Past month

NEWS CONTENTS

Old News ;-)

[Jul 15, 2011] LVM Renaming - How to rename logical volumes (LVM's) in Linux - Lvm, Lvs, Lvrename, Lvdisplay, Logvol

Renaming a logical volume is a three step process:

  1. Rename the LV
  2. Remount the file system
  3. Update /etc/fstab

Remounting the file system is necessary in order for the user space to see the name change.

Note: The output of the df command will not display the new name of the file system until it has been remounted.

In the following example, we will rename the logical volume DataLV to TCPDumpLV. Lets get started!

  1. Begin by listing all the logical volumes on the system

    [root@Linux01 ~]# lvs
    LV VG Attr LSize Origin Snap% Move Log Copy% Convert
    DataLV TCPDumpVolGRP -wi-ao 2.00G

    LogVol00 VolGroup00 -wi-ao 1.00G
    LogVol01 VolGroup00 -wi-ao 1.94G
    LogVol02 VolGroup00 -wi-ao 1.00G

    LogVol03 VolGroup00 -wi-ao 2.00G
    LogVol04 VolGroup00 -wi-ao 3.94G
    [root@Linux01 ~]#

  2. Let's find out where DataLV is mounted

    [root@Linux01 ~]# df -kh
    Filesystem
    Size
    Used Avail Use% Mounted on
    /dev/mapper/VolGroup00-LogVol04
    3.9G 2.2G 1.6G 59% /
    /dev/sda1
    99M
    12M 82M 13% /boot
    tmpfs
    1006M
    0 1006M 0% /dev/shm
    /dev/mapper/VolGroup00-LogVol00 992M 41M 901M 5% /home
    /dev/mapper/VolGroup00-LogVol02 992M 69M 872M 8% /tmp
    /dev/mapper/VolGroup00-LogVol03
    2.0G
    150M 1.7G 8% /var
    /dev/mapper/TCPDumpVolGRP-DataLV
    2.0G
    568M 1.4G 30% /Data
    Note: The DataLV is mounted on /Data

  3. Rename DataLV to TCPDumpLV

    [root@Linux01 /]# lvrename TCPDumpVolGRP DataLV TCPDumpLV
    Renamed "DataLV" to "TCPDumpLV" in volume group "TCPDumpVolGRP"
    [root@Linux01 /]#

  4. Verify the logical volume has been renamed

    [root@Linux01 ~]# lvs
    LV VG Attr LSize Origin Snap% Move Log Copy% Convert
    TCPDumpLV TCPDumpVolGRP -wi-ao 2.00G

    LogVol00 VolGroup00 -wi-ao 1.00G
    LogVol01 VolGroup00 -wi-ao 1.94G
    LogVol02 VolGroup00 -wi-ao 1.00G

    LogVol03 VolGroup00 -wi-ao 2.00G
    LogVol04 VolGroup00 -wi-ao 3.94G
    [root@Linux01 ~]#

  5. Notice the user space has yet to be updated, this is because the file system must be remounted

    [root@Linux01 ~]# df -kh
    Filesystem
    Size
    Used Avail Use% Mounted on
    /dev/mapper/VolGroup00-LogVol04
    3.9G 2.2G 1.6G 59% /
    /dev/sda1
    99M
    12M 82M 13% /boot
    tmpfs
    1006M
    0 1006M 0% /dev/shm
    /dev/mapper/VolGroup00-LogVol00 992M 41M 901M 5% /home
    /dev/mapper/VolGroup00-LogVol02 992M 69M 872M 8% /tmp
    /dev/mapper/VolGroup00-LogVol03
    2.0G
    150M 1.7G 8% /var
    /dev/mapper/TCPDumpVolGRP-DataLV
    2.0G
    568M 1.4G 30% /Data

  6. Remount the file system to update the user space

    [root@Linux01 /]# umount /dev/mapper/TCPDumpVolGRP-DataLV
    [root@Linux01 /]# mount /dev/TCPDumpVolGRP/TCPDumpLV /Data/
    [root@Linux01 /]#

  7. Verify the file system has been mounted

    [root@Linux01 ~]# df -kh
    Filesystem
    Size
    Used Avail Use% Mounted on
    /dev/mapper/VolGroup00-LogVol04
    3.9G 2.2G 1.6G 59% /
    /dev/sda1
    99M
    12M 82M 13% /boot
    tmpfs
    1006M
    0 1006M 0% /dev/shm
    /dev/mapper/VolGroup00-LogVol00 992M 41M 901M 5% /home
    /dev/mapper/VolGroup00-LogVol02 992M 69M 872M 8% /tmp
    /dev/mapper/VolGroup00-LogVol03
    2.0G
    150M 1.7G 8% /var
    /dev/mapper/TCPDumpVolGRP-TCPDumpLV
    2.0G
    568M 1.4G 30% /Data

  8. Update /etc/fstab to reflect the new name of the file system

    /dev/mapper/TCPDumpVolGRP-DataLV /Data
    ext3 defaults 0 0
    /dev/mapper/TCPDumpVolGRP-TCPDumpLV /Data
    ext3 defaults 0 0



Etc

Society

Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy

Quotes

War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes

Bulletin:

Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law

History:

Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

Classic books:

The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

Most popular humor pages:

Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D


Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to to buy a cup of coffee for authors of this site

Disclaimer:

The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

Last modified: March 12, 2019