/superblock

Fetch filesystem superblocks from block devices

Primary LanguageGo

Superblock

superblock is a pure go library to read filesystem superblocks from block devices. Only supports XFS now.

Run the command below to compile the sample.

go build

And, run the program in the following manner to check.

[root@localhost ~]# ./superblock -blk /dev/dm-8
&xfs.SuperBlock{SB_magicnum:0x58465342, SB_blocksize:0x1000, SB_dblocks:0x280000, SB_rblocks:0x0, SB_rextents:0x0, SB_uuid:xfs.uuid_t{0xba, 0x20, 0x94, 0x3e, 0xda, 0x1f, 0x4b, 0xc3, 0x82, 0xb5, 0x13, 0xe4, 0x11, 0x44, 0x1f, 0x9b}, SB_logstart:0x200007, SB_rootino:0x800, SB_rbmino:0x801, SB_rsumino:0x802, SB_rextsize:0x1, SB_agblocks:0x28000, SB_agcount:0x10, SB_rbmblocks:0x0, SB_logblocks:0xa00, SB_versionnum:0xbdb4, SB_sectsize:0x1000, SB_inodesize:0x100, SB_inopblock:0x10, SB_fname:[12]uint8{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, SB_blocklog:0xc, SB_sectlog:0xc, SB_inodelog:0x8, SB_inopblog:0x4, SB_agblklog:0x12, SB_rextslog:0x0, SB_inprogress:0x0, SB_imax_pct:0x19, SB_icount:0x22c0, SB_ifree:0x1fb, SB_fdblocks:0x27226c, SB_frextents:0x0, SB_uquotino:0xffffffffffffffff, SB_gquotino:0xffffffffffffffff, SB_qflags:0x0, SB_flags:0x0, SB_shared_vn:0x0, SB_inoalignmt:0x2, SB_unit:0x80, SB_width:0x80, SB_dirblklog:0x0, SB_logsectlog:0xc10, SB_logsunit:0x10, SB_features2:0x2, SB_bad_features2:0x8a000002, SB_features_comapt:0x8a000000, SB_features_ro_comapt:0x0, SB_features_incompat:0x0, SB_features_log_incompat:0x0, SB_crc:0x0, SB_pad:0x0, SB_pquotino:0x0, SB_lsn:0}
Total size: 10737418240
Free size: 10505076736