<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:og="http://ogp.me/ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:schema="http://schema.org/" xmlns:sioc="http://rdfs.org/sioc/ns#" xmlns:sioct="http://rdfs.org/sioc/types#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" version="2.0" xml:base="https://www.linuxjournal.com/">
  <channel>
    <title>#Data Recovery</title>
    <link>https://www.linuxjournal.com/</link>
    <description/>
    <language>en</language>
    
    <item>
  <title>Linux Data Recovery: How to Salvage Lost or Corrupted Files</title>
  <link>https://www.linuxjournal.com/content/linux-data-recovery-how-salvage-lost-or-corrupted-files</link>
  <description>  &lt;div data-history-node-id="1341322" class="layout layout--onecol"&gt;
    &lt;div class="layout__region layout__region--content"&gt;
      
            &lt;div class="field field--name-field-node-image field--type-image field--label-hidden field--item"&gt;  &lt;img loading="lazy" src="https://www.linuxjournal.com/sites/default/files/nodeimage/story/linux-data-recovery-how-to-salvage-lost-or-corrupted-files.jpg" width="850" height="500" alt="Linux Data Recovery: How to Salvage Lost or Corrupted Files" typeof="foaf:Image" class="img-responsive" /&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-author field--type-ds field--label-hidden field--item"&gt;by &lt;a title="View user profile." href="https://www.linuxjournal.com/users/george-whittaker" lang="" about="https://www.linuxjournal.com/users/george-whittaker" typeof="schema:Person" property="schema:name" datatype="" xml:lang=""&gt;George Whittaker&lt;/a&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"&gt;&lt;p&gt;Data loss is a nightmare for any computer user, and Linux users are no exception. Despite the robust architecture of Linux operating systems, disasters can strike in the form of accidental deletions, corrupted partitions, or failing storage devices. Whether you're a system administrator, developer, or everyday Linux user, understanding how to recover data can be the difference between a minor inconvenience and a major setback.&lt;/p&gt;

&lt;p&gt;This guide will walk you through the practical strategies and essential tools for recovering lost or corrupted files on Linux.&lt;/p&gt;

&lt;h2&gt;&lt;strong&gt;Understanding Data Loss on Linux&lt;/strong&gt;&lt;/h2&gt;

&lt;span class="h3-replacement"&gt;&lt;strong&gt;Common Causes of Data Loss&lt;/strong&gt;&lt;/span&gt;

&lt;p&gt;Data loss can occur for various reasons:&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;
	&lt;p&gt;&lt;strong&gt;Accidental Deletion&lt;/strong&gt;: Files removed with &lt;code&gt;rm&lt;/code&gt; or cleared trash.&lt;/p&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;p&gt;&lt;strong&gt;Filesystem Corruption&lt;/strong&gt;: Caused by improper shutdowns, power failures, or software bugs.&lt;/p&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;p&gt;&lt;strong&gt;Partition Issues&lt;/strong&gt;: Misconfigured or overwritten partition tables.&lt;/p&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;p&gt;&lt;strong&gt;Hardware Failures&lt;/strong&gt;: Hard drive degradation, bad sectors, or failing SSDs.&lt;/p&gt;
	&lt;/li&gt;
&lt;/ul&gt;&lt;span class="h3-replacement"&gt;&lt;strong&gt;How Deletion Works on Linux&lt;/strong&gt;&lt;/span&gt;

&lt;p&gt;Linux filesystems like &lt;code&gt;ext4&lt;/code&gt; don’t immediately erase data when a file is deleted. Instead, the filesystem marks the file's space as free. Until that space is overwritten, the data may be recoverable. This behavior is the cornerstone of most recovery techniques.&lt;/p&gt;

&lt;h2&gt;&lt;strong&gt;First Steps After Data Loss&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;The most critical step is to &lt;strong&gt;minimize system activity&lt;/strong&gt; on the affected drive. Any write operation can potentially overwrite recoverable data.&lt;/p&gt;

&lt;span class="h3-replacement"&gt;&lt;strong&gt;Disconnect and Mount Read-Only&lt;/strong&gt;&lt;/span&gt;

&lt;p&gt;If the loss happened on a secondary drive, physically disconnect it and mount it read-only on another machine:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo mount -o ro /dev/sdX1 /mnt/recovery &lt;/code&gt;&lt;/p&gt;

&lt;span class="h3-replacement"&gt;&lt;strong&gt;Create a Disk Image&lt;/strong&gt;&lt;/span&gt;

&lt;p&gt;Use tools like &lt;code&gt;dd&lt;/code&gt; or &lt;code&gt;ddrescue&lt;/code&gt; to create a complete image of the drive for analysis:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo dd if=/dev/sdX of=/mnt/external/backup.img bs=4M status=progress &lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Or with &lt;code&gt;ddrescue&lt;/code&gt;, which handles read errors more gracefully:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo ddrescue /dev/sdX /mnt/external/recovery.img /mnt/external/logfile &lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Work from the image to preserve the original drive.&lt;/p&gt;

&lt;h2&gt;&lt;strong&gt;Boot from a Live Environment&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;To avoid using the target system, boot into a &lt;strong&gt;Live Linux distribution&lt;/strong&gt; like:&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;
	&lt;p&gt;&lt;strong&gt;SystemRescueCD&lt;/strong&gt; – tailored for system repair.&lt;/p&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;p&gt;&lt;strong&gt;Ubuntu Live CD&lt;/strong&gt; – user-friendly and widely available.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-link field--type-ds field--label-hidden field--item"&gt;  &lt;a href="https://www.linuxjournal.com/content/linux-data-recovery-how-salvage-lost-or-corrupted-files" hreflang="en"&gt;Go to Full Article&lt;/a&gt;
&lt;/div&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;

</description>
  <pubDate>Tue, 29 Apr 2025 16:00:00 +0000</pubDate>
    <dc:creator>George Whittaker</dc:creator>
    <guid isPermaLink="false">1341322 at https://www.linuxjournal.com</guid>
    </item>

  </channel>
</rss>
