Operating System - HP-UX
1834166 Members
2765 Online
110064 Solutions
New Discussion

creating a logical volumen on specified physical volume?

 
SOLVED
Go to solution
golfnut
Frequent Advisor

creating a logical volumen on specified physical volume?

Is this possible.

i have a vg with multiple pv. I want to create a lv on a specific disk.
And then mirror to another specific disk.

I was looking at lvcreate and looks like it does not have an option like that.
I am thinking there must be a way to do this.

Obviously new to HP-UX.

thanks

9 REPLIES 9
Bill Hassell
Honored Contributor
Solution

Re: creating a logical volumen on specified physical volume?

Generally, lvols can be laid out without regard to the PV but there is a way to do this. Create the lvol without any length. Then use lvextend to extend the zero-length to the size you want and specify the PV path you want to use. Then use lvextend -m 1 and specify the PV for the mirror extents.


Bill Hassell, sysadmin
Devender Khatana
Honored Contributor

Re: creating a logical volumen on specified physical volume?

Hi,
For your convience commands you need to follow :-
I am assuming your disk /dev/dsk/cztzdz is allready added to your VG /dev/vg0x And all Logical extents of disk are free. Verify it by pvdisplay command
#lvcreate /dev/vg0x
#lvextend -L ??? /dev/vg0x/lvolx /dev/dsk/cztzdz

Precaution should be taken while giving Size in MB's. It should not be more than Physical disk size otherwise it throughs an error.

#newfs -F ???? -o ???? /dev/dsk/lvolx

Put a entry in /etc/fstab

HTH,
Devender
Impossible itself mentions "I m possible"
bhavin asokan
Honored Contributor

Re: creating a logical volumen on specified physical volume?

The following commands create a 500MB large LV named lvdata on any disk(s) of the VG
vg01:
# lvcreate -n lvdata -L 500 vg01

You cannot specify a PV with lvcreate. If you like to put the LV on a certain PV use the
following:
# lvcreate -n lvdata vg01
this creates a LV of 0MB. It has no extents - it just exists. Now extend the LV onto a certain
disk:
# lvextend -L 500 /dev/vg01/lvdata /dev/dsk/c4t2d0
Now you can use newfs to put a FS onto the LV:
# newfs -F /dev/vg01/rlvdata

regds,
golfnut
Frequent Advisor

Re: creating a logical volumen on specified physical volume?

Thanks for your respone.

What is the best way of copying filesystems in HP-UX?

I am going to be creating a new usr an new var file systems. I want to then copy the usr and var to these new file systems and then make the change in fstab.

thanks

Bill Hassell
Honored Contributor

Re: creating a logical volumen on specified physical volume?

Just for clarification, here are the steps:

1. Pick your VG, in this example I'll use vg01. Pick the disk path you want to use. To see what is available in the VG, use: vgdisplay -v vg01 which shows the physical disk paths at the end. For mirroring you should have a minimum of two disks in the VG. We'll use /dev/dsk/c2d6t0 as the target disk and c2d5t0 as the mirror:

2. lvcreate vg01
(That's all you need. The next unused lvol name will be assigned automatically and the size will be zero. We'll assume that lvcreate made the lvol: /dev/vg01/lvol3

3. lvextend -L 500 /dev/vg01/lvol3 /dev/dsk/c2d6t0

4. Now the lvol exists with a size of 500 megs on the c2d6d0 disk. Since you want to mirror this disk, you can do that now before you create a filesystem on it. It doesn't matter which comes first, mirror or create filesystem. Specify a different disk for the mirror:

lvextend -m 1 /dev/vg01/lvol3 /dev/dsk/c2d5t0

If you can see the disk lights, you'll see them both flashing as the lvol is synced.

5. To see what your lvol looks like, you can run lvdisplay -v /dev/vg01/lvol3 after step 3 and then step 4. You'll see each extent and where the extent resides.

6. Run newfs to create a filesystem. The default should be VxFS but just to be sure, specify the filesystem type:

newfs -F vxfs -o largefiles /dev/vg01/rlvol3

NOTE: LVM commands can refer to the lvol or rlvol device but newfs must always use the raw (character mode) device file which is the lvol name with r in front. The -o largefiles will allow the creation of files larger than 2Gb.

7. Create a mount point: mkdir /mnt1 (or whatever you'd like to call it) then edit /etc/fstab to add the new mountpoint:

/dev/vg01/lvol3 /mnt1 vxfs nosuid,largefiles,rw,delaylog 0 3

nosuid is recommended for all mountpoints except specific HP-UX mountpoints. largefiles is needed to enable the largefile support on the lvol. rw and delaylog are standard options.

8. Now test the fstab entry by mounting the mountpoint: mount /mnt1

9. Verify that it exists: bdf /mnt1

And that's it.


Bill Hassell, sysadmin
golfnut
Frequent Advisor

Re: creating a logical volumen on specified physical volume?

thanks for the reponse guys.

All the exisiting file systems on this server are hfs. I dont know why?

Are there any issues moving them to vxfs?

uname -a give the following.
HP-UX ux01pwow B.11.00 A 9000/800 658349303 two-user license

thanks



Fabio Ettore
Honored Contributor

Re: creating a logical volumen on specified physical volume?

Hi,

check that your system has JFS installed and configured.
For this launch:

swlist -l fileset -a state | grep -i jfs

Up today I cannot find systems with all hfs filesystems, your is for museum :-)

I don't see problems to migrate them to vxfs. Of course you should backup your system.


For example a your hfs filesystem is test on logical volume /dev/vgXX/lvol1, then:

umount /test
newfs -F vxfs /dev/vgXX/rlvol1
fsck -F vxfs /dev/vgXX/lvol1
mount /dev/vgXX/lvol1 /test

restore from a your previous backup.

By the way if all your filesystems of system are hfs then I should re-install completely your system, I thonk it is for more safe.

Mind to have only /stand filesystem in hfs type.

Best regards,
Fabio
WISH? IMPROVEMENT!
Steve White_7
Advisor

Re: creating a logical volumen on specified physical volume?

When creating logical volumes you should use the default names. If the default names are not used and you ever have to vgimport, you are not going to have a nice time on a big system.
Bill Hassell
Honored Contributor

Re: creating a logical volumen on specified physical volume?

HFS is a good filesystem but has limitations on maximum filesystem and file size (128Gb), and in case you accidently lose power or you have a system crash, the fsck time is VERY long for multi-gigabyte filesystems (dozens of minutes). I would not convert existing HFS filesystems to VxFS on a production machine...HFS is quite stable, although it is a bit slower than VxFS for directory and disk space changes.

he safe and fastest way to convert everything (except /stand which must always be HFS) is to use Ignite/UX. Download the latest version from http://software.hp.com and run make_tape_recovery to backup vg00. I'd also make an fbackup copy of your entire system. Then restore the Ignite/UX image but modify the disk layout to VxFS. At the same time, you can resize any of the lvols.


Bill Hassell, sysadmin