How to resize ACFS and change the mountpoint

关于如何创建ACFS,参看我的上一篇文章:How to create ASM filesystem(ACFS) in Oracle 11gR2

在创建完ACFS之后如果想更改挂载点(mountpoint)以及修改卷的大小,该如何操作呢?

–检查当前ACFS文件系统状态。ACFSDG是ACFS所在的磁盘组,总大小614400M,还有409491M空闲。

$ asmcmd lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576    614400   409491                0          409491              0             N  ACFSDG/
MOUNTED  EXTERN  N         512   4096  1048576      4886     4490                0            4490              0             Y  CRSDG/
MOUNTED  EXTERN  N         512   4096  1048576    488288    90536                0           90536              0             N  DATADG/
MOUNTED  EXTERN  N         512   4096  1048576    223623   221834                0          221834              0             N  FRADG/

–检查ACFSDG上的卷(Volume)。Volume Device是挂载时要指定的设备名称,Usage和Mountpoint仅仅是描述,并不是表明其真正用途和真正的挂载点。
–可以使用asmcmd volset来修改usagestring和mountpath。

$ asmcmd volinfo -G ACFSDG -a
Diskgroup Name: ACFSDG

         Volume Name: ACFSDGVOL1
         Volume Device: /dev/asm/acfsdgvol1-57
         State: ENABLED
         Size (MB): 204800
         Resize Unit (MB): 256
         Redundancy: UNPROT
         Stripe Columns: 4
         Stripe Width (K): 128
         Usage: To Store RMAN backupsets
         Mountpath: We should mount this volume as /backup

–检查ACFS挂载点,可以看到当前Mount Point并不是/backup而是/acfsmounts/acfsdg_acfsdgvol1,后面我们就要修改这个挂载点。

# acfsutil registry -l /dev/asm/acfsdgvol1-57
Device : /dev/asm/acfsdgvol1-57 : Mount Point : /acfsmounts/acfsdg_acfsdgvol1 : Options : none : Nodes : all : Disk Group : ACFSDG : Volume : ACFSDGVOL1 

–创建新的挂载点

# mkdir /backup

–先尝试用asmcmd volresize命令修改卷大小,报ORA-15476错误,实际上这里的意思是说,在卷处于mount状态时,是无法用volresize命令修改卷大小的,必须用acfsutil size命令。volresize命令只能在文件系统被卸载之后才能使用。

ASMCMD> volresize -G acfsdg -s 614400M ACFSDGVOL1
ORA-15032: not all alterations performed
ORA-15476: ACFS volumes must be resized with the 'acfsutil size' operating system command. (DBD ERROR: OCIStmtExecute)

–卸载当前已经挂载的文件系统

# umount -a -t acfs

–修改ACFS Registry,修改这个信息并不会自动挂载文件系统,而只是为了让下次Oracle Clusterware重启的时候可以自动地将文件系统挂载到正确路径下。

# acfsutil registry -d /dev/asm/acfsdgvol1-57
acfsutil registry: successfully removed ACFS volume /dev/asm/acfsdgvol1-57 from Oracle Registry
# acfsutil registry -a /dev/asm/acfsdgvol1-57 /backup
acfsutil registry: mount point /backup successfully added to Oracle Registry
# acfsutil registry -l /dev/asm/acfsdgvol1-57
Device : /dev/asm/acfsdgvol1-57 : Mount Point : /backup : Options : none : Nodes : all : Disk Group : ACFSDG : Volume : ACFSDGVOL1

–在文件系统被卸载之后,尝试使用volresize命令修改大小。报ORA-15041错误,因为我们尝试指定之前在asmcmd lsdg命令中显示的该磁盘组的Total_MB,但是由于ADVM Volume在创建时会有额外的空间开销,因此报空间不足。当然,如果这里我们将大小降低1G左右,volresize命令是可以运行成功的。本例中在后面选择使用acfsutil size来修改大小。

$ asmcmd volresize -G acfsdg -s 614400M ACFSDGVOL1
ORA-15032: not all alterations performed
ORA-15041: diskgroup "ACFSDG" space exhausted (DBD ERROR: OCIStmtExecute)

–手动挂载文件系统到新目录下。

# mount -v -t acfs /dev/asm/acfsdgvol1-57 /backup
mount.acfs: volume: /dev/asm/acfsdgvol1-57, mount point: /backup
mount.acfs: options: rw
mount.acfs: verbose option specified
mount.acfs: command string: /bin/mount -i -t acfs -o ,rw /dev/asm/acfsdgvol1-57 /backup -v.
/dev/asm/acfsdgvol1-57 on /backup type acfs (rw)

–修改挂载点属主

# chown oracle:oinstall /backup 

–acfsutil size命令可以在文件系统仍然被使用的时候进行扩容,+/-符号表示要在当前基础上增加或者减少多少,这比volresize命令更灵活。

# acfsutil size +400000M /backup
acfsutil size: new file system size: 634312982528 (604928MB)
# acfsutil size +8000M /backup
acfsutil size: new file system size: 642902917120 (613120MB)
# acfsutil size -3000M /backup
acfsutil size: new file system size: 639950127104 (610304MB)

Leave a Reply

Your email address will not be published. Required fields are marked *