Renaming of LV

 
SOLVED
Go to solution
Bunty...
Occasional Contributor

Renaming of LV

Hi,
I need to change the name of some logical volume,
how can i do that?

My file system details are:
/dev/vg10/bunty_data_tmp01
4096000 373912 3489465 10% /bunty/data/tmp01


will i loose the data if i rename these LV.

I need to make it:
/dev/vg10/bunty_oracle_tmp01
4096000 373912 3489465 10% /bunty/oracle/tmp01


Note : I have online JFS.

Thanks
vipin
10 REPLIES 10
Jeff_Traigle
Honored Contributor
Solution

Re: Renaming of LV

OnlineJFS only affects mainetance on file systems, not logical volumes.

There is no way to rename an LV that I ever recall seeing. You have to create a new one, create a new file system on it, copy the data to it, and mount it in place of the old one.
--
Jeff Traigle
Patrick Wallek
Honored Contributor

Re: Renaming of LV

Online JFS has nothing to do with this.

Your steps would be:

1) Stop Oracle -- You need to do this because we are going to unmount the filesystem.
2) umount /bunty/data/tmp01
3) cd /dev/vg10
4) mv bunty_data_tmp01 bunty_oracle_tmp01
5) mv rbunty_data_tmp01 rbunty_oracle_tmp01
6) mkdir /bunty/oracle -- If it does not already exist.
7) vi /etc/fstab -- Change the LV name and the mountpoint to their new values.
8) mount /bunty/oracle/tmp01
9) If you have more to do -- Go to Step 2 -- Else --
10) Make whatever changes to Oracle that are necessary to point to the new file locations.
11) Start Oracle
Sivakumar TS
Honored Contributor

Re: Renaming of LV


Dear Bunty,

Irrespective of the lvol name you can mount the lvols in any directory.

You can unmount and mount the filesystem in you required directory ( of the new name) and start using it, this wont cause any data lose.

Anyway the OS will access using the mount point only.



With Regards,

Siva
Nothing is Impossible !
James R. Ferguson
Acclaimed Contributor

Re: Renaming of LV

Hi Bunty:

To rename a logical volume do this:

# unmount /mountpoint
# mv /dev/vgXX/oldname /dev/vgXX/newname
# mv /dev/vgXX/roldname /dev/vgxx/rnewname #...note the raw device...
# mkdir /newmountpoint #...optional...
# modify /etc/fstab to reflect
# mount /dev/vgXX/newname /mountpoint #...or /newmountpoint

Regards!

...JRF...


Lorenzo Facello
Valued Contributor

Re: Renaming of LV

Hi,
you have to copy your files..
and recreate a new lvol one.

then mount it to new mount point.
regds
LF



A. Clay Stephenson
Acclaimed Contributor

Re: Renaming of LV

You need to be clear. Do you wish to change the name of the logical volume or the mountpoint. If you wish to change the name of the mountpoint then you can leave the LVOL name as it is and simply create a new mountpoint.

1) umount /bunty/data/tmp01
2) rmdir /bunty/data/tmp01
3) mkdir -p -m 750 /bunty/oracle/tmp01
4) edit /etc/fstab and change the existing entry to use the new mointpoint.
5) mount /bunty/oracle/tmp01

If you also wish to rename the LVOL (not necessary) then after step 3 above:
3a) mv /dev/vg10/bunty_data_tmp01 /dev/vg10/bunty_oracle_tmp01 and make this change in /etc/fstab as well.

If it ain't broke, I can fix that.
Geoff Wild
Honored Contributor

Re: Renaming of LV

Patrick has the answer - and you DO NOT need to recreate the lvol....just unmount, rename it with a mv command, update fstab, remount...very easy to do...

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
James R. Ferguson
Acclaimed Contributor

Re: Renaming of LV

Hi (again):

The question as posted asks how to change the name of a *logical volume* and repeats it its body "...rename these LV".

Clay is correct, Geoff. The post is ambiguous.

Regards!

...JRF...
Rory R Hammond
Trusted Contributor

Re: Renaming of LV

The answers I saw seem not to be correct.

To rename a lvol I would do it this way;
lets say that you want to rename logical volume /dev/vg01/lvol2 to /dev/vg01/lvolold
and the volume group uses /dev/dsk/c1t0d0
/dev/dsk/c2t0d0

and you have for lvol1 lvol2 lvol3
with fstab entries:
/dev/vg01/lvol1 /mnt1 vxfs rw,suid,largefiles,delaylog,datainlog 0 2
/dev/vg01/lvol2 /mnt2 vxfs rw,suid,largefiles,delaylog,datainlog 0 2
/dev/vg01/lvol3 /mnt3 vxfs rw,suid,largefiles,delaylog,datainlog 0 2




1. cp /etc/fstab /etc/fstab.back
2. vi /etc/fstab.back change lvol2 to lvolold
3. Unmount /mnt1 /mnt2 /mnt3
4. vgchange -a n /dev/vg01
5. vgexport -v -m /tmp/vg01.map /dev/vg01 /dev/dsk/c1t0d0 /dev/dsk/c2t0d0
6. vi /tmp/vg00.map and change lvol2 to lvolold
7. mkdir /dev/vg01
8. mknod /dev/vg01/group c 64 0x010000
9. vgimport -v -m /tmp/vg01.map /dev/vg01 /dev/dsk/c1t0d0 /dev/dsk/c2t0d0
10. vgchange -a y /dev/vg01
11. cp /etc/fstab.back /etc/fstab
12. mountall

Rory
There are a 100 ways to do things and 97 of them are right