Raw block-level read/write of exFAT filesystem timestamps (birth time, modification time)
Project description
exfat-raw
Raw block-level read/write of exFAT filesystem timestamps — birth time (btime) and modification time (mtime), directly from the on-disk directory entry, bypassing the kernel driver's cache.
Features
- Read btime/mtime — parse the exFAT directory entry on the raw block device
- Write btime and mtime — atomically update both timestamps in one raw-block access
- 3-tier I/O fallback — tries direct
os.pread/os.pwritefirst (works on regular image files and accessible block devices), then loop device backing files, and finally falls back tosudo ddfor restricted block devices - No kernel cache corruption — understands the exFAT kernel driver's directory-entry
cache incoherence and avoids
os.utime()/sync()after raw writes - Pure stdlib — zero runtime dependencies
Usage
from exfat_raw import ExfatRawIO, ExfatRawFilesystem, ExfatRawOps
from datetime import datetime, timezone
io = ExfatRawIO()
fs = ExfatRawFilesystem(io)
ops = ExfatRawOps(io, fs)
# Read birth time from a file on an exFAT mount
ts = ops.read_btime_raw("/mnt/sdcard/DCIM/100GOPRO/GH010001.MP4")
print(datetime.fromtimestamp(ts, tz=timezone.utc))
# Correct the timestamp
target = datetime(2025, 6, 15, 12, 0, 0, tzinfo=timezone.utc)
ops.fix_exfat_raw("/mnt/sdcard/DCIM/100GOPRO/GH010001.MP4", target, dry_run=False)
# Preserve btime while updating mtime
orig_btime_ts = ops.read_btime_raw(filepath)
orig_btime_dt = datetime.fromtimestamp(orig_btime_ts, tz=timezone.utc)
ops.fix_exfat_raw(filepath, new_mtime_dt, dry_run=False, btime_dt=orig_btime_dt)
# Work directly on a raw image file (no sudo, no mount)
io = ExfatRawIO()
fs = ExfatRawFilesystem(io)
boot = io.parse_boot("path/to/sdcard.img")
chain = fs.cluster_chain(boot, "path/to/sdcard.img", boot["root_cluster"])
Dependencies
- Python ≥ 3.10 (stdlib only —
os,struct,subprocess,tempfile,pathlib) - System tools:
sudo,dd,findmnt,losetup— only needed for physical block devices; regular image files work with stdlib alone
License
GNU General Public License v3.0 or later.
Extracted from gopro-timestamp-corrector.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file exfat_raw-0.1.2.tar.gz.
File metadata
- Download URL: exfat_raw-0.1.2.tar.gz
- Upload date:
- Size: 27.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4cc7cddc4841834bc9c510d4686acf134d19c098e22d3c797f133738f232d3ec
|
|
| MD5 |
2bf52b72c9668cac2d0d152f2b771e4f
|
|
| BLAKE2b-256 |
9d7d8eb9ccfae640dc6e22f2e2c4d0847bbfc241a59619b7dd256848d0c2cd2d
|
Provenance
The following attestation bundles were made for exfat_raw-0.1.2.tar.gz:
Publisher:
publish.yml on MBanucu/exfat-raw
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
exfat_raw-0.1.2.tar.gz -
Subject digest:
4cc7cddc4841834bc9c510d4686acf134d19c098e22d3c797f133738f232d3ec - Sigstore transparency entry: 1643381318
- Sigstore integration time:
-
Permalink:
MBanucu/exfat-raw@c490a88a151be084cdab3543e93ab2ae116bc435 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/MBanucu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c490a88a151be084cdab3543e93ab2ae116bc435 -
Trigger Event:
push
-
Statement type:
File details
Details for the file exfat_raw-0.1.2-py3-none-any.whl.
File metadata
- Download URL: exfat_raw-0.1.2-py3-none-any.whl
- Upload date:
- Size: 23.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83a3a6065c71fb3c23f8243819b397fa006b9c7d557d7b8f972b55e22a03e7cc
|
|
| MD5 |
a324b7053ab4f9b2228323a833d2a452
|
|
| BLAKE2b-256 |
3b0f8e28387b041ae924f89d4447752cba667bd3941652baa8a37910a2afda00
|
Provenance
The following attestation bundles were made for exfat_raw-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on MBanucu/exfat-raw
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
exfat_raw-0.1.2-py3-none-any.whl -
Subject digest:
83a3a6065c71fb3c23f8243819b397fa006b9c7d557d7b8f972b55e22a03e7cc - Sigstore transparency entry: 1643381394
- Sigstore integration time:
-
Permalink:
MBanucu/exfat-raw@c490a88a151be084cdab3543e93ab2ae116bc435 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/MBanucu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c490a88a151be084cdab3543e93ab2ae116bc435 -
Trigger Event:
push
-
Statement type: