<?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>The HyRax Macrocosm &#187; Backup</title>
	<atom:link href="http://www.serenux.com/tag/backup/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.serenux.com</link>
	<description>Life, the Universe and Ubuntu.</description>
	<lastBuildDate>Tue, 10 Jan 2012 06:59:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>HowTo: Monitor the progress of dd.</title>
		<link>http://www.serenux.com/2011/02/howto-monitor-the-progress-of-dd/</link>
		<comments>http://www.serenux.com/2011/02/howto-monitor-the-progress-of-dd/#comments</comments>
		<pubDate>Fri, 04 Feb 2011 23:40:13 +0000</pubDate>
		<dc:creator>HyRax</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Applications]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Hard-Drive]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Storage]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.serenux.com/?p=757</guid>
		<description><![CDATA[The dd command is a tool used to pipe data in from a source to a destination. It has a multitude of uses ranging from creating large dummy files of a specific size to duplicating hard-drives sector by sector to another disk or to a backup file. It&#8217;s also useful for fixing problems with hard-drives [...]]]></description>
			<content:encoded><![CDATA[<p>The <em>dd</em> command is a tool used to pipe data in from a source to a destination. It has a multitude of uses ranging from creating large dummy files of a specific size to duplicating hard-drives sector by sector to another disk or to a backup file. It&#8217;s also useful for fixing problems with hard-drives that Windows refuses to deal with.</p>
<p>But we&#8217;re not looking at the virtues of <em>dd</em> here. We&#8217;re looking at its annoyances and <em>dd</em> has one particularly glaring annoyance &#8211; a lack of display of progress. You could tell <em>dd</em> to start imaging your multi-terabyte hard-drive and not have any indication of how far it has gone &#8211; you just have to wait until it finishes. The <em>dd</em> command only outputs some information right at the very end of its job, which could well be several hours later. The only indicator that you have that something is happening is your hard-drive light madly flashing away.</p>
<p>Luckily while <em>dd</em> doesn&#8217;t show progress during its tasks, it can be prodded externally to give up information about itself as it runs, and we can achieve that by using the <em>kill</em> command without actually killing the <em>dd</em> command&#8217;s execution.</p>
<p><span id="more-757"></span></p>
<p>Now the <em>kill</em> command doesn&#8217;t just terminate tasks. It can also send other standard POSIX signals to applications. Many applications are written to acknowledge certain signals and perform an action on receiving them. In the case of <em>dd</em>, there is one signal that will make it output its summary information to the console as though it had finished, but rather than terminate, it keeps on going. The signal in question is USR1.</p>
<p>Here&#8217;s how to make use of it:</p>
<ol>
<li>First we need a <em>dd</em> process running. Let&#8217;s say we are imaging our first fixed hard-drive <em>/dev/sda</em> to an image file called <em>MyHDDBackup.img</em> using the following command:
<pre><span style="color: #000080;">$ sudo dd if=/dev/sda of=/home/jbloggs/MyHDDBackup.img</span></pre>
</li>
<li>Now while that is running, open up a second terminal and type in the following followed by Enter:
<pre><span style="color: #000080;">$ sudo kill -USR1 `pgrep ^dd`
</span></pre>
<p>Breakdown of the above command:<em><br />
</em></p>
<ul>
<li><em>sudo</em> runs this command as root. In this case since we&#8217;re using <em>dd</em> as root, we also need to run the <em>kill</em> command as root or we won&#8217;t be able to send anything to <em>dd</em>.</li>
<li><em>kill</em> is the command we are using to send <em>dd</em> a signal with.</li>
<li><em>-USR1</em> is the signal we are sending to <em>dd</em>.</li>
<li><em>pgrep</em> is a program that will show you the process ID of a given application, in this case we use the argument &#8220;^dd&#8221; to say &#8220;locate any program that starts with the text &#8216;dd&#8217; only&#8221; otherwise we would get other processes that containg the letters &#8220;dd&#8221; together in their name if we left out the chevron character. Note that the <em>pgrep</em> command is enclosed in &#8220;`&#8221; quotes so that it is executed and returns just a process ID number to the <em>kill</em> command.</li>
</ul>
<p><span style="color: #000080;"> </span></li>
<li>Now have a look at the terminal that <em>dd</em> is running in. It has suddenly output some data about itself, specifically, how much of the task had been completed, but <em>dd</em> is still running! This is great &#8211; but how can we regularly have <em>dd</em> tell us where it&#8217;s up to without having to manually enter the above command each time? Simple, by combining it with the <em>watch</em> command:
<pre><span style="color: #000080;">$ watch 'sudo kill -USR1 `pgrep ^dd`'</span>
</pre>
<p>The <em>watch</em> command will will re-execute the <em>kill</em> command once every two seconds, giving you near-realtime status to what <em>dd</em> is doing. If you want to change how often the <em>watch</em> command polls for, you can change it with the <em>-n</em> parameter, for example to change the polling to every 5 seconds, you would use:</p>
<pre><span style="color: #000080;">$ watch -n5 'sudo kill -USR1 `pgrep ^dd`'</span></pre>
</li>
</ol>
<p>While not providing any means of showing you how long it will take for <em>dd</em> to ultimately finish, you can now make use of the transfer speed shown along with the data processed thus far and calculate a rough idea of when <em>dd</em> will complete its task now.</p>
<p>Pat yourself on the back. You can now rest easy knowing that you can find out at anytime where <em>dd</em> is up to. <img src='http://www.serenux.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.serenux.com/2011/02/howto-monitor-the-progress-of-dd/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>HowTo: Configure an APC UPS to communicate with your Ubuntu Desktop or Server</title>
		<link>http://www.serenux.com/2011/01/howto-configure-an-apc-ups-to-communicate-with-your-ubuntu-desktop-or-server/</link>
		<comments>http://www.serenux.com/2011/01/howto-configure-an-apc-ups-to-communicate-with-your-ubuntu-desktop-or-server/#comments</comments>
		<pubDate>Mon, 31 Jan 2011 12:32:27 +0000</pubDate>
		<dc:creator>HyRax</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Lucid]]></category>
		<category><![CDATA[Recovery]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.serenux.com/?p=749</guid>
		<description><![CDATA[It&#8217;s been a while since I&#8217;ve written something here, so time to break the drought. APC make some great UPS products and they all have the ability to communicate with a host PC to advise of its state, eg: on mains, on battery, fault, etc. The support software is available aplenty for Windows and Mac, [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while since I&#8217;ve written something here, so time to break the drought.</p>
<p>APC make some great UPS products and they all have the ability to communicate with a host PC to advise of its state, eg: on mains, on battery, fault, etc. The support software is available aplenty for Windows and Mac, but what about Linux?</p>
<p>This guide will show you how to hook up an APC UPS to an Ubuntu-based Desktop or Server PC and allow your UPS to email you when mains power has failed, when mains power has been restored, and also give your PC ample opportunity to shutdown when battery on the UPS gets to a critical low.</p>
<p><span id="more-749"></span><span style="text-decoration: underline;">Pre-requisites:</span></p>
<ul>
<li>Ubuntu-based PC. I am using Ubuntu 10.04 Lucid Lynx in this guide.</li>
<li>An APC UPS. I&#8217;m using a Back-UPS RS 800 in this guide.</li>
<li>Details about your ISP&#8217;s mail server, or your own local mail server.</li>
</ul>
<p><span style="text-decoration: underline;">Configuration:</span></p>
<ol>
<li>Setup your APC UPS as outlined in the instruction manual. Ensure that the USB or serial cable is connected from the UPS to the PC. This is what the UPS uses to communicate with the PC.<br />
.</li>
<li>On your Ubuntu PC, go into a Terminal. If you are using Ubuntu Desktop, you can do this by going to the Applications menu, then Accessories and then Terminal. If you are using Ubuntu Server, simply login to your server by the console or SSH in remotely.<br />
.</li>
<li>The Ubuntu repositories contain a UPS daemon specifically designed with APC UPS units in mind called APCUPSD, so let&#8217;s install it:
<pre><span style="color: #000080;">$ sudo apt-get install apcupsd</span></pre>
</li>
<li>Once installed, we need to configure it to suit your UPS. Bring up the configuration file by typing in:
<pre><span style="color: #000080;">$ sudo nano /etc/apcupsd/apcupsd.conf</span></pre>
</li>
<li>In the editor, scroll down to UPSNAME and give the UPS a name, eg:
<pre><span style="color: #000080;">UPSNAME MyAwesomeUPS</span></pre>
</li>
<li>Scroll down to UPSCABLE and change the parameter to the type of cable you are using to connect to your UPS. In my case, I use a USB cable that came with the UPS, so I changed this line to read:
<pre><span style="color: #000080;">UPSCABLE usb</span></pre>
</li>
<li>The next line to modify is the UPSTYPE line. Again, because I&#8217;m using USB I specify:
<pre><span style="color: #000080;">UPSTYPE usb</span></pre>
<p>If you have a DEVICE /dev/ttyS0 line after the UPSTYPE line, comment it out by adding a hash symbol at the start of the line like so:</p>
<pre><span style="color: #000080;">#DEVICE /dev/ttyS0</span></pre>
</li>
<li>We do not need to modify anything else, so press CTRL+X, then &#8220;Y&#8221; and then Enter to save your changes and exit the Nano text editor.<br />
.</li>
<li>Now we need to tell the system that the UPS daemon has been setup and is essentially ready to go. Type in:
<pre><span style="color: #000080;">$ sudo nano /etc/default/apcupsd</span></pre>
</li>
<li>In the file that appears, modify the ISCONFIGURED line to say Yes&#8221;, ie:
<pre><span style="color: #000080;">ISCONFIGURED=yes</span></pre>
</li>
<li>Press CTRL+X, then &#8220;Y&#8221; and then Enter to save your changes and exit.<br />
.</li>
<li>We&#8217;re pretty much done here. Start the daemon now with the following command:
<pre><span style="color: #000080;">$ sudo service apcupsd restart</span></pre>
<p>&#8230;or simply reboot your PC. Your PC is now monitoring the state of the UPS.<br />
.</li>
<li>Let&#8217;s check the UPS now. Type in the following command:
<pre><span style="color: #000080;">$ apcaccess</span></pre>
<p>&#8230;and you will get output similar to the following:</p>
<pre><span style="color: #000080;">$ apcaccess
APC      : 001,043,1045
DATE     : Tue Feb 01 00:02:36 EST 2011
HOSTNAME : lamaar
VERSION  : 3.14.6 (16 May 2009) debian
UPSNAME  : LAMAAR
CABLE    : USB Cable
MODEL    : Back-UPS BR  800
UPSMODE  : Stand Alone
STARTTIME: Mon Jan 31 23:43:37 EST 2011
STATUS   : ONLINE
LINEV    : 250.0 Volts
LOADPCT  :  40.0 Percent Load Capacity
BCHARGE  : 100.0 Percent
TIMELEFT :  19.9 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME  : 0 Seconds
OUTPUTV  : 230.0 Volts
SENSE    : Medium
DWAKE    : 000 Seconds
DSHUTD   : 000 Seconds
LOTRANS  : 194.0 Volts
HITRANS  : 264.0 Volts
RETPCT   : 000.0 Percent
ITEMP    : 29.2 C Internal
ALARMDEL : Always
BATTV    : 27.4 Volts
LINEFREQ : 50.0 Hz
LASTXFER : Low line voltage
NUMXFERS : 0
TONBATT  : 0 seconds
CUMONBATT: 0 seconds
XOFFBATT : N/A
SELFTEST : NO
STATFLAG : 0x07000008 Status Flag
SERIALNO : xxxxxxxxxxxx  
BATTDATE : 2001-09-25
NOMOUTV  : 230 Volts
NOMINV   : 230 Volts
NOMBATTV :  24.0 Volts
NOMPOWER : 540 Watts
FIRMWARE : 9.o5 .I USB FW:o5
APCMODEL : Back-UPS BR  800
END APC  : Tue Feb 01 00:02:41 EST 2011
$</span></pre>
</li>
<li>Pat yourself on the back, you&#8217;re basically done.</li>
</ol>
<p>But hang on, what about setting up email notifications? Read on.</p>
<p><span style="color: #0000ff;"><em><strong>Setting up Email Notifications</strong></em></span></p>
<p>By default, APCUPSD is configured to use <em>sendmail</em> to send emails, but sendmail is finicky. There is a better way using a similar application called <em>send<strong>e</strong>mail</em> instead.</p>
<p>Why use sendemail instead of sendmail? Well, sendemail is a simple command-line SMTP client. You construct a simple message with a recipient and off it goes, but the key difference here is that sendemail is a CLIENT, not a SERVER. This means for sendemail to work, you need a third-party mail server to send it through. You may already have a mail server on your network running Postfix or similar. If not, your ISP will most certainly have one that you can use.</p>
<ol>
<li>Let&#8217;s start by installing sendemail:
<pre><span style="color: #000080;">$ sudo apt-get install sendemail</span></pre>
</li>
<li>Now we need to configure apcupsd to use it. If you have a look inside the /etc/apcupsd directory, you will see several important files as follows:
<ul>
<li><span style="color: #0000ff;">changeme</span> &#8211; notifies you if the UPS battery needs changing.</li>
<li><span style="color: #0000ff;">commfailure</span> &#8211; notifies you if the PC loses communication with the UPS.</li>
<li><span style="color: #0000ff;">commok</span> &#8211; notifies you if lost communication is restored with the UPS.</li>
<li><span style="color: #0000ff;">onbattery</span> &#8211; notifies you if the UPS engages battery mode due to mains power failure.</li>
<li><span style="color: #0000ff;">offbattery</span> &#8211; notifies you if the UPS returns to mains mode after a mains power failure.<br />
.</li>
</ul>
</li>
<li>Let&#8217;s modify the onbattery message:
<pre><span style="color: #000080;">$ sudo nano /etc/apcupsd/onbattery</span></pre>
</li>
<li>You will notice there are some lines in this file that define some variables followed by a message and then finally a command that sends an email using the sendmail app. Since we are not using sendmail, we need to modify a number of areas. Replace the content of the entire text file with the following:
<pre><span style="color: #000080;">#!/bin/sh
#
# This shell script if placed in /etc/apcupsd
# will be called by /etc/apcupsd/apccontrol when the UPS
# goes on batteries.
#
SYSADMIN=jbloggs@mydomain.com.au
APCUPSD_MAIL="/usr/bin/sendemail"
HOSTNAME=`hostname`
MSG="Ubuntu PC Power Failure !!!"
#
(
echo " "
echo " ====================================="
echo " POWER FAILURE ON $HOSTNAME !!"
echo " ====================================="
echo " "
echo " The UPS on your Ubuntu PC has experienced a power problem that has required the UPS to engage battery mode."
echo " "
echo " Do not panic! Remain calm..."
echo " "
echo "Current UPS status:"
echo " "
/sbin/apcaccess status
) | $APCUPSD_MAIL -u "$MSG" -f MyUbuntuPC@mydomain.com.au -t $SYSADMIN -s mail.myisp.com:25
exit 0</span></pre>
<p>So what have we done here? The first part of the file sets some variables, namely the email address(es) of the people required to be notified. If you need to send to more than one recipient, separate email addresses with a comma, eg:</p>
<pre><span style="color: #000080;">SYSADMIN=jbloggs@mydomain.com.au,fredsmith@thatotherdomain.com</span></pre>
<p>We then define the path to the sendemail app, the hostname of the PC running the UPS daemon, a subject line for the email in question, and then a big email body explaining what&#8217;s going on, in this case that the UPS battery mode has been engaged.</p>
<p>All this is then piped into the sendemail application with a fake sender&#8217;s address to give you an idea where it came from and we also specify the mail server that the email will be sent via. In this case, we are using our ISP&#8217;s mail server that has the address <em>mail.myisp.com</em><br />
.</li>
<li>Save your changes by pressing CTRL+X, then &#8220;Y&#8221; and then Enter.<br />
.</li>
<li>You can now test the script by simply executing it (we don&#8217;t have to disconnect the UPS&#8217; mains cable to trigger this until we&#8217;re ready to test that). Execute the file using the command:
<pre><span style="color: #000080;">$ sh /etc/apcupsd/onbattery</span></pre>
</li>
<li>Check for any errors and then check to see if you got an email in your mailbox advising that the UPS is on battery (the UPS of course is not, we&#8217;re just testing the email).<br />
.</li>
<li>If all is well, continue to change the other four message files to be similar to the above, changing the message as you go of course.<br />
.</li>
<li>Pat yourself on the back &#8211; you now have custom, explicit messages to let you know what&#8217;s going on with the UPS.</li>
</ol>
<p><span style="color: #0000ff;"><em><strong>Setting up your own mail server to use instead</strong></em></span></p>
<p>If, in your testing, you discover that your ISP&#8217;s mail server does not allow you to randomly spam messages to it using fake from addresses, you have two choices &#8211; either specify a valid email address as the sender&#8217;s address, or you can setup a simple email server of your own using Postfix:</p>
<pre><span style="color: #000080;">$ sudo apt-get install postfix</span></pre>
<p>In the case of setting up your own email server, simply go with Postfix and set it up as an &#8220;Internet Site&#8221;. The basic configuration is good enough to deal with our needs, but make sure your basic network security is adequate to prevent outsiders from trying to use your mail server to send unsolicited mails, or spam, through it.</p>
<p>This article will not describe how to setup or secure Postfix as it is beyond the scope of this article, however you do need to modify the outgoing mail server name in all your communication messages to reflect the change of name or internal IP address of your mail server instead of mail.myisp.com.</p>
<p><span style="color: #0000ff;"><em><strong>Testing</strong></em></span></p>
<p>You can test your daemon setup easily enough by doing any of the following:</p>
<ul>
<li>Remove mains power cable from UPS.</li>
<li>Remove the USB cable to the UPS.</li>
<li>Verify that an email is sent for either of the error conditions above.</li>
</ul>
<p>Enjoy! <img src='http://www.serenux.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.serenux.com/2011/01/howto-configure-an-apc-ups-to-communicate-with-your-ubuntu-desktop-or-server/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>HowTo: Rip a Blu-ray movie using an LG GGC-H20L Blu-ray drive with Ubuntu</title>
		<link>http://www.serenux.com/2009/01/howto-rip-a-blu-ray-movie-using-an-lg-ggc-h20l-blu-ray-drive-with-ubuntu/</link>
		<comments>http://www.serenux.com/2009/01/howto-rip-a-blu-ray-movie-using-an-lg-ggc-h20l-blu-ray-drive-with-ubuntu/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 00:50:03 +0000</pubDate>
		<dc:creator>HyRax</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Blu-ray]]></category>
		<category><![CDATA[High-Definition]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Intrepid]]></category>
		<category><![CDATA[LG]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MPlayer]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://www.serenux.com/?p=356</guid>
		<description><![CDATA[The Blu-ray disc format has brought with it the ability to easily provide the next generation of High-Definition 1080p movie content. There&#8217;s just one problem &#8211; Ubuntu and Linux in general has no official support for Blu-ray, and its encryption scheme is vastly different to that of DVD &#8211; it&#8217;s not just a simple case [...]]]></description>
			<content:encoded><![CDATA[<p>The Blu-ray disc format has brought with it the ability to easily provide the next generation of High-Definition 1080p movie content. There&#8217;s just one problem &#8211; Ubuntu and Linux in general has no official support for Blu-ray, and its encryption scheme is vastly different to that of DVD &#8211; it&#8217;s not just a simple case of installing a library like the libdvdcss2 library for decrypting DVD&#8217;s &#8211; the protection is done both at a software and hardware level.</p>
<p>This article discusses how I used my recently purchased LG GGC-H20L Blu-ray ROM drive to successfully read and watch movies using Ubuntu Intrepid.</p>
<p><span id="more-356"></span><em>DISCLAIMER: This article describes decrypting BD titles using an Intel or AMD based PC with Ubuntu Linux. While you can use a PlayStation3&#8242;s BD drive to read and decrypt a title using <strong>known</strong> decryption keys using the PS3 version of Ubuntu, at this time of writing you <strong>cannot</strong> use Ubuntu installed on a PlayStation3 console to identify <strong>unknown</strong> decryption keys of a given BD title because the application used to derive those keys from the disc is not available for the PPC processor used by the PS3. You must use a consumer BD-ROM drive on an Intel or AMD based PC instead.<br />
</em></p>
<p>Hang on, you say &#8211; if there is no support for playback of Blu-ray movies on Linux, then why buy a Blu-ray drive if you can&#8217;t watch the movies? Well, I might not be able to watch them directly, but I can certainly rip the little buggers and watch a file version of it instead. But wait again, you say, if there&#8217;s no official Blu-ray support, and you can&#8217;t watch the discs directly, then how on earth do you rip them?? I&#8217;m glad you asked, and even if you didn&#8217;t ask, I&#8217;m about to tell you anyway. <img src='http://www.serenux.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>First up, a little Blu-ray 101.</p>
<p>Blu-ray movies feature Digital Rights Management (DRM). Like DVD&#8217;s before it, most Blu-ray movies are encrypted. This is to stop those naughty pirate types from making illegal backups of the movie and giving or selling it to their mates. In the case of DVD&#8217;s, however, there was only one decryption key which was eventually discovered and from then on allowed all DVD&#8217;s to be easily decrypted using a simple library (called libdvdcss2). The movie industry as a whole were not impressed by this and insisted that the next format be more difficult (preferably impossible) to decrypt, so Blu-rays (and HD-DVD&#8217;s, but I&#8217;ll concentrate on Blu-ray for this article) each have a different decryption key now. But to complicate this further, this key is kept hidden from you by an authentication mechanism to ensure that there isn&#8217;t a repeat of the De-CSS scandal that brought the DVD encryption scheme undone.</p>
<p>Each and every player out there, hardware or software, has a unique player authentication key which is passed to the Blu-ray optical drive, essentially like giving your passport to Customs at the country border, to validate whether or not you are legally authorised to  playback a movie. If the drive has not got a blacklisted record of your authentication key, and the key is accepted as a generally valid key that has been paid for, THEN the drive will give up the movie&#8217;s decryption key and movie playback can commence.</p>
<p>Blacklist?? What blacklist? Well, like DVD players, it&#8217;s not difficult to pick up a Blu-ray player&#8217;s authentication key that is used to prompt the drive for the disc&#8217;s decryption key, after all, it has to be held in memory somewhere. Once an industry authority discovers that an authentication key has been compromised, it is added to a blacklist so that it will not work anymore. This is why hardware Blu-ray players need to be firmware-upgradable, and why software players need to be upgraded to the next version periodically with patches, etc, so that new, non-blacklisted authentication keys can be provided.</p>
<p>OK, that sounds all well and good, but if the Blu-ray drive itself is doing the blacklisting, how exactly does it know when a given authentication key is no longer valid? Simple &#8211; its blacklist will get updated with the next latest-release movie you buy.</p>
<p>Say what?</p>
<p>Every Blu-ray movie you buy has a little file on the disc under the &#8220;AACS&#8221; folder called &#8220;ContentRevocation.lst&#8221;. This file contains a complete list of blacklisted authentication keys for the drive to update itself with, and &#8211; get this &#8211; you can&#8217;t stop the drive loading it. Well, actually to be more accurate this file is simply a copy of the same list that is actually hidden in a non-tamperable, non-user-readable area elsewhere on the disc for the drive to read, but basically the instant you stick that movie disc in, the hidden version of this file is read and the drive automatically updates its blacklist right away with any new blacklist data, even before the disc icon appears on your desktop. Sneaky, huh?</p>
<p>So the next time your legal (or more specifically, pirated) copy of PowerDVD or whatever tries to playback a movie, all of a sudden you&#8217;ll see an error message instead saying that your player&#8217;s authentication key has been revoked &#8211; thus the movie is now unplayable. What&#8217;s worse is that you won&#8217;t be able to watch any of your older discs that worked previously either! It&#8217;s this exact reason that many people have called for the Blu-ray (and HD-DVD) formats to be <a title="Why you should boycoot Blu-ray and HD-DVD." href="http://bluraysucks.com/" target="_blank">boycotted</a>.</p>
<p>But not all is lost. Remember, this is an encryption technology created by Man, and therefore can be broken by Man with a bit of help from the Open Source Community at large. <img src='http://www.serenux.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  With a little help from a few external resources including the <a title="Ubuntu Community Documentation" href="https://help.ubuntu.com/community/RestrictedFormats/BluRayAndHDDVD" target="_blank">Ubuntu Community Documentation</a> and the <a title="Doom9 Forums" href="http://forum.doom9.org" target="_blank">Doom9 forums</a>, I discovered a plethora of projects by various people, from dumping discs to breaking the encryption and authentication.</p>
<p>On the surface are general applications to dump the movie, decrypted, to a file. One of the best projects is <a title="DumpHD on the Doom9 Forums" href="http://forum.doom9.org/showthread.php?t=123111" target="_blank">DumpHD</a> which is a Java app that provides a nice easy to use GUI that can rip a movie with a minimum of fuss (see detail about how to use it later in this article), however it requires that you already know what the decryption key for a given movie is which you can only obtain if you have authenticated with the drive. If you have the decryption key already, however, then authentication is not necessary and you can rip the movie right away without a problem, so this project is heavily supported by people posting up various decryption keys for all sorts of movie releases. The problem with this approach, however, is that different countries usually get different releases of the same movie, so for example a release of &#8220;Batman Begins&#8221; in Australia might have a completely different decryption key to the release of &#8220;Batman Begins&#8221; in America or Europe. This is not always the case of course, a good example being the Ewan McGregor movie &#8220;The Island&#8221; &#8211; the Australian release is actually the UK release, right down to the age-rating and film-office classification markings on the disc itself &#8211; only the box bears any Australian ratings markings!</p>
<p style="text-align: center;"><a title="Click for full size" href="http://www.serenux.com/~hyrax/snaps/BlurayMovieInserting.jpg" target="_blank"><img title="Inserting a Blu-ray movie into the LG GGC-H20L" src="http://www.serenux.com/~hyrax/snaps/BlurayMovieInserting_thumb.jpg" alt="Click for full size" /></a><br />
Click for full size (228K)</p>
<p>So, how do you find out the decryption key of your locally purchased movie then? You don&#8217;t want to keep buying a commercial player, especially one that doesn&#8217;t run under Ubuntu, just to get a valid authentication key. There&#8217;s got to be a better way! Well, there is! How about we just bypass the authentication procedure altogether? How? Again, through another great contribution on the Doom9 forums.</p>
<p>The LG GGC-H20L drive is but one of many Blu-ray/HD-DVD drives which have had their firmware reverse-engineered. Firmware is largely just a computer program that operates the drive. Since the firmware is upgradable to fix bugs and add new features to the drive, it means the program can be altered by a third party. A Doom9 contributor has provided <a title="Modified Blu-ray drive firmware" href="http://forum.doom9.org/showthread.php?t=139522" target="_blank">modified firmware</a> for various popular drives, including the GGC-H20L that effectively allow the drive to ignore the authentication procedure no matter what player authentication key is provided, blacklisted or not, thus making the drive give up the decryption key for the Blu-ray movie currently inserted every time!</p>
<p>EDIT 10th Jan 2012: It appears the firmware is no longer available from the Doom9 forums as it has not been updated in quite some time. <a title="LG GCC-H20L Modified Firmware mirror." href="http://www.serenux.com/~hyrax/lg_ggc-h20l/GGC-H20L_1.03_VolumeID_Patch.exe">Here is a mirror of the v1.03 modified firmware</a> to suit the LG GGC-H20L only.</p>
<p>In the case of the LG GGC-H20L that I use, the firmware is provided as a Windows Executable file. There are three ways to run this, either via a native Windows installation on your PC, a virtualised Windows installation on your PC, or via the Wine compatibility layer. I successfully upgraded my drive using the Wine option as follows:</p>
<p><em><span style="color: #ff0000;"><strong>WARNING: The following information can damage or even brick your LG Blu-ray drive if not followed correctly, or if you have a power failure during firmware update. You proceed at your own risk and I will not be held responsible for any damage incurred by your drive, or for loss of hair being torn out, by following these instructions.</strong></span></em></p>
<ol>
<li>You need a normal Wine installation. If you&#8217;ve never installed it before, then type in:
<pre><span style="color: #000080;">$ sudo apt-get install wine</span></pre>
<p>&#8230;and this will install the Ubuntu-repository version of Wine.</li>
<li>Since we&#8217;ll be modifying a physical device, only root can do that, so we will need to use sudo to execute the firmware upgrade, however Wine will not work as root until we change permissions of your Wine configuration in your Home directory, so type in the following to make root the owner of your Wine configuration:
<pre><span style="color: #000080;">$ sudo chown -R root:root ~/.wine</span></pre>
</li>
<li>Now execute the downloaded firmware file:
<pre><span style="color: #000080;">$ sudo wine GGC-H20L_1.03_VolumeID_Patch.exe</span></pre>
</li>
<li>The Upgrade GUI will appear. Click on the button to commence update and let it do its thing. After a minute or two, it will tell you that the drive firmware has been successfully updated. At this point, you will need to reboot your PC, but before you do, remember to change the owner of your Wine installation back to yourself. If your login was &#8220;jbloggs&#8221;, then you&#8217;d type in:
<pre><span style="color: #000080;">$ sudo chown -R jbloggs:jbloggs ~/.wine</span></pre>
</li>
</ol>
<p>Upon returning from restart, every time you query the drive for the inserted disc&#8217;s decryption key, the drive will now happily give it to you without question. Nice.</p>
<p>So how do we query the drive for that decryption key anyway? A simple tool to do this is <a title="AACSKeys - gets a movie's decryption key" href="http://forum.doom9.org/showthread.php?p=1320065#post1320065" target="_blank">aacskeys</a> (version 0.4.0c at this time of writing, but check further along the thread for newer releases) written by another Doom9 member, which queries the drive and tells you its Volume Unique Key and its Disc ID, which you can then copy and paste into DumpHD&#8217;s keys config file and happily begin dumping your movie.</p>
<pre><span style="color: #000080;">$ ./aacskeys /media/cdrom aacskeys 0.3.6 by arnezami, KenD00 Volume Unique Key:              5D9BCD44522B6940F8705400DA612ED9 Unit Key File Hash (Disc ID):   837487B4D6F614D5B4D5F566387B41C2D284F393 $ </span></pre>
<p>If your drive&#8217;s firmware was not patched, instead of seeing the Volume Unique Key and Disc ID, you would get this error message instead: &#8220;The given Host Certficate / Private Key has been revoked by your drive.&#8221;.</p>
<p>We now need to take the output data and copy it to DumpHD&#8217;s &#8220;keydb.cfg&#8221; file. Each key is placed on its own line in the following format:</p>
<pre><span style="color: #000080;">DISC ID = Movie Title | D | YYYY-MM-DD | V | VOLUME UNIQUE KEY</span></pre>
<p>Thus in the example above, we would enter:</p>
<pre><span style="color: #000080;">837487B4D6F614D5B4D5F566387B41C2D284F393 = The Island | D | 2007-03-22 | V | </span><span style="color: #000080;">5D9BCD44522B6940F8705400DA612ED9 </span></pre>
<p>Now technically it appears that the date is largly irelevant, and most people just use 0000-00-00 instead of a real date (which is supposed to be the file date of the &#8220;Unit_Key_RO.inf&#8221; file in the &#8220;AACS&#8221; folder of the disc). I have tested this and I can&#8217;t see any difference in how DumpHD handles the disc.</p>
<p>Once you have finished editing the keydb.cfg file, save it.</p>
<p><em>NOTE: DumpHD (below) can now use AACSKeys directly, saving you having to edit to the keydb.cfg file manually, because DumpHD now does all the work for you. See <a title="A better way of using AACSKeys with DumpHD." href="http://www.serenux.com/2009/09/howto-deal-with-bd-copy-protection-when-ripping-blu-ray-titles-using-ubuntu/" target="_blank">this article</a> for more information.</em></p>
<p>Since DumpHD is a Java application, you will need Java installed to run it. If you haven&#8217;t already got it installed, you can install it with the following command:</p>
<pre><span style="color: #000080;">sudo apt-get install java-common</span></pre>
<p>&#8230;or more realistically you should install it as part of the ubuntu-restricted-extras package which also installs a number of other useful packages:</p>
<pre><span style="color: #000080;">sudo apt-get install ubuntu-restricted-extras</span></pre>
<p>Once that is done, launch DumpHD by simply running the &#8220;dumphd.sh&#8221; script by either double-clicking on it and select &#8220;Run&#8221; when prompted, or in a terminal, change to where you extracted the DumpHD program and type in:</p>
<pre><span style="color: #000080;">$ sh ./dumphd.sh</span></pre>
<p>When loaded, you will be presented with the following interface:</p>
<p style="text-align: center;"><a title="Click for full size" href="http://www.serenux.com/~hyrax/snaps/DumpHDFrontend.jpg" target="_blank"><img title="DumpHD Frontend" src="http://www.serenux.com/~hyrax/snaps/DumpHDFrontend_thumb.jpg" alt="Click for full size" /></a><br />
Click for full size (63K)</p>
<p>At the top-right of the window, there is the Source Browse button. Click on it and a new window will appear. In that window, type in or select &#8220;/media/cdrom&#8221; and then click OK. After a few seconds, the disc should be identified and you will see the window change as follows:</p>
<p style="text-align: center;"><a title="Click for full size" href="http://www.serenux.com/~hyrax/snaps/LoadedMovieReadyToRip.jpg" target="_blank"><img title="DumpHD Frontend" src="http://www.serenux.com/~hyrax/snaps/LoadedMovieReadyToRip_thumb.jpg" alt="Click for full size" /></a><br />
Click for full size (85K)</p>
<p>Now all you need to do is click on the Destination Browse button, specify a place to store the decrypted movie and then click the Dump button to start the whole process! Once finished, you will have every video title found on the disc dumped in its originally encoded (video-wise) format, but without DRM. You can then use MPlayer to play these files directly. Generally the movie itself is the largest file, so in the case of my example, it&#8217;s the &#8220;00000.m2ts&#8221; file. I can play it simply with:</p>
<pre><span style="color: #000080;">$ mplayer -fs 00000.m2ts</span></pre>
<p>The -fs parameter plays the movie full-screen. I can toggle audio tracks using the hash (#) key (as for some reason, English is generally not the first audio track on the disc).</p>
<p>Remember that Blu-ray movies are very large. In my example, &#8220;The Island&#8221; is a good 21GB! It&#8217;s now up to you to decide whether or not you want to provide storage for your rips of this size, or whether or not you want to compress them down to save space. In my case, I was able to compress the movie down to about 4GB with negligible quality loss at a bitrate of 1200 using the x264 codec. I&#8217;ll probably increase this bitrate and allow the filesize to go to 8GB so I can maintain as near-perfect image quality to the original Blu-ray as possible. I personally choose to preserve the audio tracks as-is without down-converting them &#8211; they really don&#8217;t eat up that much space &#8211; a few hundred megabytes only.</p>
<p>Happy ripping!</p>
<p><span style="color: #0000ff;"><em><span style="text-decoration: underline;"><strong>Woah! After I&#8217;ve ripped the movie, it plays but it&#8217;s all corrupted! What&#8217;s going on?</strong></span></em></span></p>
<p>The movie you have ripped is likely protected using BD+ protection. This is where some or much of the movie is deliberately corrupted to annoy you. I have written a guide on how to deal with this and correct the corruption <a title="Dealing with BD+ copy protection on Blu-ray discs." href="http://www.serenux.com/2009/09/howto-deal-with-bd-copy-protection-when-ripping-blu-ray-titles-using-ubuntu/" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.serenux.com/2009/01/howto-rip-a-blu-ray-movie-using-an-lg-ggc-h20l-blu-ray-drive-with-ubuntu/feed/</wfw:commentRss>
		<slash:comments>47</slash:comments>
		</item>
		<item>
		<title>HowTo: Image your hard-drive for transfer or backup using dd</title>
		<link>http://www.serenux.com/2008/11/howto-image-your-hard-drive-for-transfer-or-backup-using-dd/</link>
		<comments>http://www.serenux.com/2008/11/howto-image-your-hard-drive-for-transfer-or-backup-using-dd/#comments</comments>
		<pubDate>Sat, 01 Nov 2008 10:47:38 +0000</pubDate>
		<dc:creator>HyRax</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Imaging]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Recovery]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.serenux.com/?p=111</guid>
		<description><![CDATA[Imaging, also known as Ghosting in the Windows world, is the act of creating a sector-by-sector copy of a hard-drive and saving it to a file, or transferring it to another hard-drive. Such uses for imaging include: Backup to an image file Clone to another hard-drive (eg: building multiple identical workstations) either directly or via [...]]]></description>
			<content:encoded><![CDATA[<p>Imaging, also known as Ghosting in the Windows world, is the act of creating a sector-by-sector copy of a hard-drive and saving it to a file, or transferring it to another hard-drive. Such uses for imaging include:</p>
<ul>
<li>Backup to an image file</li>
<li>Clone to another hard-drive (eg: building multiple identical workstations) either directly or via an image file</li>
<li>Data recovery (it&#8217;s safer and easier to examine an image file than risk further damage to the hard-drive itself)</li>
</ul>
<p>Linux has a neat little command that can do this for us called simply &#8220;dd&#8221;. It is completely filesystem independent, so you can backup any hard-drive regardless of whether it was Linux formatted, Mac formatted or Windows formatted. It copies the drive bit by bit, sector by sector, not file by file.</p>
<p><span id="more-111"></span></p>
<p><span style="color: #ff0000;"><em><strong>WARNING:</strong> The following article describes commands that can destroy the information on your hard-drive with next-to-no-chance of being able to rescue what&#8217;s left. Make sure that you have full backups of your data prior to using these commands. You use these commands at your own risk!</em></span></p>
<p>First up, your drive/partition being backed up or written to should be unmounted before you begin. If you were trying to backup the partition containing your system&#8217;s root filesystem, you should boot up your system on a LiveCD so you can access your root partition unmounted.</p>
<p>You then need to determine which drive or partition you want to backup. Easiest way to do this is to fire up a terminal session and type in:</p>
<pre><span style="color: #000080;">$ sudo fdisk -l</span></pre>
<p>&#8230;which will list all your drives, their partitions and sizes. Note down the device name of the drive or partition you wish to backup, eg: /dev/sda for the whole of your first drive or /dev/sda1 for just the first partition of that drive, and you&#8217;re ready to begin backup.</p>
<p>At its simplest, backing up a drive takes two basic parameters &#8211; input device and output device or file as follows:</p>
<pre><span style="color: #000080;">$ sudo dd if=/dev/sda1 of=/dev/sdb1</span></pre>
<p>&#8230;will copy the content of the first partition on drive sda to the first partition of drive sdb (destroying whatever was in /dev/sdb1 previously).</p>
<pre><span style="color: #000080;">$ sudo dd if=/dev/sda1 of=~/mybackup.img</span></pre>
<p>&#8230;will copy the content of the first partition on drive sda to a file called mybackup.img in your Home directory.</p>
<p>If you wish to backup an entire drive rather than just a partition, drop the number on the drive name, ie: /dev/sda1 becomes /dev/sda instead.</p>
<p>To restore the image to a drive, simply reverse the parameters:</p>
<pre><span style="color: #000080;">$ sudo dd if=~/mybackup.img of=/dev/sda1</span></pre>
<p>How simple is that? The only issue with this method of backup, though, is that if you were to backup a 10GB partition containing only 5GB of actual data, the resulting image file will still be 10GB as dd does not simply copy active data from the drive, it copies <em>everything</em>.</p>
<p>So with that in mind, let&#8217;s compress the image, so any empty space on the drive doesn&#8217;t take up unnecessary space in the image file. We can do this by piping the data from dd into gzip before writing it to a file:</p>
<pre><span style="color: #000080;">$ sudo dd if=/dev/sda1 | gzip -9 &gt; ~/mybackup.img.gz</span></pre>
<p>&#8230;and to restore, we simply pipe the decompressed data into dd again for writing to the drive:</p>
<pre><span style="color: #000080;">$ gunzip -c ~/mybackup.img.gz | sudo dd of=/dev/sda1</span></pre>
<h3>But wait! There&#8217;s more!</h3>
<p>This just scratches the surface of what you can do with dd. For example, you can also use dd to destroy a drive&#8217;s content before you dispose of, or sell the drive by using the following:</p>
<pre><span style="color: #000080;">$ sudo dd if=/dev/random of=/dev/sda1</span></pre>
<p>&#8230;which will write random data to the partition sda1 using the virtual random device, completely obliterating it.</p>
<p>Or, if you want a more uniform destruction, try:</p>
<pre><span style="color: #000080;">$ sudo dd if=/dev/zero of=/dev/sda1</span></pre>
<p>&#8230;which will &#8211; no surprises here &#8211; write zeros across the entire partition.</p>
<p>Or perhaps you have a drive that isn&#8217;t playing nice, for example Microsoft Windows can get stroppy when working with, or removing partitions created by a foreign OS. The easiest way to fix this is to simply destroy the Master Boor Record (MBR). You can achieve this by specifying a blocksize parameter. The MBR is inside the first 512 bytes of the drive, so all we have to do is blank those 512 bytes out using:</p>
<pre><span style="color: #000080;">$ sudo dd if=/dev/zero of=/dev/sda bs=512 count=1</span></pre>
<p>The bs parameter specifies the block size in bytes (in this case 512) and the count parameter specifies how many blocks of 512 bytes we&#8217;re doing (only one in this case, the first 512 bytes of the drive where the MBR resides).</p>
<p>Any PC will now view this hard-drive as a brand new, never partitioned drive.</p>
<h3>Rescuing a dying hard-drive</h3>
<p>The dd command is particularly useful for recovering data on a drive that&#8217;s about to become a paperweight. As long as it can power up and identify itself to the system, you can attempt data recovery by taking an image of the drive and then try to recover the files from that image.</p>
<p>Since dying hard-drives are typically sown with errors, we need to tell dd to ignore them and keep pulling as much data off as possible. Taking our first imaging example, we add a couple of parameters to the command as follows:</p>
<pre><span style="color: #000080;">$ sudo dd if=/dev/sda of=~/mybackup.img conv=noerror,sync</span></pre>
<p>This will make a full backup of all partitions on drive /dev/sda to a file called mybackup.img in your Home directory, and the conv parameter tells dd to ignore any errors found during the read by skipping over them. The sync parameter tells dd to replace the errors with null values &#8211; blanks &#8211; so that the resulting image file is the same data length as the drive.</p>
<p>Once the backup is complete, you can then mount the image to view its content. As long as the MBR (the first 512 bytes of the hard-drive) were not damaged, you will be able to now recover most, if not all your files, without worrying about further failure to the drive or odd behaviour due to the physical errors on the drive itself.</p>
<p>To mount the image file, you do the following. First we need a mountpoint &#8211; a place to reference the mounted image volume:</p>
<pre><span style="color: #000080;">$ mkdir /dev/shm/myrecoveryimage</span></pre>
<p>This creates a directory called &#8220;myrecoverytimage&#8221; in your system&#8217;s RAM drive. Before you point out that you have less physical RAM than the capacity of your hard-drive, don&#8217;t worry &#8211; this is just a mount-point. The image will still be physically read from wherever you put it on another drive.</p>
<p>Now we mount the image. Let&#8217;s say we backed up a standard Linux ext3-formatted drive:</p>
<pre><span style="color: #000080;">$ sudo mount -t ext3 -o loop ~/.mybackup.img /dev/shm/myrecoveryimage</span></pre>
<p>&#8230;or for a Windows NTFS formatted backup image:</p>
<pre><span style="color: #000080;">$ sudo mount -t ntfs -o loop ~/.mybackup.img /dev/shm/myrecoveryimage</span></pre>
<p>We have told the system to mount an image file of filesystem type Ext3 (or NTFS). We have to specify the loopback device because an image file is not a block device like a hard-drive is. We then specify the filename of the image we are wanting to mount, and finally where we are mounting it to.</p>
<p>You can now simply switch over to the mountpoint directory and see the content of the image file as though it were any normally mounted hard-drive.</p>
<pre><span style="color: #000080;">$ cd /dev/shm/myrecoveryimage
$ ls -l</span></pre>
<p>There are a plethora of filesystems that the mount command can manage including FAT, NTFS network filesystems etc. Refer to the man page for the mount command for more details.</p>
<p>When you have finished with the image, you can unmount it with:</p>
<pre><span style="color: #000080;">$ sudo umount /dev/shm/myrecoveryimage</span></pre>
<p>&#8230;and that will make the /dev/shm/myrecoverimage directory revert back to an ordinary empty directory again (which, being in the RAM disk, will be lost when you reboot).</p>
<p>Happy dd&#8217;ing! <img src='http://www.serenux.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.serenux.com/2008/11/howto-image-your-hard-drive-for-transfer-or-backup-using-dd/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

