Showing posts with label lvm. Show all posts
Showing posts with label lvm. Show all posts

Sunday, February 8, 2009

LVM for HP-UX

The following are an overview of how to
create volumes in LVM for HP-UX.

1) Add your disks, and verify their device
names. The the command:

# ioscan -fnC disk

2) Next, place the disks you wish to use for
volumes under LVM control. This
is done by converting a disk into
a "Physical Volume" (pv). The command
used is:

# pvcreate

example: #pvcreate /dev/rdsk/c1t0d0

Note: You can use the "-f" option
to "force" the creation, which keeps
LVM for asking for verification...
the "Would you like to proceed? (y/n)"

3) Now, create a device path for the volume group.
Do this by creating a directory in /dev
by the name of the volume group.

# mkdir /dev/

example: # mkdir /dev/vg01

4) Then create a "group node" in that directory.
The process looks like this:

# mknod /dev//group c 64

example: # mknod /dev/vg01/group c 64 0x030000

Note: The minor number follows the following patern:
0x030000
0x040000
0x050000
.....

5) You can now create your Volume Group (vg) to which
the Physical Volumes will be assigned. A VG
is similar to a Disk Group in Veritas. The
format is:

# vgcreate /dev/ ....

example: # vgcreate /dev/vg01 /dev/dsk/c1t0d0

Note: The PV DevPaths don't use a partition
designation (sX). You can specify as many PV's
to add to a VG as you like on this one line.

6) Next create a Logical Volume (lv). This is the "volume"
itself, which will contain the file system.

# lvcreate /dev/

example: # lvcreate /dev/vg01

Note: This will create a 0 length volume. It
will also create two new files in the vg dev
directory: lvol1 and rlvol1. Being: Logical
Volume 1, and Raw Logical Volume 1. You can
have multiple LV's per VG.

Note(2): lvcreate with no options will create
a concat volume. To create striped volumes,
use the options:
-i This is the Vx equiv to column numbers.
-I This is the Vx equiv to a stripe width in kb.
-m Number of mirrors. Can be "1" or "2".
-L The size of the new volume in megabytes.

7) Now you can extend to Logical Volume to the length
you desire. To extend to it's max, do the
following:

a) Run the command: # vgdisplay
example: # vgdisplay /dev/vg01

b) Look for the two lines: "Total PE" and "PE Size"
PE stands for "Physical Extent". If you
multiply the number of "Total PE" by
"PE Size" you will get the total size of
the disk that is usable, usually in megabytes.

NOTE: LVM breaks PV's into Physical Extents.
These are like blocks in LVM. PE Size is
the size of each PE. Total PE is the
number of PE's avalible to the volume group.
The "PE Size" is variable, default is "4M"
but it can be reset to any desired size,
during VG creation. The options avable to
"vgcreate" are:
-e Max Num of PE's for this VG. Default: 1016
Max PE cannot exceed: 65535
-l Max Num of LV's for this VG. Default: 255
-p Max Num of PV's for this VG. Default: 16
Max PV cannot exceed: 255
-s Size of each PE for this VG. Default: 4
PE Size must be a power of 2.
-x Can the VG be grown? Default: y

c) With the number you got by multiplying "Total PE" by "PE Size"
you have the total lenth of the VG. To make all disks
in the VG be used by 1 LV, and to use all the space,
extend the Logical Volume with the command:

# lvextend -L

example: # lvextend -L 3200 /dev/vg01/lvol1

This would extend VG01's LV 1 out to (NOT by) 3.2G.
Remember the size is defaulted to Megabytes.

8) You can now create your filesystem with:

# newfs -F

example: # newfs -F vxfs /dev/vg01/rlvol1

9) Now mount the filesystem like usual:

# mount /dev/vg01/lvol1 /mydatavolume

Done!

Monday, January 12, 2009

HP-UX LVM creation

ex. create /oracle/J1Q/sapdata13 under volume group vg_J1Q_04
using luns c14t1d4(primary) & c14t8d1(alternate)

-->check if fs existed
bdf /oracle/J1Q/sapdata13

--> check the latest disk report
cd /var/opt/soeg/rpt
ll *disk*

--> check for available luns
more 20080423diskinfo.rpt | grep -i lvm | grep -v "0(" | sort -u

-->compares the current hardware configuration (pairing of luns)
xpinfo -il | grep c12t0d1
xpinfo -il | grep 04:28

--> check if controller exists already
pvdisplay /dev/dsk/c14t8d1
pvdisplay /dev/dsk/c14t1d4
vgdisplay -v | grep -iE "c14t8d1|c12t0d1"

