msgbartop
Tips and Tricks site for advanced HP-UX Engineers
msgbarbottom

29 Oct 14 Puzzle of the day. Strict logical volume prevents you from extending a filesystem

Thanks to Veerappan Dhandapani of HCL Technologies for bringing me this problem

You have 50 GB free in the volume group.

You try to extend the logical volume and you cant.

Basics:

1) bdf is the tool for measuring filesystem size not logical volume size

2)lvdisplay is the tool for measuring logical volume size.

Steps:

1) Extend the logical volume. That is why the previous two number points are important. In process after extending the logical volume size the lv size and file system size are not equal

2) Extend the file system.

root@mybox# vgdisplay -v vgdata | grep -i “Free PE”
Free PE 1784
Free PE 511
Free PE 0
Free PE 0
Free PE 0
Free PE 0
Free PE 1273
Free PE 0

root@mybox# lvdisplay /dev/vgdata/lv_prod_datastaging
— Logical volumes —
LV Name /dev/vgdata/lv_prod_datastaging
VG Name /dev/vgdata
LV Permission read/write
LV Status available/syncd
Mirror copies 0
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 245760
Current LE 7680
Allocated PE 7680
Stripes 0
Stripe Size (Kbytes) 0
Bad block on
Allocation PVG-strict
IO Timeout (Seconds) default

root@mybox# lvextend -L 278528 /dev/vgdata/lv_prod_datastaging
lvextend: Not enough free physical extents available.

The problem here is the allocation policy.

lvchange -C n -s n /dev/vgdata/lv_prod_datastaging

See the man page for details. -C is for contiguous -s is for strict allocation.

We changed both to n(o).

Off camera we extended the logcal volume

lvdisplay /dev/vgdata/lv_prod_datastaging

— Logical volumes —
LV Name                     /dev/vgdata/lv_prod_datastaging
VG Name                     /dev/vgdata
LV Permission               read/write
LV Status                   available/syncd
Mirror copies               0
Consistency Recovery        MWC
Schedule                    parallel
LV Size (Mbytes)            302848
Current LE                  9464
Allocated PE                9464
Stripes                     0
Stripe Size (Kbytes)        0
Bad block                   on
Allocation                  non-strict
IO Timeout (Seconds)        default

We get the size from the logical volume size to feed into the Online JFS extend command so we do not have to do math.

fsadm -F vxfs -b 302848m /prod/datastaging

bdfmegs is Bill Hassell’s new and improved bdf

/var/adm/bin/bdfmegs /prod/datastaging
File-System                      Mbytes    Used   Avail %Used Mounted on
/dev/vgdata/lv_prod_datastaging   310.1g  215.7g   94.0g  70% /prod/datastaging

 

 

Tags: , , , , , , ,

07 Jun 12 awk trick of the day(month?) parsing bdf output. awk with if else logic

Ever try and do system reporting based on bdf?

Annoying as all heck that sometimes the output is two line and sometimes one? I was forced to solve that problem today.

 

if [ “$OS” = “HP-UX” ]
then
   dcmd=bdf
fi

arraypointer=0

exec $dcmd | egrep -v “%used|/dev/deviceFileSystem” | awk ‘{lvn=$1;v=$2;if (v==””) {getline;cap=$1;ucap=$2;acap=$3;puse=$4;mp=$5;printf “%s %s %s %s %s %s\n”, lvn,cap,ucap,acap,puse,mp} else {printf “%s %s %s %s %s %s\n”, $1,$2,$3,$4,$5,$6} }’ | while read -r  p1 p2 p3 p4 p5 p6
do

   #### calculations

done

Typical bdf output:

/dev/vg00/lvol9    4096000 3140019  896285   78% /var/adm/crash
/dev/vg_stgb1/lvol1
1572765696 1382813225 178080447   89% /steven05stgb

More when the script is done

Tags: , , , ,

WhatsApp chat