Rabu, 02 Mei 2018

How to extend AIX file system df lsvg chfs

  Tidak ada komentar

Summary

df -k [FILESYSTEM] to find out existing filesystem usage and LV for that filesystem
lslv [LVNAME] to find out VG for that LV
lsvg [VGNAME] to find out how many PPs are free
chfs -a size=[size setting] [FILESYSTEM]to grow the filesystem

If your chfs command above errors out with 0516-787 extendlv: Maximum allocation for logical volume LVNAME is NUMBER, then you need to: chlv -x [num] [lvname]

df -k [FILESYSTEM] to see changes made


Our /home directory reached 90%

# df -k /home
Filesystem 1024-blocks Free %Used Iused %Iused Mounted on
/dev/hd1 2097152 218780 90% 25894 30% /home
#

Do we have enough space available in VG to expand?

Find out the VG.

# lslv hd1
LOGICAL VOLUME: hd1 VOLUME GROUP: rootvg
LV IDENTIFIER: 0007b8420000d9000000011f2491100e.8 PERMISSION: read/write
VG STATE: active/complete LV STATE: opened/syncd
TYPE: jfs2 WRITE VERIFY: off
MAX LPs: 512 PP SIZE: 128 megabyte(s)
COPIES: 1 SCHED POLICY: parallel
LPs: 20 PPs: 20
STALE PPs: 0 BB POLICY: relocatable
INTER-POLICY: minimum RELOCATABLE: yes
INTRA-POLICY: center UPPER BOUND: 32
MOUNT POINT: /home LABEL: /home
MIRROR WRITE CONSISTENCY: on/ACTIVE
EACH LP COPY ON A SEPARATE PV ?: yes
Serialize IO ?: NO
#

How much space is available in the VG?

# lsvg rootvg
VOLUME GROUP: rootvg VG IDENTIFIER: 0007b8420000d9000000011f2491100e
VG STATE: active PP SIZE: 128 megabyte(s)
VG PERMISSION: read/write TOTAL PPs: 599 (76672 megabytes)
MAX LVs: 256 FREE PPs: 282 (36096 megabytes)
LVs: 13 USED PPs: 317 (40576 megabytes)
OPEN LVs: 11 QUORUM: 2 (Enabled)
TOTAL PVs: 1 VG DESCRIPTORS: 2
STALE PVs: 0 STALE PPs: 0
ACTIVE PVs: 1 AUTO ON: yes
MAX PPs per VG: 32512
MAX PPs per PV: 1016 MAX PVs: 32
LTG size (Dynamic): 256 kilobyte(s) AUTO SYNC: no
HOT SPARE: no BB POLICY: relocatable
#

Use chfs command to expand

Examples

chfs -a size=3G /home
chfs -a size=3000M /home
chfs -a size=+1G /home
chfs -a size=+500M /home

What those mean

The “M” stands for megabytesThe “G” stands for gigabytesThe “+” is relative sizing: change the current amount by adding this muchWithout the “+” is absolute sizing: change the current amount TO this muchNOTE: You can use “-” to decrease a filesystem size. Generally speaking for LVs, it is harder to shrink a filesystem. Sometimes it cannot be done while the filesystem is mounted, and sometimes depending on fragmentation it may not be able to be done at all. I have found AIX to be more robust in this department than various Linux LVM implementations. Generally speaking, though, when you increase your filesystem size, it is best to think of it as permanent .. (for the most part).

From the chfs man page …

If Value has the M suffix, it is interpreted to be in Megabytes. If Value has a G suffix, it is interpreted to be in Gigabytes. If Value begins with a +, it is interpreted as a request to increase the file system size by the specified amount. If the specified size is not evenly divisible by the physical partition size, it is rounded up to the closest number that is evenly divisible.

My example.. Change to absolute size 2.5G or 2500M

# df -k /home
Filesystem 1024-blocks Free %Used Iused %Iused Mounted on
/dev/hd1 2097152 218780 90% 25894 30% /home
# chfs -a size=2500M /home
Filesystem size changed to 5242880
# df -k /home
Filesystem 1024-blocks Free %Used Iused %Iused Mounted on
/dev/hd1 2621440 742988 72% 25894 13% /home
#

If chfs errors with 0516-787: extendlv: Maximum allocation (etc)…

If you get an error like:

0516-787 extendlv: Maximum allocation for logical volume vg01vol1
is 512.

This means that you have hit the limit on the LV of how large you can make it.

The first time I hit this error I almost had a heart attack. Fortunately, you can extend this very easily either using chlvor smitty

In this example I was trying to expand my LV (mydatalv01) to 600 PPs and the limit was 512 PPs

# chlv -x 600 mydatalv01

After that you can then do your chfs command

# chfs -a size=+25G /mydata01

In smitty:

smitty chlv -> Change a Logical Volume -> [ENTER] -> LOGICAL VOLUME name -> [F4]

And from there you can change LV properties.

DONE!

Tidak ada komentar :

Posting Komentar