Advertisements

Tag Archives: lvdisplay

Shrinking ext4 filesystem

I’m creating a new volume group with 3 10GB disks

root@linux:~ # pvcreate /dev/sdc
Physical volume “/dev/sdc” successfully created
root@linux:~ # pvcreate /dev/sdd
Physical volume “/dev/sdd” successfully created
root@linux:~ # pvcreate /dev/sde
Physical volume “/dev/sde” successfully created

root@linux:~ # vgcreate appvg /dev/sdc /dev/sdd /dev/sde
Volume group “appvg” successfully created

root@linux:~ # vgs appvg
VG #PV #LV #SN Attr VSize VFree
appvg 3 0 0 wz–n- 29.99g 29.99g

Creating a new 25GB logical volume

root@linux:~ # lvcreate -L 25g -n applv appvg
Logical volume “applv” created.

Creating a filesystem

root@linux:~ # mkfs -t ext4 /dev/appvg/applv
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1638400 inodes, 6553600 blocks
327680 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
200 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

Mounting the filesystem

root@linux:~ # mkdir /app

root@linux:~ # mount /dev/appvg/applv /app

root@linux:~ # df -hP /app
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/appvg-applv 25G 44M 24G 1% /app

I will remove the disk /dev/sde from the volume group. 25GB logical volume will shrink to 20GB.

Checking which disks the logical volume is using

root@linux:~ # lvdisplay -m /dev/mapper/appvg-applv
— Logical volume —
LV Path /dev/appvg/applv
LV Name applv
VG Name appvg
LV UUID 9tofzm-1zBU-DfbM-nmws-lqj7-QULb-U4Reqh
LV Write Access read/write
LV Creation host, time centos6.setaoffice.com, 2017-06-29 16:53:18 -0300
LV Status available
# open 1
LV Size 25.00 GiB
Current LE 6400
Segments 3
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:6

— Segments —
Logical extents 0 to 2558:
Type linear
Physical volume /dev/sdc
Physical extents 0 to 2558

Logical extents 2559 to 5117:
Type linear
Physical volume /dev/sdd
Physical extents 0 to 2558

Logical extents 5118 to 6399:
Type linear
Physical volume /dev/sde
Physical extents 0 to 1281

Checking Total PE to calculate logical volume

root@linux:~ # pvdisplay /dev/sdc
— Physical volume —
PV Name /dev/sdc
VG Name appvg
PV Size 10.00 GiB / not usable 4.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 2559
Free PE 0
Allocated PE 2559
PV UUID ZnR27c-LPaE-0ZQa-t0Hc-yWLf-v06d-et7fb5

root@linux:~ # pvdisplay /dev/sdd
— Physical volume —
PV Name /dev/sdd
VG Name appvg
PV Size 10.00 GiB / not usable 4.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 2559
Free PE 0
Allocated PE 2559
PV UUID OZY6w8-fUq6-wbPE-ILcr-LwOP-AeaS-j2qd9E

Resizing logical volume

root@linux:~ # lvresize -l 5118 -r /dev/appvg/applv
fsck from util-linux-ng 2.17.2
/dev/mapper/appvg-applv: 11/1638400 files (0.0% non-contiguous), 146849/6553600 blocks
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/mapper/appvg-applv to 5240832 (4k) blocks.
The filesystem on /dev/mapper/appvg-applv is now 5240832 blocks long.

Size of logical volume appvg/applv changed from 25.00 GiB (6400 extents) to 19.99 GiB (5118 extents).
Logical volume applv successfully resized.

Checking which disks the logical volume is using

root@linux:~ # lvdisplay -m /dev/mapper/appvg-applv
— Logical volume —
LV Path /dev/appvg/applv
LV Name applv
VG Name appvg
LV UUID 9tofzm-1zBU-DfbM-nmws-lqj7-QULb-U4Reqh
LV Write Access read/write
LV Creation host, time centos6.setaoffice.com, 2017-06-29 16:53:18 -0300
LV Status available
# open 0
LV Size 19.99 GiB
Current LE 5118
Segments 2
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:6

