So stellen Sie gelöschte Dateien unter Linux wieder her

Ein Unfall rm Mit diesem Befehl kann eine Datei gelöscht werden, ohne dass sie in den Papierkorb verschoben wird. Ein gelöschter Ordner kann auch aus einem Desktop-Dateimanager verschwinden, bevor Sie bemerken, was er enthielt. Möglicherweise können Sie dennoch gelöschte Dateien unter Linux wiederherstellen, aber der nächste Schritt hängt davon ab, wie die Dateien gelöscht wurden und ob noch eine weitere Kopie vorhanden ist.
Der Papierkorb, Sicherungskopien und Dateien, die noch von einer Anwendung geöffnet sind, bieten direkte Möglichkeiten zur Wiederherstellung. Ohne diese Optionen hängt die Wiederherstellung vom Dateisystem, den verbleibenden Metadaten, nachfolgenden Schreibvorgängen und davon ab, ob eine SSD TRIM-Befehle verarbeitet hat. Das Unterbinden neuer Schreibvorgänge hilft zwar, garantiert jedoch keine Wiederherstellung.
Beenden Sie alle Schreibvorgänge auf dem betroffenen Laufwerk. Falls die gelöschte Datei möglicherweise noch in einer Anwendung geöffnet ist, lassen Sie diese Anwendung weiterlaufen und sehen Sie sich Methode 2 an, bevor Sie den Computer neu starten. Andernfalls beginnen Sie mit dem Papierkorb und den vorhandenen Sicherungskopien. Informationen zu ähnlichen Szenarien finden Sie in unserem Anleitung zur Wiederherstellung gelöschter Dateien.
Inhaltsübersicht
Bevor Sie beginnen: Sichern Sie die gelöschten Daten
Nachdem Sie geprüft haben, ob eine Wiederherstellung bei geöffneter Datei möglich ist, sollten Sie keine weiteren Vorgänge auf dem Quellmedium durchführen. Verwenden Sie bei einer Systempartition eine Wiederherstellungsumgebung auf einem separaten Startlaufwerk. Bereiten Sie alle erforderlichen Downloads und Tools auf einem anderen Computer oder Laufwerk vor.
Vermeiden Sie folgende Maßnahmen, bis wichtige Dateien in Sicherheit sind:
- Durchführung von Dateisystemreparaturen wie beispielsweise
fsckin der Quelle. - Eine Partition formatieren, initialisieren oder neu erstellen.
- Laufen
fstrim, wodurch Blöcke entfernt werden, die vom Dateisystem als ungenutzt eingestuft werden. - Speichern der Wiederherstellungsdaten auf der betroffenen Festplatte.
Die Linux-fstrim-Handbuch erläutert den Löschvorgang. Auf SSDs lassen sich gelöschte Daten möglicherweise nicht mehr per Software wiederherstellen.
Sollte das Laufwerk klappern, sich wiederholt trennen oder immer schwerer lesbar werden, brechen Sie den Scanvorgang ab und ziehen Sie eine professionelle Datenrettung in Betracht.
Kurzantwort: Welche Wiederherstellungsmethode eignet sich für Ihren Fall?
Sie müssen nicht jede Methode ausprobieren. Wählen Sie den für Ihre Situation am besten geeigneten Weg zur Wiederherstellung.
Ihre Situation | Hier beginnen | Hauptbeschränkung |
Über einen Desktop-Dateimanager gelöscht | Aus dem Papierkorb wiederherstellen | Bei einer endgültigen Löschung wird der Papierkorb möglicherweise umgangen |
Gebraucht | Überprüfen Sie offene Handles und Backups und ziehen Sie anschließend Wiederherstellungswerkzeuge in Betracht | Möglicherweise gibt es kein direkt wiederherstellbares Exemplar mehr. |
Die gelöschte Datei ist möglicherweise noch geöffnet | Offene Datei-Handles sofort überprüfen | Der Prozess muss einen zugänglichen Handle beibehalten. |
Es ist ein Backup oder ein früherer Snapshot vorhanden | Entpacken Sie die benötigten Dateien | Die Kopie muss vor der Löschung erstellt worden sein und die Dateien enthalten. |
Es gibt keine Kopie; die Disk lässt sich normal lesen | Verwenden Sie ein geeignetes Linux-Wiederherstellungstool | Die Ergebnisse hängen vom Zustand des Dateisystems und den verbleibenden Daten ab. |
Sie bevorzugen eine Windows-Benutzeroberfläche | Ein unterstütztes Linux-Laufwerk mit Magic Data Recovery scannen | Erfordert Windows und eine unterstützte, zugängliche Speicheranordnung |
Die Partition ist verschwunden oder das Laufwerk ist instabil | Das Speicherproblem separat diagnostizieren | Die üblichen Schritte zur Wiederherstellung gelten möglicherweise nicht. |
Überprüfen Sie, ob die Dateien gelöscht wurden
Überprüfen Sie vor dem Scannen den Speicherort des Originals, das entsprechende Benutzerkonto und ob das erwartete externe Laufwerk eingebunden ist. Eine fehlende Einbindung kann dazu führen, dass ein Verzeichnis leer erscheint, obwohl sich die Dateien weiterhin auf einem anderen Gerät befinden.
Verwenden Sie zur Festplattenidentifizierung Folgendes:
- lsblk -o NAME,GRÖSSE,DATEISYSTEM,BEZEICHNUNG,EINHÄNGEPUNKTE
Ordnen Sie das Gerät anhand seiner Größe, seiner Bezeichnung, seines Dateisystems und seines Einhängepunkts zu. Gehen Sie nicht davon aus, dass /dev/sdb1 Das ist die Ursache: Gerätenamen können sich je nach Computer und beim Neustart ändern.

Das Dateisystem spielt eine Rolle. EXT4, XFS und Btrfs weisen unterschiedliche Vorgehensweisen bei der Wiederherstellung gelöschter Dateien auf. Wenn in der Ausgabe ein Verschlüsselungscontainer oder ein logisches Volume angezeigt wird, sollten Sie zunächst die zugrunde liegende Speicherstruktur ermitteln, bevor Sie ein Tool auswählen.
Vermeiden Sie eine langwierige Suche auf der gesamten Festplatte einer stark ausgelasteten Quelle, nur um eine Löschung zu bestätigen, von der Sie bereits wissen, dass sie stattgefunden hat. Wenn auf die Partition überhaupt nicht zugegriffen werden kann, behandeln Sie dies als eigenständiges Speicherproblem und nicht als gewöhnlichen Fall einer gelöschten Datei.
So stellen Sie gelöschte Dateien unter Linux wieder her
Verwenden Sie nach Möglichkeit eine vorhandene Kopie. Überprüfen Sie offene Handles sofort, sofern dies möglich ist; andernfalls beginnen Sie mit dem Papierkorb und den Sicherungskopien, bevor Sie die Festplatte scannen. Bei wertvollen Daten sollten Sie in Erwägung ziehen, zunächst ein Festplatten-Image zu erstellen und ein Tool zu verwenden, das die Wiederherstellung aus diesem Image unterstützt. Speichern Sie das Image auf einem separaten Speichermedium.
Methode 1: Dateien aus dem Papierkorb wiederherstellen
Geeignet für: Files deleted through a desktop file manager without permanent deletion.
Open your file manager and select Papierkorb. Locate the file, check that it is the correct item, and choose Wiederherstellen. Then open it from its restored location and confirm its contents.
This usually returns the file to its original folder. If you also need to recover permanently deleted files from the same disk, minimize further writes and prioritize protecting that disk before restoring large amounts of data there.
An ordinary rm command does not move files to the desktop Trash. If the item is absent, check an existing backup or continue with an appropriate recovery method. Do not empty Trash while investigating.
Method 2: Recover a Deleted File That Is Still Open
Geeignet für: A regular file that a running process still holds open.
Linux can retain an unlinked file until its final open file descriptor closes, as explained in the unlink manual. This makes the method time-sensitive: keep the relevant process running while checking.
Wenn lsof is already available, run:
- sudo lsof +L1
Die lsof manual documents this selection of open files with a link count below one. Look for the expected name, a regular-file entry, the process ID, and a numeric file descriptor. If the FD column shows 4w, the descriptor number is 4.

Before copying, confirm that the destination is actually mounted:
- findmnt –mountpoint
/media/user/RECOVERY-o SOURCE,TARGET,FSTYPE,OPTIONS
Replace this path with your destination mount point. Expect the intended recovery device, the exact mount point, and rw among the options. Match that device to a separate physical disk in lsblk. If nothing is listed, the source is unexpected, or the volume is read-only, stop and correct the destination first.
Copy the appropriate file to that drive. For example:
- sudo cp
/proc/1234/fd/4/media/user/RECOVERY/recovered-report.txt
Replace the process ID, descriptor, and destination; choose a new output filename so you do not overwrite an existing copy.
Open the copy and check its contents. The proc file descriptor documentation explains these paths and access restrictions.
If the handle has closed, this route is no longer available. Do not install lsof onto the affected file system just to try it. Also, copying a database while it changes does not guarantee a consistent database backup.
Method 3: Restore from a Backup or Existing Snapshot
Geeignet für: Files included in a backup, version history, or snapshot created before deletion.
A known-good copy is often more useful than a scan result. Check your backup application, external backup disk, cloud version history, or an existing snapshot that includes the affected folder.
- Open the backup source or its recovery interface.
- Wählen Sie eine Version aus, die vor der Löschung erstellt wurde.
- Locate the specific files or folder.
- Extract them to separate storage where possible.
- Open the restored files and check that the required changes are present.
Prefer extracting individual files over rolling back an entire working system when that meets your needs. A full rollback may replace newer work unrelated to the deletion.
Do not assume every system snapshot includes personal files. Check the backup scope. Similarly, synchronization may propagate deletions, so inspect version history or the service’s deleted-items area rather than only its current folder.
If no suitable copy exists, preserve the source and choose a disk recovery method.
Method 4: Use Linux Recovery Tools
Geeignet für: A readable drive with no usable copy, when you can identify the source and work from a separate recovery environment.
Run tools from a Live USB or another disk. The following checks apply to a simple, directly attached partition in a normal recovery session. If your storage involves encryption, RAID, LVM, containers, or multiple mount namespaces, get the layout assessed before proceeding.
Check the Source and Destination Before Scanning
1. Confirm the source partition. Match its size, label, and physical parent in lsblk. The example below uses /dev/sdb1; substitute your identified source:
- findmnt –source /dev/sdb1 -o SOURCE,TARGET,FSTYPE,OPTIONS
If a mount is listed, finish any open-file rescue first. For an ordinary data partition, unmount its listed mount point, for example:
- sudo umount
/media/user/LINUX_DATA
Run the source check again. There should be no matching mount in the recovery session; also confirm the source’s MOUNTPOINTS field is empty in lsblk. A command error is not a successful check. If you see additional mounts or an unfamiliar layout, stop.
Do not force or lazily unmount a busy source. If the affected partition is the running system’s root file system, boot from another device instead. Do not close a process holding your deleted file merely to make unmounting succeed. The umount manual explains busy mounts.
2. Verify the destination separately. Connect a known-good recovery drive and mount it through your recovery environment. Check its exact mount point:
- findmnt –mountpoint
/media/user/RECOVERY-o SOURCE,TARGET,FSTYPE,OPTIONS
Proceed only if it identifies the intended separate drive and a writable mount (rw). Check available space with df -h /media/user/RECOVERY. Die findmnt manual documents these mount checks.

Only after these checks, create a new output folder on that destination:
- mkdir
/media/user/RECOVERY/linux-recovery
If it already exists, choose a fresh folder name. Do not create the folder under an unmounted path: that could write to the file system containing the directory instead of your recovery drive.
Option A: extundelete for EXT3 or EXT4
extundelete attempts recovery using EXT3/EXT4 journal information. It is a conditional option, not a guaranteed solution for every EXT4 volume. Check compatibility with your recovery environment; if it reports unsupported features, do not alter the source to satisfy it.
Its output normally goes into RECOVERED_FILES beneath the current directory. Using the verified destination above, change directory and run recovery only if that succeeds:
- cd
/media/user/RECOVERY/linux-recovery&& sudo extundelete /dev/sdXN –restore-all
Ersetzen Sie /dev/sdXN with the source you verified, and adjust the destination path if needed. The && prevents the recovery command from running if the directory change fails.
Inspect the recovered output. If useful journal information or file content is unavailable, this method may fail. Do not respond by running a repair against the original disk. Consider content-based recovery or specialist assistance.
Option B: PhotoRec for Content-Based Recovery
FotoRec searches for recognizable file signatures. It can help when metadata-based recovery fails, but it does not preserve the original directory structure or filenames.
From your recovery environment:
- Start PhotoRec, for example with
sudo photorec. - Select the correct source disk and partition.
- Choose the EXT2/EXT3/EXT4 file system option for an EXT source.
- For ordinary deletion on an intact supported file system, select the free-space scan when offered.
- Choose a recovery directory on a different physical drive.
- Inspect the files written to the
recup_dir.*folders.
Expect to sort the output by content and file type. Finding many files does not prove the specific file you need is intact.
Where does TestDisk fit? Seine official undelete documentation distinguishes EXT2 undelete from EXT3/EXT4 limitations. Do not treat its partition recovery features as a universal way to restore deleted EXT4 files. Partition repair is outside this guide’s scope.
Method 5: Scan a Linux Drive from Windows
Geeignet für: Users who want a graphical interface and can connect a readable, supported Linux drive to a Windows computer.
Magic Data Recovery runs on Windows. Its offizielles Benutzerhandbuch lists EXT2, EXT3, and EXT4 support, making it an option for scanning supported Linux file systems from a Windows machine.
Unterstützt Windows 7/8/10/11 und Windows Server
This route suits a spare Windows computer and supported, readable storage. A graphical interface simplifies selection; it does not change whether the deleted content survives.
Step 1: Connect the source drive.
After checking for any open-file recovery opportunity, shut down the Linux computer if you need to remove an internal drive. Use an enclosure or adapter that matches its interface, such as SATA or NVMe. An existing external drive can be connected directly.
Step 2: Cancel initialization and formatting prompts.
Do not prepare the Linux disk for normal Windows use. A prompt to format does not mean formatting is required for recovery.
Step 3: Install the software on the Windows computer.
Keep the installation, downloads, and recovery output off the affected Linux disk. Prepare another drive with enough space for the files you need.
Step 4: Select and scan the correct source.
Match the disk or EXT partition by capacity and available identifying details. Review the scan results and use available filters to narrow down the relevant files.

Step 5: Preview and recover.
Where preview is available, check meaningful content rather than relying on the filename alone. Recover selected files to another physical drive, then verify them in their normal applications.

A supported EXT file system does not automatically mean every surrounding configuration is supported. LUKS encryption, LVM, RAID, or other storage layers require separate assessment. Do not initialize or rebuild an unfamiliar layout to make it appear in the program.
If the scan does not find usable content, check the recovery limits below before attempting another method.
Check Whether the Recovered Files Actually Work
A successful scan is only an intermediate result. Before reusing the source disk, check the files you recovered:
- Dokumente: Open them and inspect important pages, tables, and recent edits.
- Fotos: View the full image, not just a thumbnail.
- Videos: Play several sections, including near the end.
- Archiv: Use the archive application’s integrity test or extract their contents.
- Project files: Open them in the original application and check linked assets.
Compare against a trusted original checksum if one exists. A newly calculated checksum alone cannot prove that recovery was correct.
Keep the source unchanged until the important results have been verified. Then make an additional backup of the recovered files.
When Linux Deleted File Recovery May Not Work
Recovery becomes less likely when new data replaces the deleted content, required metadata disappears, or the device no longer returns the original blocks. On SSDs, the TRIM-Befehl can reduce recovery opportunities even without new files being copied. Treat the linked article as background; do not run its maintenance or enablement steps on a recovery source.
Stop DIY attempts if the device develops read errors, disconnects repeatedly, makes unusual mechanical noises, or contains a unique copy whose loss would be unacceptable. Professional assessment may be appropriate, although it cannot guarantee recovery of overwritten or discarded data.
If the real problem is a missing partition, an inaccessible encrypted volume, or a damaged storage array, use a workflow designed for that condition. Repeating ordinary undelete commands does not resolve those differences.
Reduce the Risk of Future File Loss
Once your files are safe, set up backups that keep previous versions. Store at least one copy on separate storage and periodically test whether you can restore an individual file.
Before running recursive deletion commands, check the current directory and the target path. For routine desktop cleanup, using Trash gives you an additional chance to catch a mistake.
Treat synchronization and backups as different functions. A synchronized folder can reflect an accidental deletion quickly; versioned backups provide a separate recovery point. Existing snapshots can also help, but a snapshot on the same physical disk does not protect against that disk failing.
Schlussfolgerung
An gelöschte Dateien unter Linux wiederherstellen, choose the method that matches the deletion. Check Trash for desktop deletions, preserve any useful open file handle before closing its process, and restore an existing backup before attempting a scan.
Without a usable copy, identify the file system and protect the source. Linux tools offer recovery options for specific conditions. Magic Data Recovery provides a Windows-based alternative for supported EXT drives when that setup suits you. In either case, recover to another disk and verify the actual contents before reusing the original storage.
For related scenarios, see our Anleitung zur Wiederherstellung gelöschter Dateien. Start with the matching method above, save recovered files to another drive, and verify them before reusing the source disk.
Unterstützt Windows 7/8/10/11 und Windows Server
FAQs
Kann ich einen „rm“-Befehl unter Linux rückgängig machen?
rm bietet keine Rückgängig-Funktion und verschiebt Dateien nicht in den Papierkorb auf dem Desktop. Die Wiederherstellung hängt von einer anderen verfügbaren Möglichkeit ab, beispielsweise einer Sicherung, einem vorhandenen Snapshot, einem offenen Datei-Handle oder wiederherstellbaren Daten auf der Festplatte. Vermeiden Sie weitere Schreibvorgänge, während Sie prüfen, welche Option in Ihrer Situation zutrifft.Können gelöschte Dateien von einer Linux-SSD wiederhergestellt werden?
fstrim im Rahmen eines Wiederherstellungsversuchs.Kann ich einen gesamten Ordner wiederherstellen, der mit „rm -r“ gelöscht wurde?
Behalten die wiederhergestellten Dateien ihre ursprünglichen Namen und Ordner?
Kann ich Linux-Dateien wiederherstellen, ohne Software auf dem betroffenen Laufwerk zu installieren?
Funktioniert dieser Vorgang auch bei LUKS-verschlüsselten Laufwerken?
Was sollte ich tun, wenn Windows mich auffordert, mein Linux-Laufwerk zu formatieren?
Können Dateien, die vor Wochen gelöscht wurden, noch wiederhergestellt werden?
Jason ist ein Spezialist für Datenwiederherstellung und technischen Support mit über 15 Jahren praktischer Erfahrung. Er hat intensiv mit Endnutzern zusammengearbeitet, schwierige Fälle von Datenverlust behoben und praktische Lösungen für versehentlich gelöschte Daten, formatierte Laufwerke, beschädigte Dateisysteme, verlorene Partitionen, Systemausfälle und andere Notfälle im Bereich der Datenwiederherstellung bereitgestellt. Zu seinen Fachgebieten gehören außerdem Datensicherung und -wiederherstellung, Dateireparatur sowie Notfallwiederherstellung, wobei er besonderen Wert auf eine sichere, zuverlässige und technisch korrekte Beratung legt.
