Lifeline
Deleted isn't gone. Get back deleted photos, documents and whole folders from drives, USB sticks and memory cards.
A guided desktop app and a command-line tool for Windows, macOS and Linux.
Website · Get started · Features · Command line · How it works
Why Lifeline
When a file is deleted, its data usually stays on the drive until something new is written over it. Lifeline finds that data and copies it somewhere safe. You don't need to know what an MFT or file carving is: Lifeline asks what happened and picks the right scan for you.
| 🗑 I deleted files by mistake | Finds them with their original names and folders, then searches free space for anything else. |
| 💾 A drive or card was formatted | Searches every block for 20 families of file formats, by content. |
| 🧩 A partition disappeared | Searches the disk for lost partitions and lets you browse them like a normal drive. |
| ♻ Check the Recycle Bin first | Lists what's still in the Recycle Bin / Trash on every OS, with original locations. |
It only ever reads from the drive it scans, and it refuses to save recovered files onto that same drive.
Get started
Recovering right now? Stop saving anything to the drive you lost files from, and don't install Lifeline on it. Every new file can land on top of the ones you want back.
git clone https://github.com/Ojas1024/LifeLine.git
cd LifeLine
pip install -r requirements.txt # PyQt6
Or install it from PyPI and get a lifeline command:
pip install lifeline-recovery
lifeline # the app
lifeline --help # the command line
| System | Start it |
|---|---|
| Windows | double-click run.bat (it asks for administrator rights), or python -m lifeline in an admin terminal |
| Linux | ./run.sh: the app offers to restart itself with admin rights (pkexec), or run sudo -E python3 -m lifeline |
| macOS | ./run.sh: the app asks for your password. Also allow Full Disk Access for it in System Settings → Privacy & Security |
| pip | pip install lifeline-recovery, then just lifeline |
Portable builds. build_exe.bat gives dist\Lifeline.exe, one file that asks for admin rights on launch.
./build.sh gives dist/Lifeline on Linux or dist/Lifeline.app on macOS. Put the build on a USB stick and run it from there.
What it does
| Guided start. Four plain choices set the scan up for you. Advanced options stay folded away. | Live scan. A map of the drive fills in as it's searched, with the files found, read speed and time left. Pause or stop any time. |
| Plain recovery chances. Each file is Excellent, Good, Poor or Unlikely, with a preview and a warning when an SSD has already erased it. | Real search. *.docx, type:photos, size:>5mb, modified:2024, in:Documents, -backup, regex, plus filters and a folder tree. |
Scans
-
Quick scan keeps names, folders and dates:
- NTFS: parses the MFT on every CPU core, rebuilds paths through deleted folders, handles fragmented files, extension records, an
$ATTRIBUTE_LISTon the MFT, and a damaged boot sector (by falling back to the backup copy). - FAT12/16/32: goes into deleted folders, rebuilds long file names, and recovers the lost first letter of the short name when the checksum allows.
- exFAT: reads deleted entry sets, lays out contiguous (NoFatChain) files exactly, and corrects timestamps to UTC.
- Every file is checked against the allocation bitmap or FAT, so you can see whether its space has been reused.
- NTFS: parses the MFT on every CPU core, rebuilds paths through deleted folders, handles fragmented files, extension records, an
-
Deep scan (file carving) works after formatting and on any file system. It walks each format's internal structure to find where the file really ends, and drops random matches:
JPEG · PNG · GIF · BMP · TIFF & camera RAW (CR2, NEF, ARW, DNG, ORF) · PSD · PDF · ZIP family (DOCX, XLSX, PPTX, ODT, EPUB, JAR, APK, ZIP64) · DOC/XLS/PPT/MSG/MSI · RAR4 & RAR5 · 7-Zip · MP4/MOV/HEIC/AVIF/CR3 · MKV/WebM · WMV/WMA · WAV/AVI/WebP · MP3 · Ogg/Opus · FLAC · SQLite · EXE/DLL
The work is split across worker processes, each with its own read handle. One worker searches about 0.5–1.1 GB/s of data, and on NTFS/FAT/exFAT the scan can stay in free space.
-
Smart scan runs a quick scan, then a deep scan. A file found by both is listed once, under its real name.
-
Lost partitions: searches MBR (with logical partitions) and GPT tables, then every 1 MiB boundary, the 63-sector offset and the NTFS backup boot sector. Each candidate is opened read-only before it's offered to you.
-
Recycle Bin / Trash: Windows
$Recycle.Bin, freedesktop Trash on Linux (including per-drive.Trash-UID), and~/.Trashon macOS.
Recovering
- Check before recovering. Reads the files and tests whether their structure is intact (ZIP and PNG CRCs, JPEG scan data, PDF xref, SQLite
integrity_check, RAR/7z/Ogg checksums, …) without writing anything. - Several files are copied at once. Original folders and timestamps are kept, each file can be checked again after it's written, and a CSV report lists everything.
- Never onto the source drive. Lifeline checks the drive letter or physical disk on Windows, partitions, disks and device-mapper on Linux, and the APFS physical store on macOS.
- Save the scan to a
.lifelinefile and pick up later, even after the disk image has moved. - Failing drives. Make an image of a drive copies healthy areas first, retries damaged ones 4 KB at a time at the end, and resumes if interrupted. During scans a bad sector costs 4 KB, not the whole read.
- Light and dark themes that follow the system, drag-and-drop for disk images, keyboard shortcuts (Ctrl+F, Space, Ctrl+R, Ctrl+S, F1) and a built-in help screen.
Command line
Everything the app does is also available from a terminal:
lifeline list --disks # drives and whole disks
lifeline scan D: --out E:\Recovered # smart scan of a Windows drive
lifeline scan /dev/sdb1 --mode quick --query "*.docx modified:2024" --out ~/Recovered
lifeline scan card.img --mode deep --types jpg,mp4 --workers 8 --save card.lifeline
lifeline load card.lifeline --query "type:photos" --verify --out ~/Recovered
lifeline partitions /dev/sdb --search # find lost partitions
lifeline scan /dev/sdb --partition 0 --include-existing # browse one of them
lifeline trash --out ~/Recovered # restore the Recycle Bin
lifeline image /dev/sdb /mnt/usb/sdb.img # resumable, bad-sector tolerant
How it works
lifeline/
core/
disk.py sector-aligned raw reads on Windows, Linux and macOS; bad-sector salvage; imaging
devices.py drive listing (Win32 IOCTLs, lsblk, diskutil), admin rights, same-drive safety check
filesystems.py common interface ntfs.py · fat.py · exfat.py deleted-entry parsers
partitions.py MBR / EBR / GPT and lost-partition search
carver.py signature search + structure-aware extractors, parallel engine
verify.py integrity checks trash.py Recycle Bin / Trash
query.py search language session.py smart scan, dedupe, verify, save/load
recovery.py parallel, verified recovery with a CSV report
parallel.py process pools (spawn) with per-worker read handles
ui/ guided pages, results browser, gallery thumbnails, light/dark theme
cli.py command line
tests/ 153 tests
Deleting a file marks its record free and its clusters available, but the data stays where it was. The quick scan reads those
records back: NTFS MFT entries, FAT 0xE5 entries, exFAT entry sets with the in-use bit cleared. It rebuilds the
folder tree and checks each file's clusters against the allocation map. The deep scan doesn't rely on records at all. It looks
for file headers at cluster boundaries, then follows each format's structure (JPEG segments, ZIP central directory, MP4 boxes,
RAR blocks, Ogg pages, …) to the true end of the file.
Tests
pip install pytest && python -m pytest
The 153 tests run on:
- real FAT images with real deletions (mtools) and NTFS images (
mkntfs/ntfscp) - synthetic exFAT images and MBR/GPT disks
- every carved format, at two block sizes, with junk headers and noise between files
- parallel vs. sequential equivalence, plus an offscreen run of the whole GUI: open an image, smart scan, search, gallery, recover, compare bytes.
The suite and the GUI were run on Linux. On Windows and macOS, device listing, admin rights and the same-drive check go through those systems' own APIs. The scan engines are the same Python code on all three.
Limits
- SSDs with TRIM (the default) erase deleted blocks within minutes. Files may appear by name but read back as zeros. Lifeline warns when it sees this. No software can undo TRIM.
- Deep scan assumes each file is stored in one piece, so fragmented files come back damaged and without names. Quick scan doesn't have this problem.
- A deleted FAT file that only had a short 8.3 name loses its first letter (shown as
_), because that letter isn't stored anywhere. - Quick scan supports NTFS, FAT and exFAT. ext4, APFS, HFS+ and Btrfs get deep scan only.
Metadata
Release files for lifeline-recovery 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lifeline_recovery-2.0.0.tar.gz | 145.1 kB | Without provenance | Details for lifeline_recovery-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lifeline_recovery-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for lifeline_recovery-2.0.0-py3-none-any.whl |
Total release size: 287.6 kB
Release files / lifeline_recovery-2.0.0.tar.gz
| Download URL | lifeline_recovery-2.0.0.tar.gz |
|---|---|
| Size | 145.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
85a3af4a293a22e06c9e18bcd3c7dc9df5f5ca2a0455dbed78f92e8f1086d233
|
|
BLAKE2b-256 checksum How to use checksums |
22d00df61ef2d8afdbf625d895b55882edaa3905f6e50ba657a5e18ed94e6e3e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.16
|
Release files / lifeline_recovery-2.0.0-py3-none-any.whl
| Download URL | lifeline_recovery-2.0.0-py3-none-any.whl |
|---|---|
| Size | 142.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
27ee18bb91a3e3e8416417e8b4c97c01239d187a8d273daf4eba52c932b7d15d
|
|
BLAKE2b-256 checksum How to use checksums |
92db513313eb476fede1b06097194599d29d9d539bd0f8ff4cc42feec616063c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.16
|
Security for lifeline-recovery 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.