• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to determine file and free space fragmentation of OCFS2

by admin

Below is a list of steps to determine the extent fragmentation of disk space on OCFS2. Steps should work on an offlined o2image and provide an indication for fragmentation-related performance problems.

Checking the fragments in OCFS2 volume

1.Use debugfs.ocfs2 to display on-disk OCFS2 filesystem structures on /dev/$your_ocfs2_volume, see the following example:

# debugfs.ocfs2 /dev/sdb 
debugfs.ocfs2 1.6.3 
debugfs:

2. Run “stat //global_bitmap”:

debugfs: stat //global_bitmap 
Inode: 11 Mode: 0644 Generation: 1123409557 (0x42f5de95) 
FS Generation: 1123409557 (0x42f5de95) 
CRC32: 00000000 ECC: 0000 
Type: Regular Attr: 0x0 Flags: Valid System Allocbitmap Chain 
Dynamic Features: (0x0) 
User: 0 (root) Group: 0 (root) Size: 2147490164736 
Links: 1 Clusters: 524289591 
ctime: 0x4f0c1e9f -- Tue Jan 10 03:18:55 2012 
atime: 0x4f0c1e9f -- Tue Jan 10 03:18:55 2012 
mtime: 0x4f0c1e9f -- Tue Jan 10 03:18:55 2012 
dtime: 0x0 -- Wed Dec 31 16:00:00 1969 
ctime_nsec: 0x00000000 -- 0 
atime_nsec: 0x00000000 -- 0 
mtime_nsec: 0x00000000 -- 0 
Refcount Block: 0 
Last Extblk: 0 Orphan Slot: 0 
Sub Alloc Slot: Global Sub Alloc Bit: 7 
Bitmap Total: 524289591 Used: 262461691 Free: 261827900 
Clusters per Group: 32256 Bits per Cluster: 1 
Count: 243 Next Free Rec: 243 
## Total Used Free Block# 
0 2161152 1086804 1074348 219469824 
1 2161152 1341165 819987 313560576 
... 
32 2161152 1163460 997692 424295424 
33 2161152 1205493 955659 126475776 
--More--

3. Press space key to get more until find the group chain information like below:

Group Chain: 0 Parent Inode: 11 Generation: 1123409557 
CRC32: 00000000 ECC: 0000 
## Block# Total Used Free Contig Size 
0 219469824 32256 4286 27970 1874 4032 
1 148925952 32256 10405 21851 1996 4032 
... 
65 509483520 32256 30721 1535 1535 4032 
66 517321728 32256 30721 1535 1535 4032

4. Travel every item in the group chain to get the values of “Contig” field. The more the values are less than localalloc_size/cluster_size, the more fragments this group chain are. The default size of localalloc is 8M, you can add an option like “localalloc=4” to change its size to 4M when mounting the OCFS2 volume. Like in the example of step 3, assuming localalloc is 8M and cluster size is 4K, then localalloc_size/cluster_size=8M/4K=2048, then the item 0, 1, 65, 66 are fragments.

5. Travel every group chain to check the fragments. The more group chains you travel before finding one which is not having many fragments, the more fragments in your filesystem and the worse the OCFS2 performance will be.

Checking the fragments in offlined O2image file.

1. If it’s raw format(generated by o2image with “-r” option), then replace the above step1 as:

# debugfs.ocfs2 o2image.raw

2. If it’s packed format(generated by o2image without “-r” option), then replace the above step1 as:

# debugfs.ocfs2 -i o2image.packed

or

# o2image -I o2image.disk o2image.packed

then

# debugfs.ocfs2 o2image.disk

Filed Under: CentOS/RHEL 6, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. apt-file Command Examples in Linux
  2. Configure MySQL Router to Auto Restart of Failure using systemd
  3. 11 Useful “ssh” and “scp” Commands in Linux
  4. ttyrec – Record Terminal Session in Linux
  5. How To Customize The Screensaver Options In Gnome on CentOS/RHEL 7
  6. How to Test Port [TCP/UDP] Connectivity from a Linux Server
  7. scp Command Examples in Linux
  8. nmcli: command not found
  9. http-prompt Command Examples in Linux
  10. md5sum Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • pw-cat Command Examples in Linux
  • pvs: command not found
  • pulseaudio: command not found
  • pulseaudio Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright