前言:
前期项目需要部署多套AIX环境下RAC集群,之前很少接触AIX系统,上来被创建逻辑卷等基本命令打脸了,其实网上搜下资料很多,总结一下,也是方便自己日后查阅。
创建逻辑卷
1.查看所有磁盘设备
# lsdev -Cc disk
hdisk0 Available 50-T1-01 Huawei XSG1 FC Disk Drive
hdisk1 Available 50-T1-01 Huawei XSG1 FC Disk Drive
hdisk2 Available 50-T1-01 Huawei XSG1 FC Disk Drive
hdisk3 Available 50-T1-01 Huawei XSG1 FC Disk Drive
hdisk4 Available 50-T1-01 Huawei XSG1 FC Disk Drive
hdisk5 Available 50-T1-01 Huawei XSG1 FC Disk Drive
hdisk6 Available 50-T1-01 Huawei XSG1 FC Disk Drive
hdisk7 Available 50-T1-01 Huawei XSG1 FC Disk Drive
hdisk8 Available 50-T1-01 Huawei XSG1 FC Disk Drive
hdisk9 Available 50-T1-01 Huawei XSG1 FC Disk Drive
hdisk10 Available 50-T1-01 Huawei XSG1 FC Disk Drive
hdisk11 Available 50-T1-01 Huawei XSG1 FC Disk Drive
hdisk12 Available 50-T1-01 Huawei XSG1 FC Disk Drive
hdisk13 Available 50-T1-01 Huawei XSG1 FC Disk Drive
hdisk14 Available 50-T1-01 Huawei XSG1 FC Disk Drive
hdisk15 Available 50-T1-01 Huawei XSG1 FC Disk Drive
hdisk16 Available 50-T1-01 Huawei XSG1 FC Disk Drive
批注:其中hdisk0是本地存储,hdisk1-13是数据库的共享存储,hdisk14-16是后期申请挂载的共享存储用于OGG数据同步存储路径和数据库备份用的
2.查看磁盘大小
# bootinfo -s hdisk14
819200
# bootinfo -s hdisk15
# bootinfo -s hdisk16
3.创建PV,用户数据库的备份和OGG数据同步 hdisk14-16
# chdev -a pv=yes -l hdisk14
# chdev -a pv=yes -l hdisk15
# chdev -a pv=yes -l hdisk16
4.创建卷组vg
# mkvg -y vgbackup hdisk14 hdisk15 hdisk16
# lsvg vgbackup
5.创建逻辑卷LV --分配2T空间
# mklv -t jfs2 -y lvbackup vgbackup 2000
# crfs -v jfs2 -d lvbackup -m /oracle -p 'rw' -a logname='INLINE'
6.查看挂载点 --查看VG中LV分配情况以及对应的文件系统
# lsvg -l vgbackup
# mount /oracle
# chown -R oracle.dba /oracle
批注:设置开机自动挂载,这点很重要,修改/etc/filesystems配置文件,mount yes
补充:
1.查看卷组以及卷组详细信息
# lsvg -o
vgbackup
rootvg
# lsvg rootvg
VOLUME GROUP: rootvg VG IDENTIFIER: 00fa363400004c0000000154ec43ceef
VG STATE: active PP SIZE: 256 megabyte(s)
VG PERMISSION: read/write TOTAL PPs: 799 (204544 megabytes)
MAX LVs: 256 FREE PPs: 592 (151552 megabytes)
LVs: 12 USED PPs: 207 (52992 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
PV RESTRICTION: none INFINITE RETRY: no
DISK BLOCK SIZE: 512 CRITICAL VG: no
FS SYNC OPTION: no
批注:这里对创建新逻辑卷有用的信息是PP SIZE free PPS 我们看到PP大小是256M,还有592个PP未分配给逻辑卷(151552M空闲空间)
2.创建逻辑卷
首先查看卷组所在的盘:
# lsvg -p rootvg
rootvg:
PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
hdisk0 active 799 592 159..103..10..160..160
创建逻辑卷:
--查看使用的文件系统类型
# lsvg -l rootvg
# mklv -y'lv_oracle' -t'jfs2' rootvg 400 hdisk0 --创建100G
格式化文件系统:
# /usr/sbin/crfs -v jfs2 -d 'lv_oracle' -m '/app' -A yes -p rw
File system created successfully.
104854196 kilobytes total disk space.
New File System size is 209715200
挂载:
# mount /app
查看刚刚指定的挂载路径
# df -sg /app
Filesystem GB blocks Free* %Used Iused %Iused Mounted on
/dev/lv_oracle 100.00 99.98 1% 4 1% /app
查看/etc/filesystems中/app的挂载信息:
/app:
dev = /dev/lv_oracle
vfs = jfs2
log = /dev/hd8
mount = true
options = rw
account = false
逻辑卷扩容
当oracle的安装目录不足时,登录oracle数据库的时候提示设备空间不足,提示如下:
oracle@s1p2[/oracle/dumpfile]$sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Nov 14 17:44:09 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-09817: Write to audit file failed.
IBM AIX RISC System/6000 Error: 28: No space left on device
Additional information: 12
ORA-01075: you are currently logged on
逻辑卷扩容:
# lsvg -lp rootvg
rootvg:
PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
hdisk0 active 799 328 159..39..00..00..130
# chfs -a size=+50G /dev/fslv00 --扩充50G
扩容后查看:
# df -sg /app
Filesystem GB blocks Free* %Used Iused %Iused Mounted on
/dev/fslv00 100.00 49.68 51% 69126 1% /app
转子<https://blog.51cto.com/secdata/1872789>