Operating System - HP-UX
1834391 Members
1596 Online
110066 Solutions
New Discussion

how to rename LV's command line

 
SOLVED
Go to solution
Tony Escujuri
Occasional Advisor

how to rename LV's command line

Hi all,

How do I rename a logical volume command line.

Example:
/dev/vg02/lvol1b

Thanks and Best Regards.
Tony Escujuri
7 REPLIES 7
Michael Tully
Honored Contributor

Re: how to rename LV's command line

Hi,

I don't believe that this can be done. You
would need to backup the existing logical
volume, remove it and recreate it.

1. Backup the volume
2. Remove the volume using
'lvremove /dev/vg02/lvol1b'

3. Re-create your volume
'lvcreate -n /dev/vg02'
'lvextend -L /dev/vg02/newname'

4. Do your restore

HTH
-Michael
Anyone for a Mutiny ?
James R. Ferguson
Acclaimed Contributor
Solution

Re: how to rename LV's command line

Hi Tony:

If all you want is to renmae the logical volume, do this:

# umount mountpoint

# mv /dev/vgXX/oldname /dev/vgXX/newname
# mv /dev/vgXX/roldname /dev/vgXX/rnewname

...NOTE both the block and the raw device file names are changed...

# (Edit /etc/fstab to reflect the 'newname' for the 'mountpoint')

# mount -a

Regards!

...JRF...
Animesh Chakraborty
Honored Contributor

Re: how to rename LV's command line

Hi,
I have tested JRF's steps.
It works!!

Regards
Animesh
Did you take a backup?
Michael Tully
Honored Contributor

Re: how to rename LV's command line

Well doggonnnn.... You learn something everyday!

Thanks Jim... I didn't think it could be done

Cheers
-Michael
Anyone for a Mutiny ?
Bill Hassell
Honored Contributor

Re: how to rename LV's command line

lvols can always be renamed, but vg's cannot as the name is not only a directory but the name is stored in lvmtab and other structures. The ability to rename lvols is one of the reasons that vgexport can be used without a mapfile to create the default names, then just mv them to the desired names.


Bill Hassell, sysadmin
Tony Escujuri
Occasional Advisor

Re: how to rename LV's command line

That worked thanks for the help.... you guys are the greatest!!

Regards,
Tony Escujuri
Roger Baptiste
Honored Contributor

Re: how to rename LV's command line

Tony,

A caveat:

When a raw logical volume needs to be renamed, it has to be made sure that it
is not being used by running:
fuser /dev/vgname/lvolname

-> if this lists pid's using it , then
the processes need to be identified and
either be killed or gracefully removed.

Only when the raw volume is not being used,
should it be renamed. I have seen a DBA
get into big trouble at work by renaming a
live db raw volume.

For a filesystem lv, it's a different story,
since the Filesystem unmount automatically
ensures the LV is not being used.

-raj
Take it easy.