Skip to main content

A script written in Python 2 to analyze the superblock of an ext2/ext3 formatted file.

Project description

A script written in Python 2 to analyze the superblock of an ext2/ext3 formatted file.

Such a file can be created as follows:

$ dd count=4096 if=/dev/zero of=filesystem.ext3
$ sudo mkfs.ext3 filesystem.ext3

It can be mounted with

$ sudo mount -t ext3 -o loop filesystem.ext3 /mnt/mountpoint

Install

You can either download superblock.py file and use it directly, or install the superblock command via pip:

$ sudo pip install superblock

Usage

$ superblock [dump|analyze] <filename>

License

MIT License, see LICENSE file.

Examples

Dump

Printing superblock (bytes 1024-1535) of file fs.ext2.

                     HEX                       ASCII
 1:  40000000 00020000 19000000 e2010000  @...............
 2:  32000000 01000000 00000000 00000000  2...............
 3:  00200000 00200000 40000000 82bad550  . ... ..@......P
 4:  c4bcd550 0200ffff 53ef0100 01000000  ...P....S.......
 5:  968bd550 00000000 00000000 01000000  ...P............
 6:  00000000 0b000000 80000000 38000000  ............8...
 7:  02000000 01000000 dc0cb51b 2ab54967  ............*.Ig
 8:  8e602492 87974d10 65787065 72696d5f  .`$...M.experim_
 9:  65787432 00000000 2f686f6d 652f6461  ext2..../home/da
10:  6e696c6f 2f50726f 6a656374 732f7375  nilo/Projects/su
11:  70657262 6c6f636b 2f6d6e74 00000000  perblock/mnt....
12:  00000000 00000000 00000000 00000000  ................
13:  00000000 00000000 00000000 00000100  ................
14:  00000000 00000000 00000000 00000000  ................
15:  00000000 00000000 00000000 ff27f89c  .............'..
16:  b5cb41d1 987de848 6b3e81ba 01000000  ..A..}.Hk>......
17:  0c000000 00000000 968bd550 00000000  ...........P....
18:  00000000 00000000 00000000 00000000  ................
19:  00000000 00000000 00000000 00000000  ................
20:  00000000 00000000 00000000 00000000  ................
21:  00000000 00000000 00000000 00000000  ................
22:  00000000 00000000 00000000 00000000  ................
23:  01000000 00000000 00000000 00000000  ................
24:  00000000 00000000 00000000 00000000  ................
25:  00000000 00000000 00000000 00000000  ................
26:  00000000 00000000 00000000 00000000  ................
27:  00000000 00000000 00000000 00000000  ................
28:  00000000 00000000 00000000 00000000  ................
29:  00000000 00000000 00000000 00000000  ................
30:  00000000 00000000 00000000 00000000  ................
31:  00000000 00000000 00000000 00000000  ................
32:  00000000 00000000 00000000 00000000  ................

Analyze

Analyzing superblock (bytes 1024-1535) of file fs.ext2.

Total number of inodes: 64
Filesystem size in blocks: 512
Number of reserved blocks: 25
Free blocks counter: 482
Free inodes counter: 50
Number of first block: 1
Block size: 0 (1024 Byte)
Fragment size: 0
Number blocks per group: 8192
Number fragments per group: 8192
Number inodes per group: 64
Number of block groups: 1
Time of last mount: 1356184194 (2012-12-22 14:49:54)
Time of last write: 1356184772 (2012-12-22 14:59:32)
Mount operations counter: 2
Number of mount operations before check: 65535
Magic signature: 0XEF53
Status flag: 1
Behavior when detecting errors: 1
Minor revision level: 0
Time of last check: 1356172182 (2012-12-22 11:29:42)
Time between checks: 0
OS Filesystem created: 0
Revision level: 1
Default user ID for reserved blocks: 0
Default group ID for reserved blocks: 0
Number first nonreserved inode: 11
Size of on-disk inode structure: 128
Block group number of this superblock: 0
Compatible features bitmap: 111000 (ext_attr resize_ino dir_index)
Incompatible features bitmap: 00010 (filetype)
Read-only features bitmap: 001 (sparse_super)
128-bit filesystem identifier: dc0cb51b-2ab5-4967-8e60-249287974d10
Volume name: experim_ext2
Path of last mount point: /home/danilo/Projects/superblock/mnt
Compression Algorithm: 00000 (none)
Number of blocks to preallocate: 0
Number of blocks to preallocate for directories: 0
Journal UUID: 00000000-0000-0000-0000-000000000000
Journal inode number: 0
Journal device number: 0
Journal last orphan: 0
Hash seed: 2633508863 3510750133 1223196056 3129032299
Hash version: 1
Default mount options: 01100 (xattr_user acl)
First meta block group ID: 0

Resources

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

superblock-0.2.1.tar.gz (6.0 kB view details)

Uploaded Source

File details

Details for the file superblock-0.2.1.tar.gz.

File metadata

  • Download URL: superblock-0.2.1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for superblock-0.2.1.tar.gz
Algorithm Hash digest
SHA256 71ff60850d12f30180dbe05d743bab2c0954953f5026deb21d02d53b69e4ca8e
MD5 68df686419225794476ee582410e154e
BLAKE2b-256 41f6ba462b2ef0edf27e47e5fec6e22b30561bc0b0c750d26b3d24f9960dcc07

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page