— Segments —
Logical extents 0 to 2558:
Type linear
Physical volume /dev/sdc
Physical extents 0 to 2558

Logical extents 2559 to 5117:
Type linear
Physical volume /dev/sdd
Physical extents 0 to 2558

Removing disk from volume group and label from physical volume

root@linux:~ # vgreduce appvg /dev/sde
Removed “/dev/sde” from volume group “appvg”

root@linux:~ # pvremove /dev/sde
Labels on physical volume “/dev/sde” successfully wiped

Advertisements

HP-UX HPOM The module VOLMON has detected an inconsistence between the number of LV and the number of current LV. Please make some UX expert verify this inconsistence due there is a risk of data corruption

Node : hpux.setaoffice.com
Node Type : Itanium 64/32(HTTPS)
Severity : major
OM Server Time: 2015-12-01 23:50:35
Message : UXMON: The number of Open LV and Current LV is different for VG: /dev/vgEP0_bc.
Msg Group : OS
Application : volmon
Object : LV
Event Type : NONE
Instance Name : NONE
Instruction : The module VOLMON has detected an inconsistence between the number of LV and the number of current LV. Please make some UX expert verify this inconsistence due there is a risk of data corruption

Checking the volume group

root@hp-ux:~ # vgdisplay vgEP0_bc
— Volume groups —
VG Name /dev/vgEP0_bc
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 27
Open LV 26
Max PV 40
Cur PV 15
Act PV 11
Max PE per PV 50000
VGDA 22
PE Size (Mbytes) 16
Total PE 91253
Alloc PE 91253
Free PE 0
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0
VG Version 1.0
VG Max Size 31250g
VG Max Extents 2000000

Checking all logical volumes from the volume group vgEP0_bc

root@hp-ux:~ # vgdisplay -v vgEP0_bc | grep “LV Name” | awk ‘{print “lvdisplay -v “$3” | grep -v disk”‘}
lvdisplay -v /dev/vgEP0_bc/lv11202 | grep -v disk
lvdisplay -v /dev/vgEP0_bc/lvDVEBMGS00 | grep -v disk
lvdisplay -v /dev/vgEP0_bc/lvNOVELL_RemoteLoader | grep -v disk
lvdisplay -v /dev/vgEP0_bc/lvSCS01 | grep -v disk
lvdisplay -v /dev/vgEP0_bc/lvSYS | grep -v disk
lvdisplay -v /dev/vgEP0_bc/lvconfig | grep -v disk
lvdisplay -v /dev/vgEP0_bc/lvdesenvolvimentos | grep -v disk
lvdisplay -v /dev/vgEP0_bc/lvdrlocalfs | grep -v disk
lvdisplay -v /dev/vgEP0_bc/lvinterf | grep -v disk -> Problemas
lvdisplay -v /dev/vgEP0_bc/lvinterface | grep -v disk
lvdisplay -v /dev/vgEP0_bc/lvol26 | grep -v disk
lvdisplay -v /dev/vgEP0_bc/lvora10264 | grep -v disk
lvdisplay -v /dev/vgEP0_bc/lvora11204 | grep -v disk
lvdisplay -v /dev/vgEP0_bc/lvoraarch | grep -v disk
lvdisplay -v /dev/vgEP0_bc/lvoracle | grep -v disk
lvdisplay -v /dev/vgEP0_bc/lvoracli | grep -v disk
lvdisplay -v /dev/vgEP0_bc/lvput | grep -v disk
lvdisplay -v /dev/vgEP0_bc/lvreorg | grep -v disk
lvdisplay -v /dev/vgEP0_bc/lvsapmnt | grep -v disk
lvdisplay -v /dev/vgEP0_bc/lvsapmntWDP | grep -v disk
lvdisplay -v /dev/vgEP0_bc/lvstage | grep -v disk
lvdisplay -v /dev/vgEP0_bc/lvtrans | grep -v disk
lvdisplay -v /dev/vgEP0_bc/lvtransARCH | grep -v disk
lvdisplay -v /dev/vgEP0_bc/lvusrsapWDP | grep -v disk
lvdisplay -v /dev/vgEP0_bc/lvusrsapdaa | grep -v disk
lvdisplay -v /dev/vgEP0_bc/lvusrsaptmp | grep -v disk

Checking the logical volume with -v to display more verbose I checked that PE1 column is showing question marks. The disk needs to be replaced and this logical volume recreated

root@hp-ux:~ # lvdisplay -v /dev/vgEP0_bc/lvinterf | grep -v disk | more
— Logical volumes —
LV Name /dev/vgEP0_bc/lvinterf
VG Name /dev/vgEP0_bc
LV Permission read/write
LV Status available/syncd
Mirror copies 0
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 614400
Current LE 38400
Allocated PE 38400
Stripes 0
Stripe Size (Kbytes) 0
Bad block on
Allocation strict
IO Timeout (Seconds) default

— Distribution of logical volume —
PV Name LE on PV PE on PV

— Logical extents —
LE PV1 PE1 Status 1
08750 ??? 15952 current
08751 ??? 15953 current
08752 ??? 15954 current
08753 ??? 15955 current
08754 ??? 15956 current
08755 ??? 15957 current
08756 ??? 15958 current

Resizing filesystem online on HP-UX

Resizing filesystem online on HP-UX

Check the volume group and logical volume being used by the filesystem

root@hp-ux:/root # bdf /example
Filesystem kbytes used avail %used Mounted on
/dev/vg01/lvol14 32768 2141 28720 7% /example

This logical volume has 32MB and uses 2 PE

root@hp-ux:/root# lvdisplay /dev/vg01/lvol14
— Logical volumes —
LV Name /dev/vg01/lvol14
VG Name /dev/vg01
LV Permission read/write
LV Status available/syncd
Mirror copies 0
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 32
Current LE 2
Allocated PE 2
Stripes 0
Stripe Size (Kbytes) 0
Bad block on
Allocation strict
IO Timeout (Seconds) default
Each PE has 16MB and there is 1047 available

root@hp-ux:/root# vgdisplay vg01
— Volume groups —
VG Name /dev/vg01
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 16
Open LV 16
Max PV 40
Cur PV 2
Act PV 2
Max PE per PV 50000
VGDA 4
PE Size (Mbytes) 16
Total PE 12796
Alloc PE 11749
Free PE 1047
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0
VG Version 1.0
VG Max Size 31250g
VG Max Extents 2000000

Checking if it is possible to resize online the filesystem. In some HP-UX versions, this feature is not available

root@hp-ux:/root# swlist -l product | grep -i jfs
AONLINEJFS B.05.01.02 OnlineJFS 5.0.1 Integration Product
JFS B.11.31 Base VxFS File System 4.1 for HP-UX
OnlineJFS01 5.0.31.6 Online features of the VxFS File System

Extending filesystem to 5120MB

root@hp-ux:/root# lvextend -L 5120 /dev/vg01/lvol14
Logical volume “/dev/vg01/lvol14” has been successfully extended.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.conf

Increased logical volume to 320 PE adn 5120MB

root@hp-ux:/root# lvdisplay /dev/vg01/lvol14
— Logical volumes —
LV Name /dev/vg01/lvol14
VG Name /dev/vg01
LV Permission read/write
LV Status available/syncd
Mirror copies 0
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 5120
Current LE 320
Allocated PE 320
Stripes 0
Stripe Size (Kbytes) 0
Bad block on
Allocation strict
IO Timeout (Seconds) default

Now running fsadm to increase the filesystem

root@hp-ux:/root# fsadm -F vxfs -b 5120m /example
UX:vxfs fsadm: INFO: V-3-25942: /dev/vg01/rlvol14 size increased from 32768 sectors to 5242880 sectors

root@hp-ux:/root# bdf /example
Filesystem kbytes used avail %used Mounted on
/dev/vg01/lvol14 5242880 3417 4912004 0% /example

%d bloggers like this: