################################################################
################################################################
################################################################
pvcreate – create physical volume for use in LVM volume group
vgcreate – create LVM volume group
# pvcreate /dev/rdsk/c5t10d0
# mkdir /dev/vg01
# mknod /dev/vg01/group c 64 0x010000
# check with ll /dev/*/group
# vgcreate /dev/vg01 /dev/dsk/cxtydz # with options.
or more the one disk
vgcreate /dev/vg01 /dev/dsk/cxtydz /dev/dsk/cxtydx
lvcreate – create logical volume in LVM volume group.
lvextend – increase space, increase mirrors for LVM logical volume.
Create LV
# lvcreate -n lvol1 /dev/vg01,
# lvextend -L 200 /dev/vg01/lvol1
——————————–
# takes care of everything
lvcreate -L 1024 -n lvol1 -m 1 /dev/vg01
newfs – construct a new file system
Create Filesystem
# newfs -F vxfs /dev/vg01/rlvol1
# newfs -F vxfs -o largefiles /dev/vg01/rlvol1
# mkdir /mymountpoint
# mount /dev/vg01/lvol1 -/mymountpoint
Make sure you add an entry to /etc/fstab
e.g
/dev/vg01/lvol1 /mymountpoint vxfs rw,suid,delaulog,datainlog 0 2
vgcreate options:
/usr/sbin/vgcreate [-f] [-A autobackup] [-x extensibility] [-e max_pe]
[-l max_lv] [-p max_pv] [-s pe_size] [-g pvg_name] vg_name pv_path …
lvcreate options:
/usr/sbin/lvcreate [-A autobackup] [-c mirror_consistency]
[-C contiguous] [-d schedule] [-D distributed] [-i stripes -I stripe_size] [-l le_number | -L lv_size]
[-m mirror_copies] [-M mirror_write_cache] [-n lv_name][-p permission] [-r relocate] [-s strict] vg_name
lvextend options:
/usr/sbin/lvextend [-A autobackup] {-l le_number | -L lv_size | -m mirror_copies} lv_path
[pv_path … | pvg_name …]
################################################################
################################################################
################################################################
If you’re asking how to add 5 more disks to the existing VG – then use vgextend as follows
vgextend /dev/vg_name /dev/dsk/c1t2d0 /dev/dsk/c1t2d1 /dev/disk/c1t2d2 /dev/dsk/c1t2d3 /dev/dsk/c1t2d4
This will add these five disks to /dev/vg_name
If you’re asking how to initially create a VG with 13 disks then I would suggest using a for loop. First create the VG with the first disk:
vgcreate /dev/vg_name /dev/dsk/c1t2d0
Then create a file with the remaining 12 disks – let’s call it disk_in – containing the following
c1t2d1
c1t2d2
c1t2d3
c1t2d4
c1t2d5
c1t2d6
c1t2d7
c1t3d0
c1t3d1
c1t3d2
c1t3d3
c1t2d4
Then run the following command:
for i in $(cat disk_in)
do
vgextend /dev/vg_name /dev/dsk/$i
done
That will loop through the disk devices adding each as it goes.
Of course you could also specify *all* 13 in the vgcreate command or creat it with the first & run vgextend 12 more times. But the for loop is the easiest way to do it.
#!/bin/sh
FILE=disk.file
for disk in $(cat $FILE)
do
#pvcreate -f /dev/rdsk/$disk
vgextend /dev/oraedm01_vg /dev/dsk/$disk
done
################################################################
################################################################
################################################################
Mirror Filesystem Non Root
Initialize the disk and add it to vg00:
# pvcreate [-f] /dev/rdsk/c1t6d0
# vgextend vg01 /dev/dsk/c1t6d0
Mirror the LVs using lvextend:
/sbin/lvextend -m 1 /dev/vg00/rleonlv /dev/dsk/c3t2d0
* /usr/sam/lbin/vginfo -l /dev/vg00/leonlv -t LVM
################################################################
################################################################
################################################################
remove lv
* /usr/sam/lbin/vginfo -l /dev/vg00/leonlv -t LVM
umount /dev/vg00/rleonlv
remove /dev/vg00/rleonlv from /etc/fstab
/sbin/lvremove -f /dev/vg00/leonlv
remove pv
pvremove
this will remove the whole volume group config.
################################################################
DELETE VG:
vgchane -a n vgname
Preview:
vgexport -p -m /tmp/vgu00.map vgu00
Export destructive:
vgexport -m /tmp/vgu00.map vgu00
################################################################
################################################################
################################################################
##########
Extend FS with onlineJFS
swlist -l product | grep -i jfs
The ‘-b’ option to fsadm will accept the size in MB as long as you add a ‘m’ or ‘M’ to the end of the size.
#/sbin/fstyp /dev/vg00/lvol7
#lvextend -L 20480 /dev/vg00/lvol9
#fsadm -F vxfs -b 20480M /opt/oracle
extend a fs No JFS ..
I am assuming that you got to single user mode by rebooting the box,
interrupting the boot process, entering boot pri ISL from the menu prompt,
and typing hpux -is from the ISL prompt.
/var is usually uses /dev/vg00/lvol7
This can be verified by doing a cat /etc/fstab
# /sbin/lvdisplay /dev/vg00/lvol7
This will return the size in MB that /var currently is.
# /sbin/lvextend -L <new_size_in_MB> /dev/vg00/lvol7
I will assume that /var is vxfs but this can be checked by doing the
following
# /sbin/fstyp /dev/vg00/lvol7
Note the return value.
#/sbin/extendfs -F <return_value_from_fstyp> /dev/vg00/rlvol7
#mount -a
#bdf
################################################################
################################################################
################################################################
break mirror
lvreduce -m 0 /dev/appsvg00/mfglv00
vgreduce /dev/vg00 /dev/dsk/c2t2d0
################################################################
################################################################
pvkeys
RE: 3215254612
FR: donald_myers
Removing mirrored lvols from a bad disk
Use the lvdisplay -v -k /dev/vg00/lvolname
look for the “pvkey” under the PV column.
Then run the lvreduce command :
lvreduce -k -m 0 /dev/vg00/lvolname pvkey_value
After freeing all the extents from all the lvols on this ghost disk then try to use the
vgreduce -f /dev/vg00
where is this pvkey_value?
Let me show you by example:
# lvdisplay -v /dev/vg02/lvol4
— Logical extents —
LE PV1 PE1 Status 1 PV2 PE2 Status 2
0000 /dev/dsk/c1t1d0 0513 current /dev/dsk/c1t2d0 0515 current
0001 /dev/dsk/c1t1d0 0514 current /dev/dsk/c1t2d0 0516 current
# lvdisplay -v -k /dev/vg02/lvol4
— Logical extents —
LE PV1 PE1 Status 1 PV2 PE2 Status 2
0000 0 0513 current 1 0515 current
0001 0 0514 current 1 0516 current
^
|——-|
The pvkey value in my example is 1, as noted here: |
so my command would look like this:
# lvreduce -k -m 0 /dev/vg02/lvol4 1 <—-this is the pk_key from above
/dev/appsvg00 /dev/dsk/c4t0d0
/dev/appsvg00/mfglv00
/dev/appsvg00/lvvartibco
/dev/appsvg00/hh3lv00
/dev/appsvg00/iwslv00
/dev/appsvg00/pipelv00
/dev/appsvg00/webhostlv00
/dev/appsvg00/marimbalv00
/dev/appsvg00/lvopttibco
/dev/appsvg00/orarmtlv00
/dev/appsvg00/schedlv00
/dev/appsvg00/bealv00
/dev/appsvg00/db2lv00
/dev/appsvg00/db2lv01
##################################
#################################
vgimports and exports
1. vgexport -p -v -s -m /tmp/vgsap01.map vgsap01
2. ftp the map file to the second node.
On the host where u need to import:
1. mkdir /dev/vgsap01
2. mknod /dev/vgsap01/group c 64 <use same the minor number as on the first node>
3.vgimport -s -m /tmp/vgsap01.map vgsap01.
—————————————–
1 backup the data – in case required.
2 vgexport -pv -s -m /tmp/vgxx.map /dev/vgxx
(If all ok here,then next step)
3 vgexport -vs -m /tmp/vgxx.map /dev/vgxx
5 mkdir /dev/vgxx
6 mknod /dev/vgxx/group c 64 0x010000 (uniq minor number)
7 vgimport -pvs -m /tmp/vgxx /dev/vgxx
(If allok, then)
8 vgimport -vs -m /tmp/vgxx /dev/vgxx
9 vgchange -a y /dev/vgxx
10 mount all lvols under it and check.
###
vgchange -a e /dev/vg01
lvextend -L 200 -m 1 /dev/vg01
vgexport -p -v -s -m vg01.map /dev/vg01
rcp vg01.map server2:/root/vg01.map
at server 2, you must export/remove all configuration at vg01.
1.deactivate vg01 at server2
2. vgexport vg01 ( remove conf vg01 from lvmtab )
3. mkdir /dev/vg01
4. mknod /dev/vg01/group c 64 0x010000
5. vgimport -v -s -m /root/vg01.map vg01
vgchange -a n /dev/appsvg00
##########
#########
The error is not for the fault in the disk but is for quorum which means that all the disks which are supposed to be there in the VG are not present.
The vg in such circumstances can be activated by bypassing the quorum check by
Quorum not present, or some physical volume(s) are missing.
#vgchange -a y -q n /dev/vg_whatever
##########
Reduce filesystem
Later versions of Online JFS afford you the best chance of success downsizing a filesystem. You don’t offer what version you have. However, you use:
# fsadm -b <newsize>M /mountpoint
On JFS version 3.1 this would often fail. Defragmenting the filesystem sometimes helped:
# fsadm -d -e -D -E /mountpoint
After a reduction of the filesystem, resize the logical volume that contains it with:
# lvreduce -L <newsize> /dev/vgXX/lvolN
If you cannot use ‘fsadm’ to reduce the size of filesystem, then: back it up’ use ‘newfs’ to resize an empty filesytem; use ‘lvreduce’ to downsize the logical volume containing it, and restore the filesystem’s data.
###########################################
vgimport -m appsvg00.map /dev/dsk//dev/dsk/c4t0d0
vgchange -a y -q n /dev/appsvg00
pvchange -a N /dev/dsk/cXtXdX (cXtXdX will either be c4t0d0 or c6t8d0)
Replace the hot-swappable disk.
vgcfgrestore n appsvg00 /dev/rdsk/cXtXdX
vgchange a y appsvg00
vgdisplay -v appsvg00
—–
vgsync vg00
-or-
lvsync /dev/vg00/lvol1
lvsync /dev/vg00/lvol3