<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  
  
  <channel>
    <title>chrisjrob: disk</title>
    <link>https://chrisjrob.com</link>
    <atom:link href="https://chrisjrob.com/tag/disk/feed/index.xml" rel="self" type="application/rss+xml" />
    <description>GNU Linux, Perl and FLOSS</description>
    <language>en-gb</language>
    <pubDate>Fri, 13 Feb 2026 17:22:31 +0000</pubDate>
    <lastBuildDate>Fri, 13 Feb 2026 17:22:31 +0000</lastBuildDate>
    
    <item>
      <title>Debian Package NCDU</title>
      <link>https://chrisjrob.com/2011/05/09/debian-package-ncdu/</link>
      <pubDate>Mon, 09 May 2011 00:00:00 +0000</pubDate>
      <author>chrisjrob@gmail.com (Chris Roberts)</author>
      <guid>https://chrisjrob.com/2011/05/09/debian-package-ncdu</guid>
      <description>
       <![CDATA[
         
           <img src="https://chrisjrob.com/assets/debian_logo.png" align="right" alt="Featured Image">
         
         <p>We all know that feeling when our disk fills up and you are left
desperately scrabbling around to find out where your disk space has
gone. In 
<a href="/2011/02/24/analyse-disk-usage-with-konqueror/" title="Analyse disk usage with Konqueror">a previous blog post I discussed the use of the wonderful Konqueror File Size View</a>,
but this is no good for remote servers. Normally I would resort to “du”
or the wonderful “find” utility to look for large files, but here is an
interesting alternative that I had not come across before: ncdu (ncurses
disk usage).</p>

<!--more-->

<p>Its name tells you pretty much everything you need to know. It can be
installed with a simple <code class="language-plaintext highlighter-rouge">apt-get install ncdu</code> and then the man page is
a useful guide. In simple terms it can just be run with:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># ncdu /var
</code></pre></div></div>

<p>The lovely thing about ncdu is that once it completes its run (which can
take a long time on a large disk or a nfs share), you can drill into the
directory structure following the disk usage to determine where your
space has gone.</p>

<p>It is a very simple program but one that I will find most useful.</p>


       ]]>
      </description>
    </item>
    
    <item>
      <title>Analyse Disk Usage With Konqueror</title>
      <link>https://chrisjrob.com/2011/02/24/analyse-disk-usage-with-konqueror/</link>
      <pubDate>Thu, 24 Feb 2011 00:00:00 +0000</pubDate>
      <author>chrisjrob@gmail.com (Chris Roberts)</author>
      <guid>https://chrisjrob.com/2011/02/24/analyse-disk-usage-with-konqueror</guid>
      <description>
       <![CDATA[
         
           <img src="https://chrisjrob.com/assets/konqueror-file-size-view_300.png" align="right" alt="Featured Image">
         
         <p>We’ve all had occasions when we have needed to find where all our disk
space has gone, well under KDE3.5 it was easy - you just ran Konqueror
and then selected View » View Mode » File Size View.  But shock horror,
under KDE4 that option seemed to be missing.  Fortunately it was only an
apt-get away:</p>

<!--more-->

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo apt-get install konq-plugins
</code></pre></div></div>

<p>Then run Konqueror and follow instructions above.</p>

<p>This is not just a static either, you can click on any directory and it
will refresh for the usage of that directory.</p>

<p>Is it wrong to be in love with a browser?</p>


       ]]>
      </description>
    </item>
    
    <item>
      <title>Howto | Recover Data from a Hard Disk</title>
      <link>https://chrisjrob.com/2009/03/21/recover-data-from-a-hard-disk/</link>
      <pubDate>Sat, 21 Mar 2009 06:21:01 +0000</pubDate>
      <author>chrisjrob@gmail.com (Chris Roberts)</author>
      <guid>https://chrisjrob.com/2009/03/21/recover-data-from-a-hard-disk</guid>
      <description>
       <![CDATA[
         
         <p>This is how I recovered data from an NTFS partitioned hard disk, I am not a recovery expert, and it would irresponsible of me to recommend that you follow these instructions.</p>

<h2 id="boot-in-ubuntu-live-cd">Boot in Ubuntu Live CD</h2>

<ul>
  <li>Boot onto a live CD</li>
  <li>Configure networking</li>
  <li>Uncomment repositories in <code class="language-plaintext highlighter-rouge">/etc/apt/sources.list</code></li>
</ul>

<!--more-->

<h2 id="mount-destination-drive">Mount destination drive</h2>

<p>You need access to a hard drive that is able to support large files.  I started with fat32 and came a cropper when it hit 4gb.  I replaced that with an NFS share on my desktop PC and it worked beautifully.  Mount it ready for action.</p>

<p>I will assume that the destination drive has been mounted at <code class="language-plaintext highlighter-rouge">/mnt/destination</code></p>

<p>Ensure that the source (broken) drive is not mounted (it shouldn’t be unless you mounted it).</p>

<h2 id="determine-source-drive-id">Determine source drive id</h2>

<p>You need to find out the id of the source drive.  This will be listed under <code class="language-plaintext highlighter-rouge">/dev</code> and if it’s your primary drive will probably be <code class="language-plaintext highlighter-rouge">/dev/sda</code> or <code class="language-plaintext highlighter-rouge">/dev/hda</code>.  If you’re not confident, do not proceed.</p>

<h2 id="install-gnu-ddrescue">Install GNU ddrescue</h2>

<p>Note for historical (and hysterical) reasons, the package is named gddrescue in Debian and Ubuntu.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo aptitude install gddrescue
$ man ddrescue
</code></pre></div></div>

<h2 id="run-gnu-ddrescue">Run GNU ddrescue</h2>

<p>Replace <code class="language-plaintext highlighter-rouge">/dev/sda</code> for actual source drive, and <code class="language-plaintext highlighter-rouge">/mnt/destination</code> for action destination drive.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo ddrescue -n /dev/sda /mnt/destination/recovered.img /mnt/destination/recovered.log
</code></pre></div></div>

<p>The “-n” should run faster as it will skip over the errors (although it seemed just as slow to me).</p>

<p>Data recovered is not a fast process, and it will probably take a few days.  The great thing about ddrescue is that you can abort at any time and recommence from where you left off.  You can also skip forward by adding the switch “-i” followed by the number bytes into the disk, e.g. to start from 10gb:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo ddrescue -n -i 10000000000 /dev/sda /mnt/destination/recovered.img /mnt/destination/recovered.log
</code></pre></div></div>

<p>My tip is to keep aborting (Ctrl+C) and skip forward until you pass the area of the disk which is causing problems.  Then, once the bulk of the drive has been recovered you can go back to the sections you skipped, or just move onto the second pass (see next section).</p>

<p>ddrescue will not replace data already recovered, so you can do this safely.</p>

<h2 id="run-gnu-ddrescue-again">Run GNU ddrescue again</h2>

<p>This time replacing the -n with “-r 1” or perhaps “-r 3” to try more than once to recover the data.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo ddrescue -r 1 /dev/sda /mnt/destination/recovered.img /mnt/destination/recovered.log
</code></pre></div></div>

<h2 id="copy-the-destination-image">Copy the destination image</h2>

<p>You don’t want to mess up your hard earned image - so copy it and work on the copy.</p>

<h2 id="install-sleuthkit">Install sleuthkit</h2>

<p>On the destination PC, install sleuthkit:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo aptitude install sleuthkit
$ man mmls
</code></pre></div></div>

<h2 id="run-mmls">Run mmls</h2>

<p>Simply</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo mmls copy.img

DOS Partition Table
Offset Sector: 0
Units are in 512-byte sectors

    Slot    Start        End          Length       Description
00:  -----   0000000000   0000000000   0000000001   Primary Table (#0)
01:  -----   0000000001   0000000062   0000000062   Unallocated
02:  00:00   0000000063   0117195119   0117195057   NTFS (0x07)
03:  -----   0117195120   0117210239   0000015120   Unallocated
</code></pre></div></div>

<h2 id="calculate-offset">Calculate Offset</h2>

<p>This shows several partitions. In this example, we want to mount the NTFS partition starting at block 63. To calculate the number of bytes, multiply by 512:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>63 x 512 = 32256
</code></pre></div></div>

<h2 id="mount-partition">Mount partition</h2>

<p>For a DOS partition:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo mount -o loop,offset=16384 copy.img mountpoint
</code></pre></div></div>

<p>For an NTFS partition:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo aptitude install ntfs-3g
$ sudo mount -t ntfs-3g -o ro,force,loop,offset=32256 copy.img mountpoint
</code></pre></div></div>

<p>I appreciate that ntfs-3g provides write access, which we do not need, but “-t ntfs” sinmply would not mount the image.</p>

<p>If it won’t mount, then the NTFS partition is probably corrupted (not surprisingly).  Try installing testdisk and then running:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ testdisk copy.img
</code></pre></div></div>

<h2 id="extracting-files-from-the-disk-image">Extracting files from the disk image</h2>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>#### Foremost directory contents
drwxr-xr-x 30 root root   4096 2009-01-08 18:04 .
drwxrwxrwx  5 root root   4096 2009-01-08 18:03 ..
-rw-r--r--  1 root root 888832 2009-01-08 18:15 audit.txt
drwxr-xr--  2 root root  12288 2009-01-08 18:15 avi
drwxr-xr--  2 root root  12288 2009-01-08 18:15 bmp
drwxr-xr--  2 root root  69632 2009-01-08 18:15 dll
drwxr-xr--  2 root root   4096 2009-01-08 18:10 doc
drwxr-xr--  2 root root  20480 2009-01-08 18:15 exe
drwxr-xr--  2 root root 139264 2009-01-08 18:15 gif
drwxr-xr--  2 root root  20480 2009-01-08 18:15 htm
drwxr-xr--  2 root root   4096 2009-01-08 18:13 jar
drwxr-xr--  2 root root 135168 2009-01-08 18:15 jpg
drwxr-xr--  2 root root   4096 2009-01-08 18:04 mbd
drwxr-xr--  2 root root   4096 2009-01-08 18:15 mov
drwxr-xr--  2 root root   4096 2009-01-08 18:04 mpg
drwxr-xr--  2 root root   4096 2009-01-08 18:14 ole
drwxr-xr--  2 root root   4096 2009-01-08 18:14 pdf
drwxr-xr--  2 root root  57344 2009-01-08 18:15 png
drwxr-xr--  2 root root   4096 2009-01-08 18:04 ppt
drwxr-xr--  2 root root   4096 2009-01-08 18:14 rar
drwxr-xr--  2 root root   4096 2009-01-08 18:04 rif
drwxr-xr--  2 root root   4096 2009-01-08 18:04 sdw
drwxr-xr--  2 root root   4096 2009-01-08 18:04 sx
drwxr-xr--  2 root root   4096 2009-01-08 18:04 sxc
drwxr-xr--  2 root root   4096 2009-01-08 18:04 sxi
drwxr-xr--  2 root root   4096 2009-01-08 18:04 sxw
drwxr-xr--  2 root root   4096 2009-01-08 18:04 vis
drwxr-xr--  2 root root  12288 2009-01-08 18:15 wav
drwxr-xr--  2 root root   4096 2009-01-08 18:15 wmv
drwxr-xr--  2 root root   4096 2009-01-08 18:13 xls
drwxr-xr--  2 root root   4096 2009-01-08 18:14 zip
</code></pre></div></div>

<p>If it still won’t mount, then the general advice seems to be to copy the image to clean hardware and use a Windows recovery disk to boot.  Failing that, all is not lost, there are a number of tools that will search disk images for files.  I played with photorec, but whilst it recovered loads of cached images from IE, it failed to recover more than a handful of proper photos.  Foremost on the other hand seemed to be more successful.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ foremost -i copy.img -o output-folder
</code></pre></div></div>

<p>With luck this will give you a folder that looks like the one to the right.</p>


       ]]>
      </description>
    </item>
    
  </channel> 
</rss>
