在AIX上增加文件系统空间

显示活动的卷组

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
dhdev01 / # lsvg -o
bkvg
vg01
vg02
rootvg
列出对应的物理卷
dhdev01 / # lsvg -p rootvg
rootvg:
PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
hdisk0 active 546 111 00..00..00..02..109
dhdev01 / # lsvg -p vg01
vg01:
PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
hdisk1 active 546 135 00..00..00..26..109
dhdev01 / # lsvg -p vg02
vg02:
PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
hdisk2 active 546 109 00..00..00..00..109


dhdev01 / # ls -al /dev/rootvg
crw-rw---- 1 root system 10, 0 Dec 19 2003 /dev/rootvg

显示卷组的基本信息

1
2
3
4
5
6
7
8
9
10
11
12
13
dhdev01 / # lsvg rootvg
VOLUME GROUP: rootvg VG IDENTIFIER: 00585c0f00004c00000000f98e1e377f
VG STATE: active PP SIZE: 128 megabyte(s)
VG PERMISSION: read/write TOTAL PPs: 546 (69888 megabytes)
MAX LVs: 256 FREE PPs: 111 (14208 megabytes)
LVs: 16 USED PPs: 435 (55680 megabytes)
OPEN LVs: 13 QUORUM: 2
TOTAL PVs: 1 VG DESCRIPTORS: 2
STALE PVs: 0 STALE PPs: 0
ACTIVE PVs: 1 AUTO ON: yes
MAX PPs per PV: 1016 MAX PVs: 32
LTG size: 128 kilobyte(s) AUTO SYNC: no
HOT SPARE: no BB POLICY: relocatable

显示该卷组存在的所有逻辑卷

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
dhdev01 / # lsvg -l rootvg
rootvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
hd5 boot 1 1 1 closed/syncd N/A
hd6 paging 32 32 1 open/syncd N/A
hd8 jfslog 1 1 1 open/syncd N/A
hd4 jfs 3 3 1 open/syncd /
hd2 jfs 88 88 1 open/syncd /usr
hd9var jfs 8 8 1 open/syncd /var
hd3 jfs 22 22 1 open/syncd /tmp
hd1 jfs 8 8 1 open/syncd /home
hd10opt jfs 3 3 1 open/syncd /opt
lg_dumplv sysdump 8 8 1 open/syncd N/A
lv00 jfs 148 148 1 open/syncd /u01
lv01 jfs 24 24 1 open/syncd /u02
lv02 jfs 24 24 1 open/syncd /oradisk
dh jfs 32 32 1 open/syncd /dh
loglv03 jfs2log 1 1 1 closed/syncd N/A
fslv00 jfs2 32 32 1 closed/syncd /cd0

显示所有物理卷的基本信息

1
2
3
4
5
dhdev01 / # lspv
hdisk0 00585c0f8e1e2d11 rootvg active
hdisk1 00585c0f746525a4 vg01 active
hdisk2 00585c0f545aca55 vg02 active
hdisk3 00585c0f418e185b bkvg active

显示某个物理卷的基本信息

1
2
3
4
5
6
7
8
9
10
11
dhdev01 / # lspv hdisk0
PHYSICAL VOLUME: hdisk0 VOLUME GROUP: rootvg
PV IDENTIFIER: 00585c0f8e1e2d11 VG IDENTIFIER 00585c0f00004c00000000f98e1e377f
PV STATE: active
STALE PARTITIONS: 0 ALLOCATABLE: yes
PP SIZE: 128 megabyte(s) LOGICAL VOLUMES: 16
TOTAL PPs: 546 (69888 megabytes) VG DESCRIPTORS: 2
FREE PPs: 111 (14208 megabytes) HOT SPARE: no
USED PPs: 435 (55680 megabytes)
FREE DISTRIBUTION: 00..00..00..02..109
USED DISTRIBUTION: 110..109..109..107..00

显示该物理卷上存在的所有逻辑卷

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
dhdev01 / # lspv -l hdisk0
hdisk0:
LV NAME LPs PPs DISTRIBUTION MOUNT POINT
hd5 1 1 01..00..00..00..00 N/A
lv00 148 148 53..43..17..35..00 /u01
dh 32 32 32..00..00..00..00 /dh
lv02 24 24 24..00..00..00..00 /oradisk
hd6 32 32 00..32..00..00..00 N/A
lg_dumplv 8 8 00..08..00..00..00 N/A
lv01 24 24 00..16..08..00..00 /u02
hd2 88 88 00..10..65..13..00 /usr
hd8 1 1 00..00..01..00..00 N/A
hd4 3 3 00..00..01..02..00 /
hd9var 8 8 00..00..04..04..00 /var
hd3 22 22 00..00..06..16..00 /tmp
hd1 8 8 00..00..06..02..00 /home
hd10opt 3 3 00..00..01..02..00 /opt
loglv03 1 1 00..00..00..01..00 N/A
fslv00 32 32 00..00..00..32..00 /cd0

如果卷组内只有一个物理卷,那么卷组内的逻辑卷信息和物理卷内的逻辑卷信息是一致的。

显示物理卷中的每个物理分区(outer edge, outer middle, center, inner middle, inner edge)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
dhdev01 / # lspv -p hdisk1
hdisk1:
PP RANGE STATE REGION LV NAME TYPE MOUNT POINT
1-32 used outer edge db jfs /dh/db
33-36 used outer edge rdhdev_test2 raw N/A
37-74 used outer edge testdb jfs /test
75-110 used outer edge rdhdev_test raw N/A
111-190 used outer middle db jfs /dh/db
191-191 used outer middle loglv00 jfslog N/A
192-219 used outer middle patch jfs /opt/patch
220-223 used center patch jfs /opt/patch
224-261 used center testdb2 jfs /test2
262-281 used center db jfs /dh/db
282-287 used center patch jfs /opt/patch
288-328 used center db jfs /dh/db
329-409 used inner middle db jfs /dh/db
410-410 used inner middle lv03 raw N/A
411-411 used inner middle rawtest raw N/A
412-437 free inner middle
438-546 free inner edge

