Operating System - HP-UX
1838469 Members
3115 Online
110126 Solutions
New Discussion

Re: How to setup a new VG with Backup data

 
SOLVED
Go to solution
Henry Chua
Super Advisor

How to setup a new VG with Backup data

Hi All,

I have this problem with one of my HFS LV. This LV spans between 2 PVs. The LV seems to be corrupted and I will like to delelte the LV and recreate it using my backup data. I am a newbie in this UX and will seriously need help.

The current lvdisplay produce this:
the lvdisplay produce this:
"PV Name /dev/dsk/c0t6d0
LV Name LE of LV PE for LV
/dev/vg09/stand 12 12
/dev/vg09/root 150 150
/dev/vg09/swap 32 32
/dev/vg09/dump 32 32
/dev/vg09/opt 110 110
/dev/vg09/usr 100 100
/dev/vg09/tmp 25 25
/dev/vg09/var 33 33
/dev/vg09/lvcustomer 17 17

PV Name /dev/dsk/c0t5d0
/dev/vg09/lvcustomer 511 511"

as you can see some of the LV reside in PV c0t6d0. How can I
1. Delete the old lvcustomer
2. Create a new empty lvcustomer with the exact allocation as above. and
3. Dump the data I store in with "tar" into the it?
Anyway I dunno if these are workable..

Can anyone advise me?
13 REPLIES 13
Steven E. Protter
Exalted Contributor

Re: How to setup a new VG with Backup data

backup the data if here is any

lvremove /dev/vg09/lcustomer

lvcreate -C n -n /dev/vg09/lcustomer
lvextend -L /dev/vg09/lcustomer /dev/dsk/c0t5d0
newfs -F vxfs /dev/vg09/rlcustomer




I don't know how you backed up your data. If there is any data, I'd use fbackup to back it up. You can then restore from there.

If you have a tarfile someplace that will work.

NOTICE: the process I've given you is destructive.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Todd McDaniel_1
Honored Contributor

Re: How to setup a new VG with Backup data

Your procedure sounds rational. to delete the LVOL is not harmful since it is not part of your OS.

Question, do you have this FS mirrored? you only show 1 PV. Are there 2 other mirrored disks?


IF you have room on c050td0, One thing you might consider is to create a new LVOL now before you destroy the current one. and try to restore the data to the new LVOL, and a new mountpoint.

Then when you are sure the data is restored, delete the old LVOL and remount to the original mountpoint.
Unix, the other white meat.
Sridhar Bhaskarla
Honored Contributor

Re: How to setup a new VG with Backup data

Hi Henry,

To recreate the filesystem, all you have to do is to run 'newfs' Since you want this to be a HFS filesystem do

newfs -F hfs /dev/vg09/rlvcustomer
Then mount it and restore the data.

However, if /dev/dsk/c0t5d0 is free (other than lvcustomer itself), then I suggest you create a new VG out of it and restore lvcustomer on it.

#pvdisplay -v /dev/dsk/c0t5d0
(make sure lvcustomer is only the LV on it)
#lvremove /dev/vg00/lvcustomer
#vgreduce vg00 /dev/dsk/c0t5d0
#pvremove /dev/rdsk/c0t5d0
#mkdir /dev/vg01
#mknod /dev/vg01/group c 64 0x010000
#pvcreate /dev/rdsk/c0t5d0
#vgcreate -s 8 vg01 /dev/dsk/c0t5d0
#lvcreate -n lvcustomer -l 528 vg01
#newfs -F hfs /dev/vg01/rlvcustomer
#mount /dev/vg01/lvcustomer /wherever_it_it

(update /etc/fstab for this entry)

Restore the data

This way you have the OS filesystems and the application filesystems seperate. You don't have to worry about application data if you have do any OS related maintenances such as upgrade/recovery etc.,

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Henry Chua
Super Advisor

Re: How to setup a new VG with Backup data

Hi Guys, Thanks for your advises..

How can I make sure that the created LV will have the same allocation as above. Is it possible to span the LV as per what it was?
(as in 17 PE c0t5d0 and 511 in c0t6d0)
Yes I have backup the data on a tape using "tar".

