AIX 磁盘命令
每个磁盘有一个唯一的PVID,PVID存储在ODM中,他们被LVM命令引用,并可能被外部使用,如HACMP引用。通过赋予一块可用的磁盘设备一个PVID,该磁盘变成了物理卷PV;
root@testdb:/# ls -al /dev/*disk*
brw------- 1 root system 23, 1 Aug 08 14:33 /dev/hdisk0
brw------- 1 root system 23, 2 Aug 08 14:33 /dev/hdisk1
brw------- 1 root system 23, 0 Aug 18 21:43 /dev/hdisk2
brw------- 1 root system 23, 3 Aug 08 14:33 /dev/hdisk3
crw------- 2 root system 23, 1 Aug 08 14:33 /dev/rhdisk0
crw------- 1 root system 23, 2 Aug 08 14:33 /dev/rhdisk1
crw------- 1 root system 23, 0 Aug 18 21:56 /dev/rhdisk2
crw------- 1 root system 23, 3 Aug 18 21:57 /dev/rhdisk3
给磁盘加PVID
root@testdb:/var/spool/cron/atjobs# chdev -l hdisk2 -a pv=yes
hdisk2 changed
root@testdb:/# lspv
hdisk0 0007388ca583b447 rootvg active
hdisk1 0007388ca7a889a1 rootvg active
hdisk2 000b0856ec68f5de None
hdisk3 none None
(物理卷无PVID,不能使用,要使用一个物理卷,需将其设置一个卷组中)
为物理卷清除PVID
root@testdb:/var/spool/cron/atjobs# chdev -l hdisk2 -a pv=clear
hdisk2 changed
root@testdb:/var/spool/cron/atjobs# chdev -l hdisk3 -a pv=clear
hdisk3 changed
root@testdb:/var/spool/cron/atjobs# lspv
hdisk0 0007388ca583b447 rootvg active
hdisk1 0007388ca7a889a1 rootvg active
hdisk2 none None
hdisk3 none None
物理卷的可用性
root@testdb:/var/spool/cron/atjobs# lsvg -p rootvg
rootvg:
PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
hdisk0 active 546 365 109..38..00..109..109
hdisk1 active 546 411 110..83..00..109..109
======卷组相关命令=====
安装系统时系统缺省的创建了一个rootvg的卷组;另外的卷组可以在其他没有分配给卷组的一块或多块磁盘上创建;卷组是物理硬盘的集合,是存储分配的最大单位,每个系统最多有256个卷组;
#lsvg //查看当前所有的卷组;
#root@testdb:/# lsvg -o //查看当前所有活动的卷组
rootvg
normal 和big vg 物理分区PP的大小:为2的N次方>=PV尺寸/1016
root@testdb:/# lsvg rootvg
VOLUME GROUP: rootvg VG IDENTIFIER: 000b08560000d70000000147b7501511
VG STATE: active PP SIZE: 256 megabyte(s)
VG PERMISSION: read/write TOTAL PPs: 1092 (279552 megabytes)
MAX LVs: 256 FREE PPs: 776 (198656 megabytes)
LVs: 12 USED PPs: 316 (80896 megabytes)
OPEN LVs: 11 QUORUM: 2 (Enabled)
TOTAL PVs: 2 VG DESCRIPTORS: 3
STALE PVs: 0 STALE PPs: 0
ACTIVE PVs: 2 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
PV RESTRICTION: none INFINITE RETRY: no
创建卷组
root@testdb:/# smit mkvg
Add a Volume Group
Move cursor to desired item and press Enter.
Add an Original Volume Group
Add a Big Volume Group
Add a Scalable Volume Group
root@testdb:/# lsvg -p testvg //列出卷组中的物理卷
testvg:
PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
hdisk2 active 546 546 110..109..109..109..109
root@testdb:/# lsvg -o
testvg
rootvg
root@testdb:/# varyoffvg testvg //关闭卷组
root@testdb:/# lsvg -o
rootvg
root@testdb:/# varyonvg testvg //激活卷组
root@testdb:/# lsvg -o
testvg
rootvg
root@testdb:/# extendvg testvg hdisk3 //把一个磁盘加入到卷组中
0516-1398 extendvg: The physical volume hdisk3, appears to belong to
another volume group. Use the force option to add this physical volume
to a volume group.
0516-792 extendvg: Unable to extend volume group.
root@testdb:/# lspv
hdisk0 0007388ca583b447 rootvg active
hdisk1 0007388ca7a889a1 rootvg active
hdisk2 000b0856ec68f5de testvg active
hdisk3 000b0856eede6bdd None
root@testdb:/# extendvg -f testvg hdisk3
root@testdb:/# lspv
hdisk0 0007388ca583b447 rootvg active
hdisk1 0007388ca7a889a1 rootvg active
hdisk2 000b0856ec68f5de testvg active
hdisk3 000b0856eede6bdd testvg active
root@testdb:/# lsvg -p testvg
testvg:
PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
hdisk2 active 546 546 110..109..109..109..109
hdisk3 active 546 546 110..109..109..109..109
root@testdb:/# reducevg testvg hdisk3 //从卷组中删除一个磁盘,
root@testdb:/# lsvg -p testvg
testvg:
PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
hdisk2 active 546 546 110..109..109..109..109
root@testdb:/#
root@testdb:/# reducevg testvg hdisk2 //当去除最后一个磁盘时,这个VG 也会被删除;其中的LV和JFS一同被删除;
ldeletepv: Volume Group deleted since it contains no physical volumes.
root@testdb:/# lsvg -o
rootvg
逻辑卷的物理分布
root@testdb:/# lspv -l hdisk2
hdisk2:
LV NAME LPs PPs DISTRIBUTION MOUNT POINT
lv5 10 10 00..10..00..00..00 N/A
root@testdb:/#
逻辑卷在PV上的分布
root@testdb:/# lslv -l lv5
lv5:N/A
PV COPIES IN BAND DISTRIBUTION
hdisk2 010:000:000 100% 000:010:000:000:000