显示某个逻辑卷的信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
dhdev01 / # lslv hd1
LOGICAL VOLUME: hd1 VOLUME GROUP: rootvg
LV IDENTIFIER: 00585c0f00004c00000000f98e1e377f.8 PERMISSION: read/write
VG STATE: active/complete LV STATE: opened/syncd
TYPE: jfs WRITE VERIFY: off
MAX LPs: 512 PP SIZE: 128 megabyte(s)
COPIES: 1 SCHED POLICY: parallel
LPs: 8 PPs: 8
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
dhdev01 / # df -g
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 0.38 0.23 40% 3349 2% /
/dev/hd2 11.00 2.45 78% 108362 4% /usr
/dev/hd9var 1.00 0.48 52% 816 1% /var
/dev/hd3 2.75 1.87 33% 10855 2% /tmp
/dev/hd1 1.00 0.46 55% 4222 2% /home
/proc - - - - - /proc
/dev/hd10opt 0.38 0.17 56% 3987 5% /opt
/dev/lv00 18.50 2.15 89% 97608 3% /u01
/dev/lv01 3.00 0.70 77% 36 1% /u02
/dev/lv02 3.00 2.91 4% 17 1% /oradisk
/dev/dh 4.00 2.56 36% 69153 7% /dh
/dev/db 31.75 18.40 43% 57 1% /dh/db
/dev/patch 4.75 0.26 95% 7607 1% /opt/patch
/dev/piers 4.38 0.92 80% 27870 3% /piers
/dev/piersdb 12.50 1.44 89% 55 1% /piers/db
/dev/uatbkup 19.75 19.03 4% 30 1% /piers/db/uatbkup
/dev/dailybkup 9.88 7.33 26% 2450 1% /piers/dailybkup
/dev/dbbkuplv 40.00 13.42 67% 91429 3% /dbbkup

PP SIZE * PPs(128 megabyte(s) * 8) == 1024M
表示逻辑卷hd1(Filesystem: /dev/hd1, Mounted on: /home)有1.00 GB blocks

查看逻辑卷在物理卷上的分布

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
dhdev01 / # lslv -l hd1
hd1:/home
PV COPIES IN BAND DISTRIBUTION
hdisk0 008:000:000 75% 000:000:006:002:000


dhdev01 / # lslv -m hd1
hd1:/home
LP PP1 PV1 PP2 PV2 PP3 PV3
0001 0225 hdisk0
0002 0241 hdisk0
0003 0242 hdisk0
0004 0309 hdisk0
0005 0310 hdisk0
0006 0311 hdisk0
0007 0336 hdisk0
0008 0413 hdisk0
dhdev01 / # lspv -p hdisk0|grep /home
225-225 used center hd1 jfs /home
241-242 used center hd1 jfs /home
309-311 used center hd1 jfs /home
336-336 used inner middle hd1 jfs /home
413-413 used inner middle hd1 jfs /home

说明:
DISTRIBUTION(000:000:006:002:000) 表示center有6个物理分区(对应第1-6的逻辑分区),inner middle有2个物理分区(对应7-8的逻辑分区)
COPIES(008:000:000) 表示第一个物理卷上有8个物理分区,没有第二和第三的拷贝分区
IN BAND(75%) 表示center[6] / center[6] + inner middle[2] = 0.75

增加某个文件系统的空间

  1. df -g | grep /home 查看/home所属的逻辑卷,假设是hd1
  2. lslv -l hd1 查看hd1所属的物理卷,假设是hdisk0
  3. lspv -p hdisk0 查看物理卷的可用空间
  4. smitty chfs 或者 chfs -a size=+10G /home
  5. 如果执行上述命令时出现问题:Maximum allocation for logical volume hd1,运行命令
    chlv -x 800 hd1 或 smitty chlv 或 smitty lv
    Please refer to how-to-expand-a-filesystem-in-aix-df-lsvg-chfs or practical-guide-to-aix-logical-volume-management
  6. extendlv与chfs是很接近的,但增加文件空间需要用chfs,不要用extendlv,因为extendlv会扩大逻辑分区,但不能反映的文件空间上的。

参考:

http://www.web-manual.net/aix/0516-787-extendlv-maximum-allocation-for-logical-volume-hd11admin-is-512/
http://wenku.baidu.com/view/f02cac4533687e21af45a960.html
http://unix.ittoolbox.com/groups/technical-functional/ibm-aix-l/in-band-in-lslv-l-1110087
http://unix.ittoolbox.com/groups/technical-functional/ibm-aix-l/increasing-the-filesystem-size-2639934
http://www.tek-tips.com/viewthread.cfm?qid=1150552
http://www.unix.com/aix/25249-increase-logical-partition.html

In-band解释

http://unix.ittoolbox.com/groups/technical-functional/ibm-aix-l/in-band-in-lslv-l-1110087
http://pic.dhe.ibm.com/infocenter/powersys/v3r1m5/index.jsp?topic=/iphcg/lslv.htm
http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14532561

extendlv与chfs的区别

http://networktechnologist.com/tips-aix-lvm.html
http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds2/extendlv.htm