A trivial question we stumbled across recently:
How big is the internal JFS2 log currently?
The size of the internal JFS2 log must meet the following two conditions:
- The log cannot be larger than 10% of the file system size.
- The maximum size cannot exceed 2047 MB.
When creating a JFS2 filesystem with internal log, if no size is specified for the log (-a logsize=value), 0.4% of the filesystem size is used by default. The value 0.4% is documented in the crfs manual page.
But how big is the internal JFS2 log right now?
This information is provided by the dumpfs command. It expects either the mount point of a JFS2 file system or the device file of the underlying logical volume as an argument. The command lists the superblock and additional control information. The output can be very long for larger file systems. Since we are only interested in the JFS2 log, it is advisable to filter the output using the grep command:
# dumpfs /data | grep -i log aggregate block size 4096 log2 of aggregate block size 12 LVM I/O Transfer size 512 log2 of LVM transfer size 9 log2 of block size/transfer size 3 Aggregate attributes J2_GROUPCOMMIT J2_INLINELOG log device 0x8000002700000001 log serial number 0x26 Inline Log: 541065216 (132096); 1024 fsck Service Log number of blocks: 50 Extendfs Inline Log Working Space: 541065216 (132096); 1024 #
The last value in the line “Inline Log:” indicates the size of the internal log in blocks. The block size of the file system can be found in the line “aggregate block size“. In our case, the internal log has a size of 1024 blocks, each with 4096 bytes. This gives a size of 4 MB (1024 * 4 KB).
If an external log is used, the output looks like this:
# dumpfs / | grep -i log aggregate block size 4096 log2 of aggregate block size 12 LVM I/O Transfer size 512 log2 of LVM transfer size 9 log2 of block size/transfer size 3 log device 0x8000000a00000003 log serial number 0xb Inline Log: 0 (0); 0 fsck Service Log number of blocks: 50 Extendfs Inline Log Working Space: 0 (0); 0 #
The internal log has a size of 0 blocks.
However, this is not the easiest way. Chris Gibson points out the “-q” option of the lsfs command, which displays additional information for JFS and JFS2 file systems:
# lsfs -q /filesystem Name Nodename Mount Pt VFS Size Options Auto Accounting /dev/fslv01 -- /filesystem jfs2 1048576 -- no no (lv size: 1048576, fs size: 1048576, block size: 4096, sparse files: yes, inline log: yes, inline log size: 4, EAformat: v1, Quota: no, DMAPI: no, VIX: yes, EFS: no, ISNAPSHOT: no, MAXEXT: 0, MountGuard: no) #
The size of the inline log is specified there directly in MB (inline log size: 4).
Determining the size of the internal JFS2 log is therefore no problem with the right command (