There are only 2 PVs :
1.PV Name /dev/dsk/c0t6d0
2.PV Name /dev/dsk/c0t5d0
Unfortunately I do not think I'll have enuff space in my c0t5d0..

Can I ask wat do u mean by "do you have this FS mirrored"

please forgive me if any of my queries appear foolish..

Thanks again guys for your help!!
Sridhar Bhaskarla
Honored Contributor

Re: How to setup a new VG with Backup data

Hi Henry,

If you do a 'pvdisplay /dev/dsk/c0t5d0' and take note of "TOTAL PE". If they are equal or more than 528, then you can create a new VG as you will be needing 528 extents to create lvcustomer filesystem. That is only the case if you used that filesystem to 100%. If it was used only 50% before, then all you need would be around 300 extents and you can create the filesystem entirely on c0t5d0 itself.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Todd McDaniel_1
Honored Contributor

Re: How to setup a new VG with Backup data

I HOPE your vg00 OS disks are mirrored... IF Your root disk failes your box will be in big trouble. You should have vg00 mirrored.


I suspect it is mirrored b/c of the error message you are getting... since VG00 should be mirrored. The error you get is typical of a mirrored disk where strict allocation is enforced to prevent you from mirroring to the same disk. In such cases as you have now.


I see only two choices, that is to get another 27GB disk or have your current disk sliced up into 2 even 13.5GB slices on the SAN side. Then you can mirror it that way since it will be 2 different devices...


IF I were you I might get some local adivce from your Hardware folks and another admin who knows your particular system.

Also, dont forget you can call HP for support if you have a contract for that, they can at least provide tech support over the phone.


-------------------------------------------
You can check mirroring by running:

lvdisplay /dev/vg09/lvcustomer




Look at mirror copies it will be 0 or 1 most likely.

# lvdisplay /dev/vg00/root
--- Logical volumes ---
LV Name /dev/vg00/root
VG Name /dev/vg00
LV Permission read/write
LV Status available/syncd
Mirror copies 1
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 252
Current LE 63
Allocated PE 126
Stripes 0
Stripe Size (Kbytes) 0
Bad block off
Allocation strict/contiguous
IO Timeout (Seconds) default
Unix, the other white meat.
Henry Chua
Super Advisor

Re: How to setup a new VG with Backup data

Hi Sri,

Thanks for your advises..
Can I Check with u something...
from your advise..
#lvremove /dev/vg00/lvcustomer -is this suppose to romove lvcustomer from vg09?

#vgreduce vg00 /dev/dsk/c0t5d0 -what does this command does?

....
#pvremove /dev/rdsk/c0t5d0
#mkdir /dev/vg01
#mknod /dev/vg01/group c 64 0x010000
#pvcreate /dev/rdsk/c0t5d0
#vgcreate -s 8 vg01 /dev/dsk/c0t5d0
#lvcreate -n lvcustomer -l 528 vg01 - can you roughly explain what all hese commands are for?

#mount /dev/vg01/lvcustomer /wherever_it_it
this is to mount lvcustomer to? "where_it_it" what should this path be?

And if the harddisk itself is smaller than 528.. how can I create a vg to used both harddisk...

Again I apologise for the trouble.. Many thanks!!
Sundar_7
Honored Contributor

Re: How to setup a new VG with Backup data

Henry,

Since you are a newbie, I think I need to ask you this question :-) : How did you figure out the LV is corrupted ?

Did you try running fsck on the filesystem ?

If you do really believe the filesystem is corrupted, this is how you can go abotu creating the LV

As noted by Sri, you need to just newfs to recreate the filesystem

1) umount /dev/vg09/lvcustomer
newfs -F hfs -o largefiles /dev/vg09/rlvcustomer
mount /dev/vg09/lvcustomer


But if you are planning to remove the LV and recreate it

umount /dev/vg09/lvcustomer
lvremove /dev/vg09/lvcustomer
lvcreate -n lvcustomer /dev/vg09
lvextend -l 17 /dev/vg09/lvcustomer /dev/dsk/c0t6d0
lvextend -l 528 /dev/vg09/lvcustomer /dev/dsk/c0t5d0
newfs -F hfs -o largefiles /dev/vg09/rlvcustomer
mount /dev/vg09/lvcustomer


By using two seperate lvextend, you can recreate the LV with the same allocation.

--Sundar.
Learn What to do ,How to do and more importantly When to do ?
Todd McDaniel_1
Honored Contributor

Re: How to setup a new VG with Backup data

lvremove will remove that LVOL from your system...

vgremove will remove the disk, but be wary, you may have other Lvols on that disk.

run pvdisplay -v /dev/dsk/c0t5d0 and see what else is on that disk.


I would be very careful in removing a disk unless you are sure it is unused by any LVOL.



I would again strongly suggest you get some advice from HP or from a local admin if you have access to one.

This can be awkward posting back and forth, but I am glad to do so, if you wish.
Unix, the other white meat.
Sridhar Bhaskarla
Honored Contributor

Re: How to setup a new VG with Backup data

OK.

There are two choices.

1. Recreate the filesystem with the same configuration.

newfs -F hfs /dev/vg09/rlvcustomer
mount /dev/vg09/lvcustomer /customer

(/customer is the directory where that logical volume used to be mounted. 'grep lvcustomer /etc/fstab should give you that information).

2. Recreate the filesystem but in a different VG by taking out c0t5d0 completely out of vg09. Instead of vg09, I mentioned vg00. You will need to replace vg00 with vg09 in that procedure. To explain the steps.

#lvremove /dev/vg09/lvcustomer

Above will remove lvcustomer from vg09

#vgreduce vg09 /dev/dsk/c0t5d0

This will take out the disk from vg09 so that you can create another volume group with it.

#pvremove /dev/rdsk/c0t5d0

The above will re-initialize the disk.

#mkdir /dev/vg01
#mknod /dev/vg01/group c 64 0x010000

The above two steps will create directory structure needed to create a volume group. 0x010000 is called minor number. It should be unique on the system. TO find out if it is already used, do ll /dev/*/group. You will find similar group files per each vg. Pick up a new one in that sequence if 0x010000 is already used. Similarly, if vg01 is already used, make it a new one say vg10.

#pvcreate /dev/rdsk/c0t5d0

This will create fresh LVM structures on the disk.

#vgcreate vg01 /dev/dsk/c0t5d0

It will create the vg with default extent size. Ignore -s option in the previous message.

#lvcreate -n lvcustomer -l 528 vg01

This will create a logical volume lvcustomer with 528 extents. An extent is of 4MB. So the size will be 528*4=2112 MB

#newfs -F hfs /dev/vg01/rlvcustomer

This will create file system upon the logical volume so that you can mount it.

#mount /dev/vg01/lvcustomer /wherever_it_is

You will need to mount the logical volume on a directory (mount point) so that you can restore the data. If it was mounted on /apps or something then replace /wherever_it_is with /apps)

If you think procedure 2 is too much for you, simply follow procedure 1 as there are only two steps.

-Sri
(gasping)
You may be disappointed if you fail, but you are doomed if you don't try
Henry Chua
Super Advisor

Re: How to setup a new VG with Backup data

Hi all,

Thanks to your valuable advise I have managed to recreate the LV with Success... but is it normal to get a "lost+found" in the directory "customer" thereafter...

Once again.. you guys have been a great help thanks!!
Peter Leddy_1
Esteemed Contributor
Solution

Re: How to setup a new VG with Backup data

Hi Henry,

The lost+found directory is meant to be there, you should see one at the root of each filesystem. fsck uses it for any problem files/directories when it checks a filesystem. If you do "man fsck" or
"man mklost+found" it should give you more information.

HTH,

Peter
Henry Chua
Super Advisor

Re: How to setup a new VG with Backup data

Thanks to youe invaluable advise, I was able to create the VG with the exact allocation I needed..

Many thanks to all that have chipped in.. especially Sri and Daniel for their relentless effort!

thanks!