Operating System - HP-UX
1834802 Members
2455 Online
110070 Solutions
New Discussion

Re: removing old volume groups and logical volumes

 
SOLVED
Go to solution
William Shaw
Frequent Advisor

removing old volume groups and logical volumes

I work in a lab where we are constantly attaching drives, testing something, then detaching the drives. The upshot is that I have a system (HP 11.00) with a bunch of invalid volume group information. A 'strings' of the lvmtab file shows a number of volume groups and corresponding disk device files that are no longer attached to the system. When attempting lvremove or pvremove I always get errors that there are still logical volumes on this vg, or there are still vg's on this disk. so... how can I clean up my system and simply erase all of the lingering information for drives and volumes that no longer exist?

thanks!
8 REPLIES 8
Denver Osborn
Honored Contributor

Re: removing old volume groups and logical volumes

The fastest way to rid your system of the non-existant volume groups would be to export them.

# vgexport /dev/vg_name

This will remove their entry from the /etc/lvmtab and the directory under /dev.

-denver
Ajitkumar Rane
Trusted Contributor

Re: removing old volume groups and logical volumes

Yes you vgexport will work very fine. Also just FYI you can move the old /etc/lvmtab file to /etc/lvmtab.xyz and do a vgscan this should create a new /etc/lvmtab with the information of the VGs which have Physical volumes attached to it.Verify the new /etc/lvmtab.

Good luck.
Amidsts difficulties lie opportunities
Paula J Frazer-Campbell
Honored Contributor

Re: removing old volume groups and logical volumes

Hi Willian

Have a look at "man vgscan", I would suggest vgscan -pv first but make sure you are aware that the order of the disks may change if you then do a vgscan -apv.


Paula
If you can spell SysAdmin then you is one - anon
Paula J Frazer-Campbell
Honored Contributor

Re: removing old volume groups and logical volumes

William ensure that you backup lvmtab prior to changes.

;-)

Paula
If you can spell SysAdmin then you is one - anon
Wieslaw Krajewski
Honored Contributor
Solution

Re: removing old volume groups and logical volumes

Hi,

It seems in fact that the best what you should do is use vgscan command. But exactly try the following steps:

1. move lvmtab somwhere
2. remove all unnecessary /dev/vgXX directories with
group file in it, if such directories exist. Leaving them
to unexpected results.
3. issue vgscan command
Permanent training makes master
Vincenzo Restuccia
Honored Contributor

Re: removing old volume groups and logical volumes

Try with SAM.
Andreas D. Skjervold
Honored Contributor

Re: removing old volume groups and logical volumes

Hi
During a recreate of a vg I experienced problems related to major and minor numbers in use, even tough no trace where found in any files.
According to HP-tech this was due to storing of the major and minor numbers in use in the kernel loaded in memory.
Reboot to get rid of these, or as I did use new numbers in the group creation.

Just a tip.

Andreas
Only by ignoring what everyone think is important, can you be aware of what everyone ignores!
William Shaw
Frequent Advisor

Re: removing old volume groups and logical volumes

Thanks for all the help, folks!

I did a 'vgexport' for each of the old, non-existant groups. For some of them whose group file had already been removed manually (and therefore vgexport wouldn't work), I just recreated the file with 'mknod' and then issued vgexport command again, and that worked great... next time I'll try deleting all /dev/vg* directories and then issue vgscan. According to above answers, this should also yield the same result.