AIX平台下创建文件系统需要注意的问题
本文PDF版下载 http://xunzhaoxz.itpub.net/resource/40016/29781
作者:xunzhao【转载时请以超链接形式标明文章出处和作者信息】
链接:http://xunzhaoxz.itpub.net/post/40016/487969
关键字:AIX create file systems HACMP logfile jfslog jfs2log logform chfs 创建文件系统 重建JFSLOG JFS2LOG
这几天在看HACMP相关的一些文档,注意到在HACMP中添加NFS 资源组的时候,需要注意如下问题(即[1][2]),由此扩展开来,在AIX平台下创建文件系统需要注意的问题:
1) 在HA环境下为了确保发生takeover时能够顺利地接管失效节点的VG等资源,创建文件系统时需要注意:
[1] Ensure that the major number for each volume group is identical on both nodes.
[2] Defined, within each volume group, a logical volume and a file system that will be exported, and named them /ap1_fs and /app2_fs. Ensured that logical volumes names and jfslog names are consistent on both nodes.
当然HA环境下可以通过C-SPOC进行操作确保节点设置一致性。
2) 单机环境下,从方便管理、提高可读性等方面考虑,建议创建文件系统时手工指定LOG文件。
1. 前言:LOG文件简述
IBM红皮书《IBM Certification Study Guide Eserver p5 and pSeries Administration and Support for AIX 5L Version 5.3》中关于LOG文件的描述如下:
[@more@]7.3 Device logs
The journaled file system log stores transactional information about file system metadata changes.This data can be used to roll back incomplete operations if the machine crashes. JFS file systems are used for logging logical volumes of type jfslog, while JFS2 file systems are used for logging logical volumes of type jfs2log.
Data from data blocks are not journaled. Log devices ensure file system integrity, not data integrity.
After the operating system is installed, all file systems within the rootvg volume group use logical volume hd8 as a common log.
You can create a JFS2 file system that can use inline logs. This means the log data is written into the same logical volume as the file system, and not into the log logical volume.
2. 新建文件系统并指定LOG文件
2.1. 创建type为JFS2的LV
[p170:root:/]#smit mklv
2.2. 创建type为JFS2LOG的LV
创建了文件系统JFS2的LV后,创建相应的JFS2LOG LV用于存放该文件系统的相关日志信息,这样一方面实现了上面提到的管理方便性,另一方面由于每个文件系统使用独立的LOG LV,避免了大数据量并发时LOG LV成为瓶颈,提高了系统的性能。
注意:这里创建的LOG LV必须与JFS2的LV在同一个卷组中,否则将无法指定。
[p170:root:/]#smit mklv
2.3. 创建文件系统并手工指定LOG LV
[p170:root:/]#smit crfs
è Add an Enhanced Journaled File System on a Previously Defined Logical Volume
查看/etc/filesystems的变化
[p170:root:/]#tail /etc/filesystems
此时可以得知/tmp/mp4这个文件系统当前使用的log文件为/dev/logtestfs4,查看当前两个LV的状态为closed/syncd说明两个LV目前未使用。
[p170:root:/]#lsvg -l datavg
datavg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
testfs3 jfs2 1 1 1 closed/syncd /tmp/mp3
loglv00 jfs2log 1 1 1 closed/syncd N/A
logtestfs4 jfs2log 1 1 1 closed/syncd N/A
testfs4 jfs2 1 1 1 closed/syncd /tmp/mp4
2.4. 挂载使用文件系统并验证LOG文件
[p170:root:/]#mount /dev/testfs4 /tmp/mp4
[p170:root:/]#df –g
[p170:root:/]#mount
当前mount结果显示/dev/testfs4使用的log文件是/dev/logtestfs4。
再次查看两个LV的状态,已经显示为正在使用中的open/syncd状态。
[p170:root:/]# lsvg -l datavg
datavg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
testfs3 jfs2 1 1 1 closed/syncd /tmp/mp3
loglv00 jfs2log 1 1 1 closed/syncd N/A
logtestfs4 jfs2log 1 1 1 open/syncd N/A
testfs4 jfs2 1 1 1 open/syncd /tmp/mp4
3. 为已有的文件系统重建LOG文件
本实验以rootvg上的/dev/testfs1为例,默认情况下rootvg上的文件系统使用hd8作为文件系统的LOG。
3.1. 查看当前LOG信息:
[p170:root:/]#mount
[p170:root:/]#tail /etc/filesystems
3.2. 卸载需要重建LOG的文件系统
[p170:root:/tmp]#umount /tmp/mp1
[p170:root:/tmp]#mount
3.3. 创建type为JFS2LOG 的LV
1) 创建LV
[p170:root:/tmp]#mklv -t jfs2log -y logtestfs1 rootvg 1
logtestfs1
[p170:root:/tmp]#
2) 格式化为log文件系统
[p170:root:/tmp]#logform /dev/logtestfs1
logform: destroy /dev/rlogtestfs1 (y)?y
[p170:root:/tmp]#
3) 分配log设备给文件系统使用
[p170:root:/tmp]#chfs -a log=/dev/logtestfs1 /tmp/mp1
[p170:root:/tmp]#cat /etc/filesystems
注意:这里必须使用chfs –a指定log文件,而不是直接修改/etc/filesystems文件,否则exportvg再importvg时,文件系统对应的LOG文件将还原为原来的hd8。
[p170:root:/tmp]#man chfs
-a log=LVName
Specifies the full path name of the filesystem logging logical volume name of the existing log to be used. The log device for this filesystem must reside on the same volume group as the filesystem.
3.4. 挂载使用文件系统并验证LOG文件
[p170:root:/tmp]#mount /dev/testfs1 /tmp/mp1
[p170:root:/tmp]#cd /tmp/mp1
[p170:root:/tmp/mp1]#ls
abc abc.txt lost+found
[p170:root:/tmp]#
文件系统/tmp/mp1已顺利挂载并可以正常读取出原有数据。
查看/etc/filesystems中关于/tmp/mp1的信息:
/dev/testfs1的LOG文件已经被成功重建为/dev/logtestfs1。
本次实验至此结束。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22085031/viewspace-1024439/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/22085031/viewspace-1024439/