LVM and VxVM
Showing results for 
Search instead for 
Did you mean: 

renaming /opt logical volume name

Regular Advisor

renaming /opt logical volume name

/opt is supposed to be lvol5

so is it in many vmhosts in our environment


but in one particular vm host /opt is lvol6


can i change this /opt to have lvol5?


if yes, pls guide me how?






P.S. This thread has been moved from HP-UX > System Administration to LVM and VxVM - HP Forum moderator

Patrick Wallek
Honored Contributor

Re: renaming /opt logical volume name

Is there anything currently using /dev/vg00/lvol5?


If not, then the following should work:


1) Reboot the server and come up in single-user mode


2) mount the /var, /usr and /tmp LVs


3) cd /dev/vg00


4) mv lvol6 lvol5


5) mv rlvol6 rlvol5

(edited to fix a typo...)


6) edit the /etc/fstab file so that your /opt line now uses /dev/vg00/lvol5


7) Reboot


If lvol5 is already in use by another LV, then you will have to use the same process to rename it.


Be careful to not make any typos anywhere as it could render your system unable to mount /opt  when you reboot.

Honored Contributor

Re: renaming /opt logical volume name

In the HP-UX default vg00 layout, lvol5 is /home and lvol6 is /opt.


If your vmhosts have /opt as lvol5, then where is /home on those systems?

(What does "bdf /home" report?)


If /home is part of the root filesystem on many of your vmhosts, that is not very good: users may accidentally fill the filesystem that contains their home directories. The root filesystem is usually rather small, so the risk is greater.

And if root filesystem fills to 100%, there is a risk that nobody can log in, until sysadmin logs in using the console and frees up some disk space.


Since /opt must always be a regular filesystem, its device name should only be referenced in /etc/fstab. Nothing else in the OS should require /opt to be a specific LV.


Changing it might be possible, but in my opinion, quite a lot of work for a very small benefit.


  1. If lvol5 is currently unused, extend it to the same size as lvol6. (If lvol5 is in use, you must first move its contents somewhere else.)
  2. mount lvol5 somewhere, e.g. /mnt
  3. copy everything from /opt to /mnt, preserving file permissions. For example, run "cd /opt; tar cf - | ( cd /mnt; tar xvf -)" as root.
  4. reboot the system to single user mode
  5. edit /etc/fstab to mount lvol5 instead of lvol6. Run "mount /opt" and make sure it works without errors.
  6. reboot again to verify that the system can successfully boot with the moved /opt.
  7. do whatever you want with the now-unused lvol6.

Alternatively, you could also create a map file for vg00, edit it to have the name "lvol5" for minor device #6, then boot the system to LVM maintenance mode, export vg00 and re-import it with the modified map file... but I don't recommend this, as it would break the symmetry between LVM device minor numbers and the lvol# names. In other words, it does not really fix the problem, only hides it a little deeper in the operating system configuration.

Dennis Handly
Acclaimed Contributor

Re: renaming /opt logical volume name

>5) mv rlvol6 rlvol6


This is probably one of the typos you warned about.  ;-)

You can edit your post with Post Options > Edit Reply

(You might also want to remove the double spacing.)

Patrick Wallek
Honored Contributor

Re: renaming /opt logical volume name

You are correct, Dennis!  Thanks for pointing that out.  It's now fixed.