<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Abraxas &#187; Datenrettung</title>
	<atom:link href="http://www.effinger.org/blog/tag/datenrettung/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.effinger.org/blog</link>
	<description>a personal knowledge base</description>
	<lastBuildDate>Sun, 06 Jun 2010 17:41:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>JFS-Dateisystem mit jfsrec retten</title>
		<link>http://www.effinger.org/blog/2008/10/28/jfs-dateisystem-mit-jfsrec-retten/</link>
		<comments>http://www.effinger.org/blog/2008/10/28/jfs-dateisystem-mit-jfsrec-retten/#comments</comments>
		<pubDate>Tue, 28 Oct 2008 18:42:30 +0000</pubDate>
		<dc:creator>Markus Effinger</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Datenrettung]]></category>
		<category><![CDATA[JFS]]></category>

		<guid isPermaLink="false">http://www.effinger.org/blog/?p=70</guid>
		<description><![CDATA[<p>Mit Hilfe von jfsrec kann man eine beschädigte JFS-Partition unter Umständen doch noch retten. Damit man das Programm unter Ubuntu verwenden kann muss man das Programm selbst kompilieren, da es noch kein fertiges Paket gibt. Um überhaupt erfolgreich kompilieren zu können musste ich erst einige Pakete installieren, damit alle Abhängigkeiten erfüllt waren:</p>

sudo apt-get install gcc [...]]]></description>
			<content:encoded><![CDATA[<p>Mit Hilfe von jfsrec kann man eine beschädigte JFS-Partition unter Umständen doch noch retten. Damit man das Programm unter Ubuntu verwenden kann muss man das Programm selbst kompilieren, da es noch kein fertiges Paket gibt. Um überhaupt erfolgreich kompilieren zu können musste ich erst einige Pakete installieren, damit alle Abhängigkeiten erfüllt waren:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #c20cb9; font-weight: bold;">gcc</span> <span style="color: #c20cb9; font-weight: bold;">autoconf</span> <span style="color: #c20cb9; font-weight: bold;">automake</span> boost-build libboost-dev libboost-regex-dev libboost-filesystem-dev libboost-program-options-dev</pre></div></div>

<p>Als nächstes habe ich den aktuellsten Quelltext heruntergeladen:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #c20cb9; font-weight: bold;">co</span> https:<span style="color: #000000; font-weight: bold;">//</span>svn.sourceforge.net<span style="color: #000000; font-weight: bold;">/</span>svnroot<span style="color: #000000; font-weight: bold;">/</span>jfsrec jfsrec</pre></div></div>

<p>Im Verzeichnis jfsrec habe ich dann die Schritte configure und make und make install ausgeführt. Den Prefix mit /usr/local/jfsrec habe ich gewählt, weil ich das <a href="http://www.effinger.org/blog/2008/10/09/pakete-mit-stow-verwalten/">Programm mit stow verwalten</a> will, wie schon in einem anderen Beitrag erwähnt.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> jfsrec
.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>jfsrec
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">local</span>
stow <span style="color: #660033;">-R</span> jfsrec</pre></div></div>

<p>Nun kann man jfsrec verwenden. Ein beispielhafter Aufruf sieht so aus:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">jfsrec <span style="color: #660033;">--device</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>mapper<span style="color: #000000; font-weight: bold;">/</span>crypt_root_sdb <span style="color: #660033;">--output</span> <span style="color: #000000; font-weight: bold;">/</span>recovery<span style="color: #000000; font-weight: bold;">/</span>root_sdb_jfsrec<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">--logdir</span> <span style="color: #000000; font-weight: bold;">/</span>recovery<span style="color: #000000; font-weight: bold;">/</span>root_sdb_log</pre></div></div>

<p>Dabei wird versucht die verschlüsselte Partition /dev/mapper/crypt_root_sdb zu retten. Die Daten werden ins Verzeichnis /recovery/root_sdb_jfsrec/ geschrieben und die Informationen über die inodes werden im Verzeichnis /recovery/root_sdb_log abgelegt. Zu beachten ist, dass es durchaus einige Zeit dauern kann, bis jfsrec seine Arbeit erledigt hat. Bei mir wurden für etwa 240 GB acht bis zehn Stunden benötigt. Bei den Dateinamen musste ich jedoch feststellen, dass die Umlaute und Sonderzeichen falsch dargestellt wurden. Dieses Problem konnte ich jedoch mit dem Programm convmv beheben. Convmv ist ein kleines Komandozeilen-Programm um Dateinamen von einem Zeichensatz in einen anderen zu konvertieren. In meinem Fall half folgender Aufruf um die wiederhergestellten Datei- und Verzeichnisnamen in /recovery/root_sdb_jfsrec/ wieder richtig darzustellen.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">convmv <span style="color: #660033;">-f</span> utf8 <span style="color: #660033;">-t</span> latin1 <span style="color: #660033;">-r</span> <span style="color: #660033;">--notest</span> <span style="color: #000000; font-weight: bold;">/</span>recovery<span style="color: #000000; font-weight: bold;">/</span>root_sdb_jfsrec<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.effinger.org/blog/2008/10/28/jfs-dateisystem-mit-jfsrec-retten/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Daten von mit LUKS-verschlüsselter Platte retten</title>
		<link>http://www.effinger.org/blog/2008/10/12/daten-von-mit-luks-verschlusselter-platte-retten/</link>
		<comments>http://www.effinger.org/blog/2008/10/12/daten-von-mit-luks-verschlusselter-platte-retten/#comments</comments>
		<pubDate>Sun, 12 Oct 2008 19:14:40 +0000</pubDate>
		<dc:creator>Markus Effinger</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Datenrettung]]></category>
		<category><![CDATA[LUKS]]></category>

		<guid isPermaLink="false">http://www.effinger.org/blog/?p=34</guid>
		<description><![CDATA[<p>Nachdem der Ubuntu-Installer meine Platte /dev/hda, die in verschlüsselter Form das Backup enthielt, durch die Installation von grub in den Bootsektor unbrauchbar gemacht hatte (LUKS-Header überschrieben). Musste ich mich an die Wiederherstellung der Daten von der Platte machen, auf die ich das System neu installiert hatte. Gott sei Dank hatte ich bei der Neupartitionierung meines [...]]]></description>
			<content:encoded><![CDATA[<p>Nachdem der Ubuntu-Installer meine Platte /dev/hda, die in verschlüsselter Form das Backup enthielt, durch die Installation von grub in den Bootsektor unbrauchbar gemacht hatte (LUKS-Header überschrieben). Musste ich mich an die Wiederherstellung der Daten von der Platte machen, auf die ich das System neu installiert hatte. Gott sei Dank hatte ich bei der Neupartitionierung meines Systems andere Partitionsgrößen gewählt, so dass noch Hoffnung bestand, dass die LUKS-Header der ehemaligen Partitionen intakt sein könnte. Meine Rettungsstrategie bestand darin, zunächst zu überprüfen, ob dieser Header noch vorhanden ist, um dann ggfs. über ein Loop-Back Device die Entschlüsselung vorzunehmen und zu schauen, ob noch etwas zu retten ist. Dazu verwendete ich die aktuelle <a href="http://www.knoppix.org/">Knoppix-CD</a>.</p>
<p>Mein neues System hatte ich auf /dev/sda installiert. Im Zuge der Neuinstallation hatte ich vier Partitionen erstellt: /dev/sda1 bis /dev/sda4, die teilweise auch verschlüsselt sind. Auf der Platte /dev/sda musste ich also nach meinem alten LUKS-Header für die Datenpartition suchen. Bevor man jedoch mit der Suche loslegt, sollte man auf Nummer sicher gehen und die Partition in den nur-Lesemodus versetzen.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">400</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda<span style="color: #000000; font-weight: bold;">*</span></pre></div></div>

<p>Mit dem Hex-Editor hexedit suchen wir nun nach LUKS-Headern:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> hexedit <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda</pre></div></div>

<p>Mit der Taste &lt;Tab&gt; erstmal in den ASCII-Teil wechseln und dann mit der Tastenkombination &lt;Strg&gt;+&lt;S&gt; die Suche nach dem Wort LUKS starten. Sobald ich einen Header gefunden hatte, musste ich überprüfen, ob es ein Header der neuen verschlüsselten Partition war oder aber der meiner alten, den ich verzweifelt suchte. Dazu öffnete ich dann jeweils die anderen Partitionen im Hexeditor und verglich die Zeichenfolgen, die ein paar Bytes nach dem Schlüsselwort LUKS kommen.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> hexedit <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda1</pre></div></div>

<p>Nachdem ich an dem Offset 0&#215;2E44CCC00 den entsprechenden Header meiner alten Partition gefunden hatte, musste ich noch herausfinden, wie groß die alte Partition war. Ich hatte Glück, da die Partition den gesamten Rest der Festplatte einnahm und somit 237639177216 Bytes groß gewesen sein musste.</p>
<p>Mit diesen Informationen kann man nun mittels losetup ein Loopback-Device erzeugen, das genau auf den Teil verweist, der die urpsrüngliche verschlüsselte Partition ausgemacht hat.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> losetup <span style="color: #660033;">-o</span> <span style="color: #000000; font-weight: bold;">@</span>0x2E44CCC00 <span style="color: #660033;">-s</span> <span style="color: #000000;">237639177216</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>loop1 <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda</pre></div></div>

<p>Nun kann man das Loopback-Device ebenfalls read-only setzen und mit cryptsetup öffnen</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">400</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>loop1
<span style="color: #c20cb9; font-weight: bold;">sudo</span> cryptsetup <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>key luksOpen <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>loop1 cryptbackup</pre></div></div>

<p>Die Partition können wir nun mit mounten mit einem</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #660033;">-t</span> jfs <span style="color: #660033;">-o</span> ro <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>mapper<span style="color: #000000; font-weight: bold;">/</span>cryptbackup <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>recover</pre></div></div>

<p>oder als Image sichern (Achtung unverschlüsselt!)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">dd</span> <span style="color: #007800;"><span style="color: #000000; font-weight: bold;">if</span></span>=<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>mapper<span style="color: #000000; font-weight: bold;">/</span>cryptbackup <span style="color: #007800;">of</span>=<span style="color: #000000; font-weight: bold;">/</span>location<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>backup.img <span style="color: #007800;">bs</span>=10M</pre></div></div>

<p>Den Fortschritt von dd kann man übrigens mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">while</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">true</span>; <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">5</span>; <span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-USR1</span> DD-PID; <span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>verfolgen.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.effinger.org/blog/2008/10/12/daten-von-mit-luks-verschlusselter-platte-retten/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