ll /dev/*/group | sort -u

-->create directory/device
mkdir /dev/vg_J1Q_04

-->create a character file type group
mknod /dev/vg_J1Q_04/group c 64 0x410000

-->initialize/format physical volume
pvcreate -f /dev/rdsk/c12t0d1

-->create volume group
vgcreate -e 10000 /dev/vg_J1Q_04 /dev/dsk/c12t0d1 /dev/dsk/c14t8d1
vgdisplay /dev/vg_J1Q_04

-->create logical volume
lvcreate -L 8624 -n lv_data13 /dev/vg_J1Q_04

-->construct the new file system
newfs -F vxfs -o largefiles /dev/vg_J1Q_04/rlv_data13

-->create directory
mkdir -p /oracle/J1Q/sapdata13

-->update /etc/fstab

--> mount created new directory
mount /oracle/J1Q/sapdata13

-->check file permission and ownership
chgrp oraj1q:dba sapdata13
chown oraj1q:dba sapdata13


note: the above syntax are derived from true to life experience
and im not liable in case you use it on a production box and
it didn't works. :-)

Monday, January 5, 2009

HP-UX reviewer 4

:: if you can't remove Volume Group w/ 'ghost' logical volume

# vgremove /dev/vg
vgremove: Volume group "/dev/vg" still contains a logical volume(s).
vgremove: Couldn't remove volume group "/dev/vg".

ans:

#vgchange -a n /dev/vg
#vgexport /dev/vg

your volume group will be removed from /etc/lvmtab..
It is equal to vgremove...tried it and it worked.

sa susunod ulit...ciao...

Sunday, January 4, 2009

HP-UX reviewer 3

:: NFS mounting

ex : mount directory /sapcd of sihp8080 to sihp8085

@sihp8080 -->
[root@sihp8080:/sapcd]
# bdf /sapcd
Filesystem kbytes used avail %used Mounted on
/dev/vg_sapcd2_temp/lv_sapcd2
106770432 54467240 51894584 51% /sapcd

[root@sihp8080:/sapcd]
# more /etc/exports | grep -i sapcd
/sapcd -root=sihp8085:sihp8086:sihp8087,access=sihp8085:sihp8086:sihp8087

[root@sihp8080:/sapcd]
# exportfs -av
re-exported /sapcd
re-exported /usr/sap/put

@sihp8085-->
[root@sihp8085:/sapcd]
#
bdf /sapcd
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lv_root 819200 179488 634768 22% /

[root@sihp8085:/sapcd]
# more /etc/fstab | grep -i sapcd
sihp8080:/sapcd /sapcd nfs rw,suid 0 0

[root@sihp8085:/sapcd]
# mount /sapcd

more to come....chalo
('lets go' in Hindi).

Thursday, January 1, 2009

HP-UX reviewer 2

....continued from my HP-UX kodigo....
  • Exporting and Importing disks across system.
1. make the volume group unavailable
vgchange -a n /dev/vgdata

2. Export the the disk while creating a logical volume map file.
vgexport -v -m data_map vgdata

3. Disconnect the drives and move to new system.
4. Move the data_map file to the new system.
5. On the new system recreate the volume group directory
mkdir /dev/vgdata
mknod /dev/vgdata/group c 64 0x02000

6. Import the disks to the new system
vgimport -v -m data_map /dev/vgdata /dev/dsk/c2t1d0 /dev/dsk/c2t2d0

7. Enable the new volume group
vgchange -a y /dev/vgdata
  • Renaming a logical volume
    /dev/vgdata/lvol1 -> /dev/vgdata/data_lv
umount /dev/vgdata/lvol1
ll /dev/vgdata/lvol1
take note of the minor ( e.g 0x010001 )
brw-r----- 1 root root 64 0x010001 Dec 31 17:59 lvol1
mknod /dev/vgdata/data_lv b 64 0x010001 create new logical volume name
mknod /dev/vgdata/rdata_lv c 64 0x010001
vi /etc/fstab { reflect the new logical volume }
mount -a
rmsf /dev/vgdata/lvol1
rmsf /dev/vgdata/rlvol1

to be continued.....

HP-UX reviewer

naks, kala nyo genius ako sa HP-UX? Kodigo ko lang ito in case of emergency..ito ung laman ng halo-halo.txt na naka-save sa lagi kong dala na vintage 128mb flash disk tuwing may duty ako.

HP-UX: Disk and Filesystem tasks
  • Search for attached disk
    ioscan -fnC disk
  • Initialize a disk for use with LVM
    pvcreate -f /dev/rdsk/c0t1d0
  • Create the device structure needed for a new volume group.
    cd /dev
    mkdir vgdata
    cd vgdata
    mknod group c 64 0x010000
  • Create volume group vgdata
    vgcreate vgdata /dev/dsk/c0t1d0
    { if your expecting to use more than 16 physical disks use the -p option, range from 1 to 256 disks. }
  • Display volume group vgdata
    vgdisplay -v vg01
  • Add another disk to volume group
    pvcreate -f /dev/rdsk/c0t4d0
    vgextend vg01 /dev/dsk/c0t4d0

  • Remove disk from volume group
    vgreduce vg01 /dev/dsk/c0t4d0
  • Create a 100 MB logical volume lvdata
    lvcreate -L 100 -n lvdata vgdata
    newfs -F vxfs /dev/vgdata/rlvdata
  • Extend logical volume to 200 MB
    lvextend -L 200 /dev/vgdata/lvdata
  • Extend file system to 200 MB

    :: NO online JFS installed
    fuser -ku /dev/vgdata/lvdata { kill all process that has open files on this volume. }
    umount /dev/vgdata/lvdata
    extendfs /data

    ::Online JFS {ex. 200 MB / 4 MB = 50 LE; 50 x 1024 = 51200 blocks }
    fsadm -F vxfs -b 51200 /data
  • Set largefiles to support files greater than 2GB
    fsadm -F vxfs -o largefiles /data

Paunawa:kung hindi maintindihan, magtanong sa katabing ofismate...more to come.