linux环境确定OCFS2文件系统的BLOCK和cluster size

应用环境:

Linux OS - Version: 1.2 to 1.6
Linux x86
Linux x86-64

[@more@]

解决方案:

许多已经存在的工具可以完成需要的工作:

  • debugfs.ocfs2
  • ocfs2console
  • fsck.ocfs2

以下示例都是在Enterprise Linux 5 system

1、debugfs.ocfs2

debugfs.ocfs2(8) command ,这个工具是在ocfs2-tool包内提供的基于EL4/EL5,可以用此工具来确定OCFS2的文件系统

# uname -a
Linux piston 2.6.18-194.3.1.0.1.el5 #1 SMP Thu May 6 19:58:50 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

# cat /etc/[e,r]*-release
Enterprise Linux Enterprise Linux Server release 5.5 (Carthage)
Red Hat Enterprise Linux Server release 5.5 (Tikanga)

# rpm -qa|grep -i ocfs2 | sort
ocfs2-2.6.18-194.3.1.0.1.el5-1.4.7-1.el5
ocfs2console-1.4.4-1.el5
ocfs2-tools-1.4.4-1.el5

# mounted.ocfs2 -d
Device FS Stack UUID Label
/dev/sda1 ocfs2 o2cb 3D7CDDE446A14D59BD0B24A21DB20958 ocfs1

# mounted.ocfs2 -f
Device FS Nodes
/dev/sda1 ocfs2 piston

# echo stats | debugfs.ocfs2 /dev/sdb1 | grep -i 'size bits'
debugfs.ocfs2 1.4.4
Block Size Bits: 12 Cluster Size Bits: 18


以上只是报告的BLOCK和Cluseter的bits位,可以通过以下表格对应起实际的大小:

Block Size BitsBytes
9512 (min.)
101024
112048
124096 (max.)

Cluster Size BitsBytes
124096 (min.)
138192
1416384
1532768
1665536
17131072
18262144
19524288
201048576 (max.)

说明:

以上debugocfs(1)命令可以安全的运行;

2、ocfs2console

ocfs2console(1)是一个图形界面的工具,所以你要运行这个工具在一个OCFS2的环境中,并且是一个graphical mode(x-windows)

执行ocfs2console(1)命令以加载OCFS2控制台

在弹出的控制台里选择device,列出OCFS2文件系统

里面就会显示出相应的CLUSTER和BLOCK大小

3、fsck.ocfs2

fsck.ocfs2(8)工具可以在不挂载的OCFS2系统文件或者是以只读模式打开的文件系统

# umount /media/ocfs2

# mounted.ocfs2 -f | grep sda1
/dev/sda1 ocfs2 Not mounted

# fsck.ocfs2 -vfn /dev/sda1 | more
fsck.ocfs2 1.4.4
Checking OCFS2 filesystem in /dev/loop2:
Label: ocfs1
UUID: 1E9FC543718240F7B3A97E515C830BD2
Number of blocks: 28160
Block size: 4096
Number of clusters: 440
Cluster size: 262144
Number of slots: 2
...
^C

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10130206/viewspace-1040229/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10130206/viewspace-1040229/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值