Skip to main content

examine fragments of files in the filesystem

Project description

filefrag

Python library to get FIE and command line tool

Install

See the video for a demo including installing from source, but you can install with pip:

pip install filefrag

Usage

Run pyfilefrag on the command line. See --help for details. It has --verbose, and --json outputs for your parsing pleasure.

To use the library, just call filefrag.FileMap('/path/whatever') to build a map of the extents in the file using ioctl’s interface. Then you can poke about in the guts of a file:

  • ⛓️‍💥 inspect fragmentation
  • 🔍 find out where data is on your physical drive
  • 🟰 compare extents between paths
  • 📔 use them as dict keys
  • 🕳️ check files for holes, like before and after hole punching
  • ✅ verify your deduplication strategy, write your own stats tool
  • 💩 dump file layouts to json (print(f"{filemap:j}")
  • ⚠️ break your disk because you believed the outputs of this alpha release!

Comes with a Device class to do comparisons, so it ought to work with fragments in files on different mountpoints, bind mounts and so on (unfortunately not snap’s FUSE mounts; they’re far too abstract and piped in via a socket)

Example

from filefrag import FileMap

mapping = FileMap('/usr/bin/bash')

print(mapping)
print(extents)

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

filefrag-0.0.2.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

filefrag-0.0.2-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file filefrag-0.0.2.tar.gz.

File metadata

  • Download URL: filefrag-0.0.2.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for filefrag-0.0.2.tar.gz
Algorithm Hash digest
SHA256 8c6ecdfc4f4f25476d8f9e312397f987f0208c4d7600ef63e3322d5d50939b18
MD5 4eed076ab956f834639c176f0ca09524
BLAKE2b-256 88b249bd255904d3b5c6f3cb55b09551ede7c8c4e9de399ae6aab616d5c80815

See more details on using hashes here.

File details

Details for the file filefrag-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: filefrag-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for filefrag-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a4f98fe5dfd08cc73e4e5d0b221b2864ba01d46fa5a17ed58c9c6fa0c4212cba
MD5 135d2f68459dc16d84698d21d9dbb87c
BLAKE2b-256 bd8d3436419818cc98d6e72e39e0fa28b52073e7818e2c752ad054952913f287

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