用命令行创建和挂载ACFS文件系统
Posted dingdingfish
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了用命令行创建和挂载ACFS文件系统相关的知识,希望对你有一定的参考价值。
创建和挂载ACFS文件系统
以下创建volumn并显示其信息,用grid用户执行:
ASMCMD> volcreate -G data -s 50G datavol01
ASMCMD> volinfo -G data datavol01
Diskgroup Name: DATA
Volume Name: DATAVOL01
Volume Device: /dev/asm/datavol01-146
State: ENABLED
Size (MB): 51200
Resize Unit (MB): 64
Redundancy: UNPROT
Stripe Columns: 8
Stripe Width (K): 1024
Usage:
Mountpath:
SQL>
col VOLUME_DEVICE for a40
SELECT volume_name, volume_device FROM V$ASM_VOLUME WHERE volume_name ='DATAVOL01';
VOLUME_NAME VOLUME_DEVICE
------------------------------ ----------------------------------------
DATAVOL01 /dev/asm/datavol01-146
mkfs不一定非用root执行,device file的ownership可以允许asmadmin,因此此处用grid用户执行,但oracle用户是不行的:
$ ls -l /dev/asm/datavol01-146
brwxrwx--- 1 root asmadmin 251, 74754 Oct 14 06:56 /dev/asm/datavol01-146
$ id oracle
uid=101(oracle) gid=1001(oinstall) groups=1001(oinstall),1006(asmdba),1003(dba),1002(dbaoper)
$ id grid
uid=102(grid) gid=1001(oinstall) groups=1001(oinstall),1006(asmdba),1005(asmoper),1004(asmadmin),1002(dbaoper)
$ id
uid=102(grid) gid=1001(oinstall) groups=1001(oinstall),1002(dbaoper),1004(asmadmin),1005(asmoper),1006(asmdba)
$ /sbin/mkfs -t acfs /dev/asm/datavol01-146
mkfs.acfs: version = 19.0.0.0.0
mkfs.acfs: on-disk version = 46.0
mkfs.acfs: volume = /dev/asm/datavol01-146
mkfs.acfs: volume size = 53687091200 ( 50.00 GB )
mkfs.acfs: Format complete.
注册ACFS文件系统,grid用户不行,改用root好了:
$ acfsutil registry -a /dev/asm/datavol01-146 /u02/data
PRCN-2018 : Current user grid is not a privileged user
acfsutil registry: ACFS-09173: The srvctl command line "/u01/app/19.0.0.0/grid/bin/srvctl add filesystem -device /dev/asm/datavol01-146 -path /u02/data" failed to execute. (0)
acfsutil registry: ACFS-03111: unable to add ACFS mount /u02/data within Oracle Registry
# acfsutil registry -a /dev/asm/datavol01-146 /u02/data
acfsutil registry: mount point /u02/data successfully added to Oracle Registry
这个注册的操作自动把文件系统也挂载了:
# df -h
Filesystem Size Used Avail Use% Mounted on
...
/dev/asm/datavol01-146 50G 411M 50G 1% /u02/data
修改文件系统权限:
# chown -R oracle:oinstall /u02/data
然后测试从本地文件系统拷贝文件到ACFS:
# su - oracle
$ cd /u02/data
$ time cp /u01/data/lineorder.tbl .
real 5m26.409s
user 0m0.252s
sys 0m48.224s
$ ls -sh lineorder.tbl
38G lineorder.tbl
如果在本地文件系统内拷贝文件:
$ cd /u01/data
$ time cp lineorder.tbl lineorder.tbl.bak
real 10m33.930s
user 0m0.209s
sys 0m37.060s
由于ACFS底层是由多个spindle构成,因此读写速度更好一些。
在另一台同配实例上测试,结果还是比较一致的:
## 从本地文件系统拷贝到ACFS
real 5m26.242s
user 0m0.180s
sys 0m32.977s
## 本地文件系统之间拷贝
real 10m39.805s
user 0m0.150s
sys 0m25.188s
## 从ACFS拷贝到本地文件系统
real 5m0.561s
user 0m0.111s
sys 0m24.073s
## ACFS之间拷贝
real 8m30.341s
user 0m0.146s
sys 0m29.424s
扩展ACFS文件系统
非常简单:
# acfsutil size 80G /u02/data
# df -h
...
/dev/asm/datavol01-27 80G 38G 43G 48% /u02/data
缩小也是可以的:
# acfsutil size 50G /u02/data
acfsutil size: Resizing file system in steps
acfsutil size: Resizing file system to 0.0625 TB
acfsutil size: Resizing file system to 0.0488 TB
acfsutil size: new file system size: 53687091200 (51200MB)
卸载和删除ACFS文件系统
# acfsutil registry -d /u02/data
acfsutil registry: successfully removed ACFS mount point /u02/data from Oracle Registry
# umount /u02/data
# acfsutil rmfs /dev/asm/datavol01-146
ASMCMD> voldisable -G data datavol01
ASMCMD> voldelete -G data datavol01
参考
- Creating an Oracle ACFS File System
- Deregistering, Dismounting, and Disabling Volumes and Oracle ACFS File Systems
- How To Resize An ACFS Filesystem/ASM Volume (ADVM) (文档 ID 1173978.1)
以上是关于用命令行创建和挂载ACFS文件系统的主要内容,如果未能解决你的问题,请参考以下文章