<?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>B-RAD &#187; WDTV Optware tips</title>
	<atom:link href="http://b-rad.cc/category/wdtv-optware-tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://b-rad.cc</link>
	<description>bit of this, byte of that</description>
	<lastBuildDate>Sat, 03 Sep 2011 16:19:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>WDTV Optware tips #5: wtorrent &#8211; webgui for rtorrent</title>
		<link>http://b-rad.cc/687/wdtv-optware-tips-wtorrent-webgui-for-rtorrent/</link>
		<comments>http://b-rad.cc/687/wdtv-optware-tips-wtorrent-webgui-for-rtorrent/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 08:23:30 +0000</pubDate>
		<dc:creator>b-rad</dc:creator>
				<category><![CDATA[WDTV]]></category>
		<category><![CDATA[WDTV Optware tips]]></category>
		<category><![CDATA[bittorrent]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[firmware]]></category>
		<category><![CDATA[htpc]]></category>
		<category><![CDATA[nas]]></category>
		<category><![CDATA[rtorrent]]></category>
		<category><![CDATA[unofficial]]></category>
		<category><![CDATA[usb]]></category>
		<category><![CDATA[wdlxtv]]></category>
		<category><![CDATA[western digital]]></category>
		<category><![CDATA[wtorrent]]></category>

		<guid isPermaLink="false">http://b-rad.cc/?p=687</guid>
		<description><![CDATA[W T O R R E N T D T V Yes, I&#8217;ve finally gotten around to part 3 of 3 in my rtorrent with wtorrent tutorial. Wtorrent is an excellent webui for rtorrent and after this tutorial you&#8217;ll be able to manage rtorrent from the web&#8230;forward a port and you can even connect to [...]]]></description>
			<content:encoded><![CDATA[<p>W T O R R E N T<br />
D<br />
T<br />
V</p>
<p>Yes, I&#8217;ve finally gotten around to part 3 of 3 in my rtorrent with wtorrent tutorial. <a href="http://www.wtorrent-project.org">Wtorrent</a> is an excellent webui for <a href="">rtorrent</a> and after this tutorial you&#8217;ll be able to manage rtorrent from the web&#8230;forward a port and you can even connect to your wdtv from the internet to queue up torrents! </p>
<p>In order to take advantage of this tutorial you must either be running <a href="http://b-rad.cc/wdlxtv">WDLXTV</a> or Zoranders <a href="http://wiki.wdtv.org/doku.php?id=wdtv_firmware_hacks">ext3-boot</a>. You must also have my <a href="http://b-rad.cc/optware-for-wdtv">Optware for WDTV</a> package installed, that stuff is covered elsewhere. I&#8217;ll be including every necessary step here, so you might be able to skip around if you already have some of this done.</p>
<p>This writeup presumes that you have already executed the steps from <a href="http://b-rad.cc/437/wdtv-optware-tips-bittorrent-with-rtorrent">part 1</a> and <a href="http://b-rad.cc/547/wdtv-optware-tips-lighttpd-webserver-running-with-php">part 2</a>. If you haven&#8217;t done them yet, then get over and complete them first!<br />
<span id="more-687"></span><br />
<center><script type="text/javascript"><!--
google_ad_client = "pub-9002025493541599";
/* 468x60 b-rad.cc, created 3/6/09 */
google_ad_slot = "6711839104";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center></p>
<p>First ssh/telnet into your WDTV, then update your Optware feed and download the latest wtorrent.</p>
<blockquote><p><code>$ ssh root@wdtv-01</p>
<p>BusyBox v1.10.0 (2009-02-15 05:09:42 CST) built-in shell (msh)</code><code><br />
Enter 'help' for a list of built-in commands.<br />
</code><code><br />
# ipkg update<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//Packages.gz<br />
Inflating http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//Packages.gz<br />
Updated list of available packages in /opt/lib/ipkg/lists/wdtv<br />
Successfully terminated.<br />
#<br />
# cd /tmp<br />
#<br />
# wget 'http://www.wtorrent-project.org/trac/changeset/latest/trunk/?old_path=%2F&#038;format=zip'  -O wtorrent-current.zip<br />
--2009-04-08 07:11:41--  http://www.wtorrent-project.org/trac/changeset/latest/trunk/?old_path=%2F&#038;format=zip<br />
Resolving www.wtorrent-project.org... 38.103.173.70<br />
Connecting to www.wtorrent-project.org|38.103.173.70|:80... connected.<br />
HTTP request sent, awaiting response... 200 OK<br />
Length: 453058 (442K) [application/zip]<br />
Saving to: `wtorrent-current.zip'</p>
<p>100%[======================================>] 453,058      771K/s   in 0.6s    </p>
<p>2009-04-08 07:11:43 (371 KB/s) - `wtorrent-current.zip' saved [453058/453058]</p>
<p></code></p></blockquote>
<p>Now that we have the latest version, lets unzip it to our web server location and do a bit of file maintenance to get things in working order.</p>
<blockquote><p><code># unzip wtorrent-current.zip -d /opt/share/www/<br />
  inflating: trunk/wtorrent/torrents/.htaccess<br />
  inflating: trunk/wtorrent/cls/torrent.cls.php<br />
  inflating: trunk/wtorrent/cls/rtorrent.cls.php<br />
...<br />
...<br />
...<br />
  inflating: trunk/wtorrent/wt/js/ajax.js<br />
  inflating: trunk/wtorrent/install.php<br />
  inflating: trunk/wtorrent/index.php<br />
#<br />
#<br />
# cd /opt/share/www<br />
# mv trunk/wtorrent/ .<br />
# ls<br />
index.php   trunk      wtorrent<br />
# rmdir trunk/<br />
# ls<br />
index.php   wtorrent<br />
#<br />
# mkdir wtorrent/tpl_c<br />
#<br />
# touch wtorrent/db/database.db<br />
#<br />
# cp wtorrent/conf/sample.user.conf.php wtorrent/conf/user.conf.php<br />
#<br />
# chmod -R 777 wtorrent<br />
#</code></p></blockquote>
<p>Whew, now that bit of (undocumented) house cleaning is taken care of we need to modify the configuration for rtorrent to enable the xmlrpc server.</p>
<blockquote><p><code># echo '# xmlrpc support for wtorrent<br />
scgi_port = 127.0.0.1:5000' >> /opt/etc/rtorrent.conf<br />
</code></p></blockquote>
<p>You&#8217;ll have to restart rtorrent after the line above. If you&#8217;re successfull your rtorrent should have a message like so:</p>
<blockquote><p><code># /opt/etc/init.d/S99rtorrent restart</p>
<p><strong>NOTE:</strong></p>
<blockquote><p>I still haven't gotten around to patching S99rtorrent in Optware. For a temporary solution there is an S99rtorrent that will work for now, check the comment section of part 1of3 of this series.</p></blockquote>
<p>                  *** rTorrent 0.8.2/0.12.4 - wdtv-01:1282 ***<br />
[View: main]</p>
<p>( 7:25:43) Using 'select' based polling.<br />
( 7:25:43) Ignoring ~/.rtorrent.rc.<br />
<strong>( 7:25:43) XMLRPC initialized with 444 functions.<br />
( 7:25:43) The SCGI socket is bound to a specific network device yet may still p</strong><br />
[Throttle  40/300 KB] [Rate   0.0/  0.0 KB] [Port: 51780] [U 0/18] [D 0/70] [H  </code></p></blockquote>
<p><strong>Note: I&#8217;ve done the minimal patching required to get rtorrents init.d script syntax error free, will patch Optware tomorrow if I have time <img src='http://b-rad.cc/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </strong></p>
<p>Ok, we&#8217;re gettin closer. Now we just need to install one package I accidentally left off (sqlite2) the lighttpd tutorial and then enable the modules in <strong>php.ini</strong>.</p>
<blockquote><p><code># ipkg install sqlite2<br />
Installing sqlite2 (2.8.17-2) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//sqlite2_2.8.17-2_mipsel.ipk<br />
Configuring sqlite2<br />
Successfully terminated.</p>
<p>#<br />
# echo 'extension=pdo.so<br />
extension=pdo_sqlite.so' >> /opt/etc/php.ini </code></p></blockquote>
<p>Now its time to enable and configure the SCGI server module in lighttpd. For good style I&#8217;ll place the config file in <strong>/opt/etc/lighttpd/conf.d/</strong>. All <strong>.conf</strong> files located in this directory are parsed each time lighttpd starts. This makes things a bit more modular.</p>
<p>To edit:</p>
<blockquote><p><code># nano /opt/etc/lighttpd/conf.d/11-mod_scgi.conf</code></p></blockquote>
<p>inside <strong>11-mod_scgi.conf</strong> add:</p>
<blockquote><p><code>server.modules += ( "mod_scgi" )</p>
<p>scgi.server = (<br />
 "/RPC2" => # RT_DIR<br />
  ( "127.0.0.1" =><br />
   (<br />
    "host" => "127.0.0.1", # Ip where rtorrent is listening<br />
    "port" => 5000, # Port specified in .rtorrent.rc<br />
    "check-local" => "disable"<br />
   )<br />
  )<br />
 )</code></p></blockquote>
<p>The next step is optional. If your wdtv is not accessible from the public internet, then you can skip this step. If you are forwarding an external port to your wdtv so you can manage wtorrent remotely, <strong>then yes you definitely want to do this.</strong></p>
<p>To edit:</p>
<blockquote><p><code># nano /opt/etc/lighttpd/conf.d/12-mod_auth.conf</code></p></blockquote>
<p>inside <strong>12-mod_auth.conf</strong> add:</p>
<blockquote><p><code>server.modules += ( "mod_auth" )</p>
<p>auth.backend = "htdigest"<br />
auth.backend.htdigest.userfile = "/opt/etc/lighttpd/.passwd"</p>
<p>auth.require = ( "/wtorrent" =><br />
 (<br />
  "method" => "basic",<br />
  "realm" => "wtorrent.on.wdtv",<br />
  "require" => "valid-user"<br />
 )<br />
)</code></p></blockquote>
<p>Now when you attempt to access wtorrent you&#8217;ll be prompted for a username/password, without disclosing whats behind the auth. One last thing we need to do before SCGI is finished, we need to create the directory and set its permissions.</p>
<blockquote><p><code># mkdir /opt/share/www/RPC2<br />
# chmod 777 /opt/share/www/RPC2</code></p></blockquote>
<p>We have authorization set up, but one problem&#8230;What users are authorized to connect? Inside of <strong>12-mod_auth.conf</strong> you should notice these two lines:</p>
<blockquote><p><code>auth.backend = "htdigest"<br />
auth.backend.htdigest.userfile = "/opt/etc/lighttpd/.passwd"</code></p></blockquote>
<p>Valid user/password combinations are stored in <strong>/opt/etc/lighttpd/.passwd</strong>. We&#8217;ll need to create a little script to add user/password combo&#8217;s to this file.</p>
<p>to edit:</p>
<blockquote><p><code># nano /opt/bin/htpasswd &#038;&#038; chmod a+x /opt/bin/htpasswd</code></p></blockquote>
<p>inside <strong>/opt/bin/htpasswd</strong> add:</p>
<blockquote><p><code>#!/bin/sh</p>
<p>user=$1<br />
realm=$2<br />
pass=$3</p>
<p>hash=`echo -n "$user:$realm:$pass" | md5sum | cut -b -32`<br />
echo "$user:$realm:$hash"</code></p></blockquote>
<p>Now I&#8217;ll generate a user so I can connect, when things are finished.</p>
<blockquote><p><code># htpasswd b-rad.cc wtorrent.on.wdtv testing >> \<br />
/opt/etc/lighttpd/.passwd</code></p></blockquote>
<p>You can change <strong>wtorrent.on.wdtv</strong> to anything you desire (maybe something less obvious), just be sure there are no spaces in the string.</p>
<p>Are we there yet? Almost. We first need to restart lighttpd to reflect our config changes and kill php-fcgi so it loads the sqlite modules.</p>
<blockquote><p><code># killall php-fcgi<br />
#<br />
# /opt/etc/init.d/S80lighttpd restart<br />
Stopping web server: lighttpd<br />
Starting web server: lighttpd<br />
#</code</p></blockquote>
<p>Now we're finally ready to run wtorrents web installer and get things underway.</p>
<p>Open your favourite web browser and enter:</p>
<blockquote><p><code>http://&lt;your wdtv's ip&gt;:8081/wtorrent/install.php</code></p></blockquote>
<p>You should be welcomed by the install screen. Heres what my config looks like...notice that it asks you for rtorrents scgi port, but I've entered the webserver port instead. I imagine that is a typo on wtorrents part, you must enter your lighttpd port there. When SCGI was enabled earlier we set it to only be exposed to the loopback, so no need to have a username/password there. </p>
<p><center><a href="http://b-rad.cc/wp-content/uploads/2009/04/wtorrent1.png"><img src="http://b-rad.cc/wp-content/uploads/2009/04/wtorrent1-300x200.png" alt="wtorrent install.php" title="wtorrent install.php" width="300" height="200" class="aligncenter size-medium wp-image-731" /></a><br />
</center></p>
<p><strong>Note: don't copy my config information verbatim unless your directories are exactly like mine</strong></p>
<p>Once you've filled the information out correctly, click on <strong>try configuration</strong>. You should see this:</p>
<p><center><a href="http://b-rad.cc/wp-content/uploads/2009/04/wtorrent2.png"><img src="http://b-rad.cc/wp-content/uploads/2009/04/wtorrent2-300x200.png" alt="wtorrent.config.OK" title="wtorrent.config.OK" width="300" height="200" class="aligncenter size-medium wp-image-730" /></a></center></p>
<p>If you don't then you haven't been following very well <img src='http://b-rad.cc/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>If it says you're good, then click <strong>save configuration</strong>. It should report success like so:</p>
<p><center><a href="http://b-rad.cc/wp-content/uploads/2009/04/wtorrent3.png"><img src="http://b-rad.cc/wp-content/uploads/2009/04/wtorrent3-300x200.png" alt="wtorrent config saved" title="wtorrent config saved" width="300" height="200" class="aligncenter size-medium wp-image-732" /></a></center></p>
<p>Bingo!</p>
<p>Now there are two things that we need to do before starting, delete install.php like wtorrents asks and protect the wtorrent db from being downloaded.</p>
<blockquote><p><code># rm /opt/share/www/wtorrent/install.php</code></p></blockquote>
<p>That takes care of the install script, in order to protect the database we have to modify <strong>/opt/etc/lighttpd/lighttpd.conf</strong></p>
<blockquote><p><code># nano /opt/etc/lighttpd/lighttpd.conf</code></p></blockquote>
<p>You need to find this line:</p>
<blockquote><p><code>url.access-deny             = ( "~", ".inc" )</code></p></blockquote>
<p>and replace it with this line:</p>
<blockquote><p><code>url.access-deny = ("~", ".inc", ".db", ".tpl.php", ".cls.php",)</code></p></blockquote>
<p>Restart lighttpd now to reflect that change, then how bout we take wtorrent for a testdrive?</p>
<blockquote><p><code># /opt/etc/init.d/S80lighttpd restart</code></p></blockquote>
<p>Ok, navigate to <strong>http://&lt;your wdtv's ip&gt;:8081/wtorrent</strong>. You're greeted by wtorrents internal log in page, if you enabled mod_auth earlier you'll have to enter a user/password before you access wtorrent.</p>
<p><center><a href="http://b-rad.cc/wp-content/uploads/2009/04/wtorrent4.png"><img src="http://b-rad.cc/wp-content/uploads/2009/04/wtorrent4-300x200.png" alt="wtorrent log in" title="wtorrent log in" width="300" height="200" class="aligncenter size-medium wp-image-733" /></a></center></p>
<p>After logging in you're dropped in to the torrent listings. If your rtorrent has torrents currently running you'll see them here, I don't have anything downloading at the moment.</p>
<p><center><a href="http://b-rad.cc/wp-content/uploads/2009/04/wtorrent5.png"><img src="http://b-rad.cc/wp-content/uploads/2009/04/wtorrent5-300x200.png" alt="wtorrent empty view" title="wtorrent empty view" width="300" height="200" class="aligncenter size-medium wp-image-734" /></a></center></p>
<p>I'll click on add torrent to see about adding something.</p>
<p><center><a href="http://b-rad.cc/wp-content/uploads/2009/04/wtorrent6.png"><img src="http://b-rad.cc/wp-content/uploads/2009/04/wtorrent6-300x200.png" alt="wtorrent upload page" title="wtorrent upload page" width="300" height="200" class="aligncenter size-medium wp-image-735" /></a></center></p>
<p>I've selected something and checked private, since this is a private torrent, now I'll click to upload.</p>
<p><center><a href="http://b-rad.cc/wp-content/uploads/2009/04/wtorrent7.png"><img src="http://b-rad.cc/wp-content/uploads/2009/04/wtorrent7-300x200.png" alt="wtorrent torrent uploaded" title="wtorrent torrent uploaded" width="300" height="200" class="aligncenter size-medium wp-image-737" /></a></center></p>
<p>Lets go back to the main view to see if the torrent is running.</p>
<p><center><a href="http://b-rad.cc/wp-content/uploads/2009/04/wtorrent8.png"><img src="http://b-rad.cc/wp-content/uploads/2009/04/wtorrent8-300x200.png" alt="wtorrent view torrent" title="wtorrent view torrent" width="300" height="200" class="aligncenter size-medium wp-image-738" /></a></center></p>
<p>Awesome! You now have the ability to add torrents to your wdtv from anywhere in the world...and you don't have to go to the console at all!!! <img src='http://b-rad.cc/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Some things to note:</p>
<ul>
<li>the wdtv is not a powerful web server, give rtorrent/wtorrent time to respond and don't be impatient.</p>
<li>extracting archives can be painful</ul>
<p>I spend a tremendous amount of time hacking the WDTV firmware and writing up stuff like this, so if you appreciate my efforts please donate a little something using the link below : ) Thanks &#038; enjoy.</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="4396771">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"><br />
</form>
<p><center><script type="text/javascript"><!--
google_ad_client = "pub-9002025493541599";
/* 468x60 b-rad.cc, created 3/6/09 */
google_ad_slot = "6711839104";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center></p>
<img src="http://b-rad.cc/wp-content/plugins/pixelstats/trackingpixel.php?post_id=687&amp;ts=1328392744" style="display:none;" alt=""/>]]></content:encoded>
			<wfw:commentRss>http://b-rad.cc/687/wdtv-optware-tips-wtorrent-webgui-for-rtorrent/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>WDTV Optware tips #4: lighttpd webserver with PHP</title>
		<link>http://b-rad.cc/547/wdtv-optware-tips-lighttpd-webserver-running-with-php/</link>
		<comments>http://b-rad.cc/547/wdtv-optware-tips-lighttpd-webserver-running-with-php/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 19:28:29 +0000</pubDate>
		<dc:creator>b-rad</dc:creator>
				<category><![CDATA[WDTV]]></category>
		<category><![CDATA[WDTV Optware tips]]></category>
		<category><![CDATA[digital media]]></category>
		<category><![CDATA[ext3]]></category>
		<category><![CDATA[ext3-boot]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[movies]]></category>
		<category><![CDATA[Optware]]></category>
		<category><![CDATA[usb]]></category>
		<category><![CDATA[wdlxtv]]></category>
		<category><![CDATA[western digital]]></category>
		<category><![CDATA[YouTube]]></category>

		<guid isPermaLink="false">http://b-rad.cc/?p=547</guid>
		<description><![CDATA[As I sat down to start on the wtorrent tutorial I promised back in my rtorrent article I thought about how it is really two seperate parts: getting the webserver running and then getting wtorrent running on that. So today I&#8217;ll be going through everything to get the lighttpd webserver running on your Western Digital [...]]]></description>
			<content:encoded><![CDATA[<p>As I sat down to start on the <a href="http://www.wtorrent-project.org">wtorrent</a> tutorial I promised back in my <a href="http://b-rad.cc/437/wdtv-optware-tips-bittorrent-with-rtorrent">rtorrent article</a> I thought about how it is really two seperate parts: getting the webserver running and <strong>then</strong> getting wtorrent running on <strong>that</strong>. So today I&#8217;ll be going through everything to get the <a href="http://www.lighttpd.net/">lighttpd</a> webserver running on your Western Digital WDTV, with PHP for dynamic pages too. lighttpd is a lightweight fully featured webserver that suits the WDTV perfect. lighttpd even powers some high profile sites like YouTube and wikipedia.</p>
<p>In order to take advantage of this tutorial you must either be running <a href="http://b-rad.cc/wdlxtv">WDLXTV</a> or Zoranders <a href="http://wiki.wdtv.org/doku.php?id=wdtv_firmware_hacks">ext3-boot</a>. You must also have my <a href="http://b-rad.cc/optware-for-wdtv">Optware for WDTV</a> package installed, that stuff is covered elsewhere. I&#8217;ll be including every necessary step here, so you might be able to skip around if you already have some of this done.<br />
<span id="more-547"></span><br />
<center><script type="text/javascript"><!--
google_ad_client = "pub-9002025493541599";
/* 468x60 b-rad.cc, created 3/6/09 */
google_ad_slot = "6711839104";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center></p>
<p>First ssh/telnet into your WDTV, then update your Optware feed and install lighttpd, php, and php-cgi.</p>
<blockquote><p><code>$ ssh root@wdtv-01</p>
<p>BusyBox v1.10.0 (2009-02-15 05:09:42 CST) built-in shell (msh)</code><code><br />
Enter 'help' for a list of built-in commands.<br />
</code><code><br />
# ipkg update<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//Packages.gz<br />
Inflating http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//Packages.gz<br />
Updated list of available packages in /opt/lib/ipkg/lists/wdtv<br />
Successfully terminated.<br />
#<br />
# ipkg install lighttpd php php-fcgi sqlite<br />
Installing lighttpd (1.4.22-1) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//lighttpd_1.4.22-1_mipsel.ipk<br />
package lighttpd suggests installing e2fsprogs<br />
package lighttpd suggests installing libmemcache<br />
package lighttpd suggests installing lua<br />
package lighttpd suggests installing memcached<br />
package lighttpd suggests installing sqlite<br />
package lighttpd suggests installing mysql<br />
Installing php (5.2.9-3) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//php_5.2.9-3_mipsel.ipk<br />
Installing php-fcgi (5.2.9-1) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//php-fcgi_5.2.9-1_mipsel.ipk<br />
Installing sqlite (3.6.11-1) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//sqlite_3.6.11-1_mipsel.ipk<br />
Configuring lighttpd<br />
Starting web server: lighttpd<br />
Configuring php<br />
Configuring php-fcgi<br />
Configuring sqlite<br />
Successfully terminated.</code></p></blockquote>
<p>Everything installed fine so lets see what comes up in a search for lighttpd in /opt/etc. This directory is where settings and startup scripts for Optware installed programs are.</p>
<blockquote><p><code># find /opt/etc/* | grep lighttpd<br />
/opt/etc/init.d/S80lighttpd<br />
/opt/etc/lighttpd<br />
/opt/etc/lighttpd/lighttpd.conf<br />
/opt/etc/lighttpd/conf.d<br />
/opt/etc/lighttpd/conf.d/01-default.conf<br />
/opt/etc/lighttpd/conf.d/10-php-fcgi.conf<br />
</code></p></blockquote>
<p>Ok, so<strong> /opt/etc/init.d/S80lighttpd</strong> is the startup script that gets lighttpd going when the WDTV boots up. The really nice file is <strong>/opt/etc/lighttpd/conf.d/10-php-fcgi.conf</strong>, this file is loaded when lighttpd starts so we don&#8217;t have to touch a thing and php works right out of the box. <img src='http://b-rad.cc/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  </p>
<p>There are two things we&#8217;d like two know that the config file will tell, and those are<strong> port number</strong> and <strong>document root</strong> directory of the server. Lets grep <strong>/opt/etc/lighttpd/lighttpd.conf</strong> for those terms.</p>
<blockquote><p><code># cat /opt/etc/lighttpd/lighttpd.conf | egrep \ 'server.port|server.document-root'<br />
server.document-root        = "/opt/share/www/"<br />
server.port                = 8081</code></p></blockquote>
<p>Ok, so<strong> /opt/share/www/</strong> is where all of our html/php/etc files will go. Lets test it out and see if php is really enabled. We&#8217;ll do this by editing index.php in our web root, index.php is the default file returned by lighttpd. I&#8217;ll use <strong>nano</strong> to edit <strong>/opt/share/www/index.php</strong> and add the following:</p>
<blockquote><p><code><br />
&lt;?php<br />
</code><code><br />
// Show all information, defaults to INFO_ALL</code><code><br />
phpinfo&#40;&#41;;</code><code><br />
</code><code><br />
// Show just the module information</code><code>.<br />
// phpinfo&#40;8&#41;; yields identical results.</code><code><br />
phpinfo&#40;INFO_MODULES&#41;;</code><code><br />
</code><code><br />
?&gt;</code></p></blockquote>
<p>The above is a good test page <a href="http://ca.php.net/phpinfo">(directly from php.net)</a> because it displays all the different parameters that php was compiled with and accessible modules. If you created the webpage you can navigate to it now in your favourite browser. Don&#8217;t forget to enter the port number, which is 8081 if you didn&#8217;t change the config file above. The address will look like this, just change the wdtv-01 to whatever your wdtv&#8217;s ip address is.</p>
<blockquote><p><code>http://wdtv-01:8081/</code></p></blockquote>
<p>I&#8217;ll however just download the page from the webserver, dump its contents to standard out, and grep a few key terms to make sure everythings working correctly.</p>
<blockquote><p><code># wget -O - wdtv-01:8081 2> /dev/null | egrep 'Server API|System'<br />
</code><code>&lt;tr>
<td class="e">System &lt;/td>&lt;td class="v">Linux wdtv-01 2.6.15-TvDock #2 PREEMPT Mon Sep 15 20:20:41 CST 2008 mips &lt;/td>&lt;/tr><br />
</code><code>&lt;tr>&lt;td class="e">Server API &lt;/td>&lt;td class="v">CGI/FastCGI &lt;/td>&lt;/tr><br />
</code></p></blockquote>
<p></code><code></p>
<p>it works, cool! Now your WDTV is ready to serve up any php pages you give it. That was <em>almost too easy.</em></p>
<p>Just to review now:</p>
<ul>
<li>the webserver is started when you turn your WDTV on</p>
<li>the root directory of the webserver is <strong>/opt/share/www</strong>
<li><strong>/opt/etc/init.d/S80lighttpd</strong> is the startup script, it can be used in three ways:
<ul>
<li>to restart:      /opt/etc/init.d/S80lighttpd restart</p>
<li>to start:      /opt/etc/init.d/S80lighttpd start
<li>to stop:      /opt/etc/init.d/S80lighttpd stop</ul>
</ul</p>
<p>Ok, so next time will actually be the wtorrent tutorial...</p>
<p><center><script type="text/javascript"><!--
google_ad_client = "pub-9002025493541599";
/* 468x60 b-rad.cc, created 3/6/09 */
google_ad_slot = "6711839104";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center></p>
<img src="http://b-rad.cc/wp-content/plugins/pixelstats/trackingpixel.php?post_id=547&amp;ts=1328392744" style="display:none;" alt=""/>]]></content:encoded>
			<wfw:commentRss>http://b-rad.cc/547/wdtv-optware-tips-lighttpd-webserver-running-with-php/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>WDTV Optware tips #3 &#8211; bittorrent with rtorrent</title>
		<link>http://b-rad.cc/437/wdtv-optware-tips-bittorrent-with-rtorrent/</link>
		<comments>http://b-rad.cc/437/wdtv-optware-tips-bittorrent-with-rtorrent/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 04:44:49 +0000</pubDate>
		<dc:creator>b-rad</dc:creator>
				<category><![CDATA[WDTV]]></category>
		<category><![CDATA[WDTV Optware tips]]></category>
		<category><![CDATA[bittorrent]]></category>
		<category><![CDATA[blackberry]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[digital media]]></category>
		<category><![CDATA[dvd]]></category>
		<category><![CDATA[ext3]]></category>
		<category><![CDATA[ext3-boot]]></category>
		<category><![CDATA[firmware]]></category>
		<category><![CDATA[htpc]]></category>
		<category><![CDATA[nas]]></category>
		<category><![CDATA[rtorrent]]></category>
		<category><![CDATA[torrent]]></category>
		<category><![CDATA[unofficial]]></category>
		<category><![CDATA[usb]]></category>
		<category><![CDATA[wdlxtv]]></category>
		<category><![CDATA[western digital]]></category>

		<guid isPermaLink="false">http://b-rad.cc/?p=437</guid>
		<description><![CDATA[By popular demand I&#8217;ll go through all the steps to get a bittorrent client running on the WDTV. My client of choice is rtorrent so that is what I&#8217;m going to cover. rtorrent is an extremely fast and lightweight client so it suits the wdtv perfectly. You&#8217;ll be downloading torrents in no time flat. In [...]]]></description>
			<content:encoded><![CDATA[<p>By popular demand I&#8217;ll go through all the steps to get a bittorrent client running on the WDTV. My client of choice is <a href="http://libtorrent.rakshasa.no/">rtorrent</a> so that is what I&#8217;m going to cover. <a href="http://libtorrent.rakshasa.no/">rtorrent</a> is an extremely fast and lightweight client so it suits the wdtv perfectly. You&#8217;ll be downloading torrents in no time flat.</p>
<p>In order to take advantage of this tutorial you must either be running <a href="http://b-rad.cc/wdlxtv">WDLXTV</a> or Zoranders <a href="http://wiki.wdtv.org/doku.php?id=wdtv_firmware_hacks">ext3-boot</a>. You must also have my <a href="http://b-rad.cc/optware-for-wdtv">Optware for WDTV</a> package installed, that stuff is covered elsewhere. I&#8217;ll be including every necessary step here, so you might be able to skip around if you already have some of this done.<br />
<span id="more-437"></span><br />
<center><script type="text/javascript"><!--
google_ad_client = "pub-9002025493541599";
/* 468x60 b-rad.cc, created 3/6/09 */
google_ad_slot = "6711839104";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center></p>
<p>So first ssh/telnet into your WDTV.</p>
<p>Next we&#8217;ll update our Optware feed and install rtorrent &#038; screen.</p>
<blockquote><p><code># ipkg update<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//Packages.gz<br />
Inflating http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//Packages.gz<br />
Updated list of available packages in /opt/lib/ipkg/lists/wdtv<br />
Successfully terminated.<br />
#<br />
# ipkg install rtorrent screen<br />
Installing rtorrent (0.8.2-1) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//rtorrent_0.8.2-1_mipsel.ipk<br />
package rtorrent suggests installing dtach<br />
package rtorrent suggests installing adduser<br />
Installing libtorrent (0.12.4-1) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//libtorrent_0.12.4-1_mipsel.ipk<br />
Installing screen (4.0.3-2) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//screen_4.0.3-2_mipsel.ipk<br />
Installing termcap (1.3.1-2) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//termcap_1.3.1-2_mipsel.ipk<br />
Installing libsigc++ (2.0.18-1) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//libsigc++_2.0.18-1_mipsel.ipk<br />
Installing libcurl (7.19.4-1) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//libcurl_7.19.4-1_mipsel.ipk<br />
Installing xmlrpc-c (1.11.00-3) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//xmlrpc-c_1.11.00-3_mipsel.ipk<br />
Installing libxml2 (2.7.3-1) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//libxml2_2.7.3-1_mipsel.ipk<br />
Installing libiconv (1.11-2) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//libiconv_1.11-2_mipsel.ipk<br />
Configuring libcurl<br />
Configuring libiconv<br />
Configuring screen<br />
Configuring termcap<br />
Configuring libsigc++<br />
Configuring libtorrent<br />
Configuring libxml2<br />
Configuring rtorrent<br />
Configuring xmlrpc-c<br />
Successfully terminated.</code></p></blockquote>
<p>Lets see what comes up in a search for rtorrent.</p>
<blockquote><p><code># find /opt/* | grep rtorrent<br />
/opt/bin/rtorrent<br />
/opt/etc/rtorrent.conf<br />
/opt/etc/init.d/S99rtorrent<br />
/opt/lib/ipkg/info/rtorrent.control<br />
/opt/lib/ipkg/info/rtorrent.conffiles<br />
/opt/lib/ipkg/info/rtorrent.list<br />
/opt/share/man/man1/rtorrent.1</code></p></blockquote>
<p>There are two important files to point out here:<strong> /opt/etc/rtorrent.conf </strong>and <strong>/opt/etc/init.d/S99rtorrent</strong></p>
<p><strong>/opt/etc/init.d/S99rtorrent</strong> is a startup script that will be executed <strong>every</strong> single time you start your wdtv. Yes, this means after you make it through this painful tutorial you won&#8217;t have to mess with the console again and can just ftp torrents in.</p>
<p><strong>/opt/etc/rtorrent.conf</strong> is what we want to immediately deal with. This is the configuration file, open it with your favorite text editor. I&#8217;m using nano. At the top of the file change min/max peers and upload/download rate to whatever suits your connection. If you don&#8217;t know what would be good, maybe just modify these two:</p>
<blockquote><p><code># Global download rate in KiB. "0" for unlimited.<br />
download_rate = 80<br />
</code><code><br />
# Global upload rate in KiB. "0" for unlimited.<br />
upload_rate = 80</p></blockquote>
<p></code></p>
<p>Setting download rate to zero makes it unlimited, change upload_rate to whatever suits your connection. The default is 80, maybe a bit high for lots of folks. Remember the speed you choose here will affect being able to play high bandwidth material off your network shares! <strong>* see note below * <img src='http://b-rad.cc/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </strong></p>
<p>Next we need to select the directory where we&#8217;d like to save downloaded file and where we want our *.torrent watch directory to be. The default directory is inside your opt.bin, so unless you&#8217;ve made that ginormous you best change this.</p>
<p><strong>Note:</strong> For various reasons I keep my active torrent hard drives seperate from data storage drives and I&#8217;ll be doing that here as well. Especially on the WDTV you&#8217;re best having your torrents download to a drive without much media so as to not have disk I/O interfere with watching movies, listening to music, etc.</p>
<blockquote><p><code># Default directory to save downloaded files. Note it doesn't support<br />
# space yet.</code><code><br />
directory = /tmp/media/usb/torrent-disk/<br />
</code><code><br />
# Watch a directory for new torrents, and stop those that have been deleted.<br />
schedule = watch_directory,5,5,load_start=/tmp/media/usb/torrentdisk/torrent-drop/*.torrent<br />
schedule = untied_directory,5,5,stop_untied=</code></p></blockquote>
<p>You&#8217;ll probably need to set up port forwarding, so make port_range your favourite number and set your router up later.</p>
<blockquote><p><code># Port range to use for listening.<br />
port_range = 51777-51780</code></p></blockquote>
<p>Default seed ratio is 200%, I&#8217;ll lower that to 110%.</p>
<blockquote><p><code># Stop torrents when reaching upload ratio in percent,<br />
# when also reaching total upload in bytes, or when<br />
# reaching final upload ratio in percent.<br />
# example: stop at ratio 2.0 with at least 200 MB uploaded, or else ratio 20.0<br />
#schedule = ratio,60,60,"stop_on_ratio=200,200M,2000"<br />
schedule = ratio,30,60,stop_on_ratio=110
</p></blockquote>
<p></code></p>
<p>If DHT and peer exchange are your thing, then remove the # from the beginning of these lines.</p>
<blockquote><p><code># Enable DHT support for trackerless torrents or when all trackers are down.<br />
# May be set to "disable" (completely disable DHT), "off" (do not start DHT),<br />
# "auto" (start and stop DHT as needed), or "on" (start DHT immediately).<br />
# The default is "off". For DHT to work, a session directory must be defined.<br />
# dht = auto<br />
</code><code><br />
# UDP port to use for DHT.<br />
# dht_port = 6881<br />
</code><code><br />
# Enable peer exchange (for torrents not marked private)<br />
# peer_exchange = yes</p></blockquote>
<p></code></p>
<p>Ok, thats it. Now to see if it works.</p>
<blockquote><p><code># rtorrent<br />
                                                       *** rTorrent 0.8.2/0.12.4 - wdtv-01:2633 ***</code><code><br />
</code><code>[View: main]</p>
<p></code><code><br />
(21:09:09) Using 'select' based polling.<br />
</code><code>(21:09:09) Could not read resource file: ~/.rtorrent.rc<br />
[Throttle off/off KB] [   ..........  ] [H 0/32] [S 0/1/768] [F 0/128]</p></blockquote>
<p></code></p>
<p>no, it does not. <strong>This is a good time to mention how you exit rtorrent, Ctrl^q</strong>. This means when we start rtorrent we have to point it to /opt/etc/rtorrent.conf.</p>
<blockquote><p><code># screen rtorrent -n -o import=/opt/etc/rtorrent.conf<br />
rtorrent: Could not lock session directory: "/opt/share/torrent/session/", No such file or directory<br />
[screen is terminating]<br />
# mkdir -p /opt/share/torrent/session </p></blockquote>
<p></code></p>
<p>The session directory doesn&#8217;t exist, so I create it. Now it should work.</p>
<blockquote><p><code># screen rtorrent -n -o import=/opt/etc/rtorrent.conf<br />
                                                       *** rTorrent 0.8.2/0.12.4 - wdtv-01:2850 ***<br />
[View: main]</p>
<p></code><code>(21:22:08) Using 'select' based polling.<br />
</code><code>(21:22:08) Ignoring ~/.rtorrent.rc.<br />
[Throttle 200/off KB] [ ... ] [D 0/0] [H 0/32] [S 0/2/768] [F 0/128]<br />
[screen is terminating]<br />
#
</p></blockquote>
<p></code></p>
<p><center><script type="text/javascript"><!--
google_ad_client = "pub-9002025493541599";
/* 468x60 b-rad.cc, created 3/6/09 */
google_ad_slot = "6711839104";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center><br />
Perfect, so now everything looks like it will work I&#8217;ll:</p>
<ul>
<li> start up rtorrent under screen, so that it may be detached to the background.</p>
<li>Once inside rtorrent, press Ctrl^ad (press ctrl, then a, then d) to detach
<li>Move a torrent into the watch directory that was setup.
<li>resume rtorrent and watch torrent go.
<li>detach rtorrent and watch a movie:D</ul>
<p>Here we go:</p>
<blockquote><p><code># screen rtorrent -n -o import=/opt/etc/rtorrent.conf<br />
                                                       *** rTorrent 0.8.2/0.12.4 - wdtv-01:2960 ***<br />
[View: main]</p>
<p></code><code><br />
(21:28:43) Using 'select' based polling.<br />
</code><code>(21:28:43) Ignoring ~/.rtorrent.rc.<br />
[Throttle 200/off KB] [ ... ] [D 0/0] [H 0/32] [S 0/2/768] [F 0/128]</code><code><br />
[screen detached]<br />
</code><code>#<br />
# mv /tmp/something.torrent /tmp/media/usb/sda2/torrent-drop<br />
# screen -r<br />
                                                       *** rTorrent 0.8.2/0.12.4 - wdtv-01:3159 ***<br />
</code><code>[View: main]</code><code><br />
   something   10.0 /  712.0 MB Rate:   10.0 /   934.2 KB Uploaded:      ......<br />
  Tracker[0:0]: Connecting to some tracker</p>
<p></code><code>[Throttle 200/off KB] [ ... ] [D 36/0] [H 0/32] [S 0/38/768] [F 52/128]<br />
[detached]<br />
#<br />
# exit
</p></blockquote>
<p></code></p>
<p>Awesome.</p>
<p><strong>Keys you should be aware of:</strong></p>
<ul>
<li>a / s / d  raise upload speed limit 1 / 5 / 50 KiB</p>
<li>z / x / c lower upload rate limit 1 / 5 / 50 KiB
<li>A / S / D raise download rate limit 1 / 5 / 50 KiB
<li>Z / X / C lower download rate limit 1 / 5 / 50 KiB
<li>Ctrl^s starts a torrent
<li>Ctrl^d stops a started torrent <strong>or</strong> removes a stopped torrent
<li> number 1 &#8211; 9 are different views (all / started / stopped / seeding / etc )
<li>use the arrow keys to navigate around.
<li>Ctrl^ad detaches rtorrent to the background
<li>screen -r resumes rtorrent
<li>Ctrl^q exits rtorrent
</ul>
<p><strong>Note:</strong> my WDTV is fairly unresponsive with rtorrent zipping at the settings i chose, which was 200KiB up and unlimited down. I imagine the disk I/O just made my WDTV have a coronary. So maybe you should lower the default max_upload and stick with default max_download values, and experiment raising/lowering them until you find a nice value. I gotta wait 10min till what I started is done to see if my WDTV happens to wake back up <img src='http://b-rad.cc/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  Well now i know.</p>
<p>Soon I&#8217;ll look into modifying rtorrents priority with <strong>nice</strong> to set it at idle, and play with a bit of the config settings to see if they&#8217;ll help things out. So be sure to check back here for and update. </p>
<p>Also look out for part 2 of this tutorial soon, where I&#8217;ll detail setting up the best rtorrent interface: <a href="http://www.wtorrent-project.org">wtorrent</a>. Then you&#8217;ll never have to go to the console again!</p>
<p><strong>Note:</strong> In case you&#8217;ve forgotten by now, rtorrent will be started whenever you boot your wdtv. This means you <strong>do not</strong> start it up if you ssh/telnet in and want you check out your torrents. You simply type:</p>
<blockquote><p><code># screen -r</code></p></blockquote>
<p>Enjoy!</p>
<p><strong>EDIT</strong></p>
<blockquote><p>
my WDTV did not recover from my snafu above <img src='http://b-rad.cc/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  BUT i changed the settings to max_upload=50 max_download=300 and its downloading fine. In fact no problems as I play a local 1080p mkv, while i view rtorrent downloading and hash checking in a remote shell <img src='http://b-rad.cc/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  Remember the speed you choose here will affect being able to play high bandwidth material off your network shares!<br />
<br /><strong>Note:</strong><br />
<strong>/opt/etc/init.d/S99rtorrent</strong> contains syntax errors so it does not start rtorrent when you boot your wdtv, i&#8217;ll look into fixing that soon and provide a patched version.</p></blockquote>
<p><center><script type="text/javascript"><!--
google_ad_client = "pub-9002025493541599";
/* 468x60 b-rad.cc, created 3/6/09 */
google_ad_slot = "6711839104";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center></p>
<img src="http://b-rad.cc/wp-content/plugins/pixelstats/trackingpixel.php?post_id=437&amp;ts=1328392744" style="display:none;" alt=""/>]]></content:encoded>
			<wfw:commentRss>http://b-rad.cc/437/wdtv-optware-tips-bittorrent-with-rtorrent/feed/</wfw:commentRss>
		<slash:comments>40</slash:comments>
		</item>
		<item>
		<title>WDTV Optware tips #2 &#8211; Rapidshare downloading with SlimRat</title>
		<link>http://b-rad.cc/198/wdtv-optware-tips-rapidshare-with-slimrat/</link>
		<comments>http://b-rad.cc/198/wdtv-optware-tips-rapidshare-with-slimrat/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 10:20:51 +0000</pubDate>
		<dc:creator>b-rad</dc:creator>
				<category><![CDATA[WDTV]]></category>
		<category><![CDATA[WDTV Optware tips]]></category>
		<category><![CDATA[blackberry]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[digital media]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[ext3-boot]]></category>
		<category><![CDATA[firmware]]></category>
		<category><![CDATA[h264]]></category>
		<category><![CDATA[htpc]]></category>
		<category><![CDATA[ipkg]]></category>
		<category><![CDATA[mkv]]></category>
		<category><![CDATA[movies]]></category>
		<category><![CDATA[nas]]></category>
		<category><![CDATA[Optware]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[Rapidshare]]></category>
		<category><![CDATA[stream]]></category>
		<category><![CDATA[unofficial]]></category>
		<category><![CDATA[usb]]></category>
		<category><![CDATA[wdlxtv]]></category>
		<category><![CDATA[western digital]]></category>
		<category><![CDATA[x264]]></category>
		<category><![CDATA[YouTube]]></category>

		<guid isPermaLink="false">http://b-rad.cc/?p=198</guid>
		<description><![CDATA[Today I&#8217;ll walk through getting perl &#38; SlimRat installed on your WDTV. SlimRat is a command line and GUI utility for downloading files from Rapidshare on Linux. In order to take advantage of this tutorial you must either be running WDLXTV or Zoranders ext3-boot. You must also have my Optware for WDTV package installed, that [...]]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;ll walk through getting perl &amp; <a href="http://code.google.com/p/slimrat/">SlimRat</a> installed on your WDTV. <a href="http://code.google.com/p/slimrat/">SlimRat</a> is a command line and GUI utility for downloading files from Rapidshare on Linux.</p>
<p>In order to take advantage of this tutorial you must either be running <a href="http://b-rad.cc/wdlxtv">WDLXTV</a> or Zoranders <a href="http://wiki.wdtv.org/doku.php?id=wdtv_firmware_hacks">ext3-boot</a>. You must also have my <a href="http://b-rad.cc/optware-for-wdtv">Optware for WDTV</a> package installed, that stuff is covered elsewhere. I&#8217;ll be including every necessary step here, so you might be able to skip around if you already have some of this done.<br />
<span id="more-198"></span><br />
<center><script type="text/javascript"><!--
google_ad_client = "pub-9002025493541599";
/* 468x60 b-rad.cc, created 3/6/09 */
google_ad_slot = "6711839104";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center></p>
<p>first install perl and all the modules that slimrat requires.</p>
<blockquote><p><code># ipkg install perl perl-www-mechanize<br />
Installing perl (5.10.0-3) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//perl_5.10.0-3_mipsel.ipk<br />
Installing libdb (4.2.52-3) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//libdb_4.2.52-3_mipsel.ipk<br />
Installing gdbm (1.8.3-2) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//gdbm_1.8.3-2_mipsel.ipk<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//perl-www-mechanize_1.54-2_mipsel.ipk<br />
Installing perl-http-response-encoding (0.05-1) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//perl-http-response-encoding_0.05-1_mipsel.ipk<br />
Installing perl-libwww (5.825-1) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//perl-libwww_5.825-1_mipsel.ipk<br />
Installing perl-uri (1.35-3) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//perl-uri_1.35-3_mipsel.ipk<br />
Installing perl-compress-zlib (1.42-3) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//perl-compress-zlib_1.42-3_mipsel.ipk<br />
Installing zlib (1.2.3-3) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//zlib_1.2.3-3_mipsel.ipk<br />
Installing perl-html-parser (3.60-1) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//perl-html-parser_3.60-1_mipsel.ipk<br />
Installing perl-html-tagset (3.04-4) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//perl-html-tagset_3.04-4_mipsel.ipk<br />
Configuring gdbm<br />
Configuring libdb<br />
Configuring perl<br />
Configuring perl-compress-zlib<br />
Configuring perl-html-parser<br />
Configuring perl-html-tagset<br />
Configuring perl-http-response-encoding<br />
Configuring perl-libwww<br />
Configuring perl-uri<br />
Configuring perl-www-mechanize<br />
Configuring zlib<br />
Successfully terminated.<br />
</code></p></blockquote>
<p>Does perl work?</p>
<blockquote><p><code># perl -v<br />
</code><code><br />
This is perl, v5.10.0 built for mipsel-linux<br />
</code><code><br />
Copyright 1987-2007, Larry Wall<br />
</code><code><br />
Perl may be copied only under the terms of either the Artistic License or theGNU General Public License, which may be found in the Perl 5 source kit.<br />
</code><code><br />
Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl".  If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.<br />
</code><code><br />
# perl -e "print "Hello World";"<br />
</code><code>Hello World</code></p></blockquote>
<p>Looks like perl works so now lets download &amp; extract SlimRat</p>
<blockquote><p><code># cd /opt/bin<br />
# wget http://slimrat.googlecode.com/files/slimrat-0.9.3.tar.bz2<br />
Connecting to slimrat.googlecode.com (209.85.173.82:80)<br />
slimrat-0.9.3.tar.bz 100% |*******************************| 12195  --:--:-- ETA<br />
# bunzip2 slimrat-0.9.3.tar.bz2<br />
# tar -xvf slimrat-0.9.3.tar<br />
slimrat-0.9.3/<br />
slimrat-0.9.3/INSTALL<br />
slimrat-0.9.3/Plugin.pm<br />
slimrat-0.9.3/Toolbox.pm<br />
slimrat-0.9.3/config<br />
slimrat-0.9.3/index.html<br />
slimrat-0.9.3/plugins/<br />
slimrat-0.9.3/plugins/DepositFiles.pm<br />
slimrat-0.9.3/plugins/Direct.pm<br />
slimrat-0.9.3/plugins/FastLoad.pm<br />
slimrat-0.9.3/plugins/Leteckaposta.pm<br />
slimrat-0.9.3/plugins/MediaFire.pm<br />
slimrat-0.9.3/plugins/Rapidshare.pm<br />
slimrat-0.9.3/plugins/YouTube.pm<br />
slimrat-0.9.3/slimrat.glade<br />
slimrat-0.9.3/slimrat-gui<br />
slimrat-0.9.3/slimrat<br />
# rm slimrat-0.9.3.tar<br />
# ln -s slimrat-0.9.3/slimrat ./slimrat</code></p></blockquote>
<p>The last line allows us to execute slimrat from anywhere on the system. </p>
<blockquote><p><center>*Note* I&#8217;ve just noticed that either:  SlimRat was recently added to the nslu2-linux wdtv feed or I never realized it was there : p</center><br />
<code># ipkg install slimrat</code></p>
<p>Will install a slightly older version of SlimRat than I&#8217;m using here in these examples.</p></blockquote>
<p>If bunzip2 says not found, then:</p>
<blockquote><p><code># ipkg install bzip2</code></p></blockquote>
<p>So now let see if it works.</p>
<blockquote><p><code># slimrat<br />
Loaded plugins: FastLoad, MediaFire, YouTube, DepositFiles, Rapidshare, Leteckaposta</code></p>
<p>SlimRat<br />
<code><br />
Downloads files from rapidshare and other servers to your working directory. Files to download are specified by download links like 'http://rapidshare.com/files/012345678/somefile.xxx' as arguments on command line or one per line in file given as --list option ('-' for stdin works too).</code></p>
<p>USAGE:<code><br />
/opt/bin/slimrat [options] [link [link [...]]]</code></p>
<p>OPTIONS:<br />
<code> -h | --help              this help<br />
</code><code> -l | --list   filename   load links from file (one per line)<br />
</code><code> -c | --check             only check links, don't download them<br />
</code><code> -t | --to     directory  destination directory (where to download)<br />
</code><code> -w | --wget              wget options, enclosed in quotes<br />
</code><code> slimrat -w '--limit-rate=20k' -l file-list </code></p></blockquote>
<p>It works! Now before we test it out and download some stuff theres one issue to work out. Rapidshare enforces a waiting period in between downloads, so a big release could take a while to download. We don&#8217;t want to have to keep the shell open the whole time SlimRat works, but if its closed SlimRat will terminate. What we&#8217;ll do is utilize the program <strong>screen</strong>, which will allow us to detach SlimRat and exit our terminal session on the wdtv without affecting the downloading.</p>
<p><center><script type="text/javascript"><!--
google_ad_client = "pub-9002025493541599";
/* 468x60 b-rad.cc, created 3/6/09 */
google_ad_slot = "6711839104";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center></p>
<blockquote><p><code># ipkg install screen<br />
Installing screen (4.0.3-2) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//screen_4.0.3-2_mipsel.ipk<br />
Installing termcap (1.3.1-2) to root...<br />
Downloading http://ipkg.nslu2-linux.org/feeds/optware/wdtv/cross/unstable//termcap_1.3.1-2_mipsel.ipk<br />
Configuring screen<br />
Configuring termcap<br />
Successfully terminated.<br />
</code></p></blockquote>
<p>To run a program behing <strong>screen</strong> prepend it to the command string.</p>
<blockquote><p><code># screen &lt;program&gt; &lt;arguments&gt;</code></p></blockquote>
<p><strong>Once running there is one main key sequence that you need to remember</strong></p>
<blockquote><p><code>Ctrl^a^d</code></p></blockquote>
<p>That is:  <strong>press the Ctrl key, then a, then d, then lift off Ctrl</strong>. This sequence drops <strong>screen</strong> to the background and returns us to the shell. In order to get back (if theres only one instance of screen running) to the program:</p>
<blockquote><p><code># screen -r</code></p></blockquote>
<p>I&#8217;ll queue up 3 files and when SlimRat starts the first file I&#8217;ll hit Ctrl^a^d, exit my ssh session, grab a snack, and watch a show.</p>
<blockquote><p><code># cd /tmp/boot<br />
# mkdir rstests &amp;&amp; cd rstests<br />
# screen slimrat http://rapidshare.com/files/206442508/WDTV_FW_1_00_01_03_B-RAD.CC_DVD-ENABLED.zip http://rapidshare.com/files/206443577/WDTV_FW_1_01_02_03_B-RAD.CC_DVD-ENABLED.zip http://rapidshare.com/files/207616110/opt.bin-0.2.zip</code></p>
<p>Loaded plugins: FastLoad, MediaFire, YouTube, DepositFiles, Rapidshare, Leteckaposta<br />
<code>[09:17:34] Slimrat started<br />
</code><code>[09:17:34] Downloading http://rapidshare.com/files/206442508/WDTV_FW_1_00_01_03_B-RAD.CC_DVD-ENABLED.zip (Rapidshare) [ALIVE]<br />
</code><code>[09:17:40] Waiting 00:32<br />
</code><code>[09:18:12] Continuing<br />
--2009-03-16 09:18:12--  http://rs523tl2.rapidshare.com/files/206442508/1409886/WDTV_FW_1_00_01_03_B-RAD.CC_DVD-ENABLED.zip<br />
Resolving rs523tl2.rapidshare.com... 80.239.226.124<br />
Connecting to rs523tl2.rapidshare.com|80.239.226.124|:80... connected.<br />
HTTP request sent, awaiting response... 200 OK<br />
Length: 12535355 (12M) [application/octet-stream]<br />
Saving to: `WDTV_FW_1_00_01_03_B-RAD.CC_DVD-ENABLED.zip'<br />
</code><code><br />
22% [==================&gt;                  ] 2,816,816    196K/s  eta 57s<br />
</code> <code><br />
[detached]</code></p></blockquote>
<p>(Here I&#8217;ve just hit Ctrl^a^d, which detached screen)</p>
<blockquote><p><code>[detached]</code> <code><br />
# exit<br />
connection to wdtv closed.<br />
$</code></p></blockquote>
<p>Ok, my show is over. Its time to log back in and see if SlimRat is complete yet.</p>
<blockquote><p><code>$ ssh root@wdtv<br />
</code><code><br />
BusyBox v1.10.0 (2009-02-15 05:09:42 CST) built-in shell (msh)</code><code><br />
Enter 'help' for a list of built-in commands.<br />
</code><code><br />
# screen -r</code><br />
</code><code>[09:17:34] Downloading http://rapidshare.com/files/206442508/WDTV_FW_1_00_01_03_B-RAD.CC_DVD-ENABLED.zip (Rapidshare) [ALIVE]<br />
</code><code>[09:17:40] Waiting 00:32<br />
</code><code>[09:18:12] Continuing<br />
</code><code>--2009-03-16 09:18:12--  http://rs523tl2.rapidshare.com/files/206442508/1409886/WDTV_FW_1_00_01_03_B-RAD.CC_DVD-ENABLED.zip<br />
Resolving rs523tl2.rapidshare.com... 80.239.226.124<br />
</code><code>Connecting to rs523tl2.rapidshare.com|80.239.226.124|:80... connected.<br />
HTTP request sent, awaiting response... 200 OK<br />
</code><code>Length: 12535355 (12M) [application/octet-stream]<br />
</code><code>Saving to: `WDTV_FW_1_00_01_03_B-RAD.CC_DVD-ENABLED.zip'</p>
<p></code><code>100%[=====================================================================================>] 12,535,355   196K/s   in 67s</p>
<p></code><code>2009-03-16 09:19:20 (183 KB/s) - `WDTV_FW_1_00_01_03_B-RAD.CC_DVD-ENABLED.zip' saved [12535355/12535355]</p>
<p></code><code>[09:19:20] File downloaded </p>
<p></code><code>[09:19:20] Downloading http://rapidshare.com/files/206443577/WDTV_FW_1_01_02_03_B-RAD.CC_DVD-ENABLED.zip (Rapidshare) [ALIVE]<br />
</code><code>[09:19:23] Reached the download limit for free-users<br />
</code><code>[09:19:23] Waiting 15:00<br />
</code><code>[09:34:24] Continuing<br />
</code><code>[09:34:25] Waiting 00:32<br />
</code><code>[09:34:57] Continuing<br />
--2009-03-16 09:34:57--  http://rs234l33.rapidshare.com/files/206443577/1363875/WDTV_FW_1_01_02_03_B-RAD.CC_DVD-ENABLED.zip<br />
</code><code>Resolving rs234l33.rapidshare.com... 195.122.149.35<br />
</code><code>Connecting to rs234l33.rapidshare.com|195.122.149.35|:80... connected.<br />
HTTP request sent, awaiting response... 200 OK<br />
</code><code>Length: 13693232 (13M) [application/octet-stream]<br />
</code><code>Saving to: `WDTV_FW_1_01_02_03_B-RAD.CC_DVD-ENABLED.zip'</p>
<p></code><code>100%[=====================================================================================>] 13,693,232   153K/s   in 75s</p>
<p></code><code>2009-03-16 09:36:13 (179 KB/s) - `WDTV_FW_1_01_02_03_B-RAD.CC_DVD-ENABLED.zip' saved [13693232/13693232]</p>
<p></code><code>[09:36:13] File downloaded </p>
<p></code><code>[09:36:13] Downloading http://rapidshare.com/files/207616110/opt.bin-0.2.zip (Rapidshare) [ALIVE]<br />
</code><code>[09:36:16] Reached the download limit for free-users<br />
</code><code>[09:36:16] Waiting 15:00<br />
</code><code>[09:51:17] Continuing<br />
</code><code>[09:51:18] Waiting 00:33<br />
</code><code>[09:51:51] Continuing<br />
</code><code>--2009-03-16 09:51:52--  http://rs601l3.rapidshare.com/files/207616110/109812/opt.bin-0.2.zip<br />
</code><code>Resolving rs601l3.rapidshare.com... 62.140.7.2<br />
</code><code>Connecting to rs601l3.rapidshare.com|62.140.7.2|:80... connected.<br />
HTTP request sent, awaiting response... 200 OK<br />
</code><code>Length: 18084506 (17M) [application/octet-stream]<br />
</code><code>Saving to: `opt.bin-0.2.zip'</p>
<p></code><code>100%[=====================================================================================>] 18,084,506   193K/s   in 80s</p>
<p></code><code>2009-03-16 09:53:23 (227 KB/s) - `opt.bin-0.2.zip' saved [18084506/18084506]</p>
<p></code><code>[09:53:23] File downloaded<br />
</code><code></p></blockquote>
<p>When a program running under screen terminates control is immediately returned to the shell. Any output from the previously running program will disappear. If you ever try <em>screen -r</em> and are told there is no screen to be resumed, then your program has already finished executing. So now we see:</p>
<blockquote><p><code>$ ssh root@wdtv<br />
</code><code><br />
BusyBox v1.10.0 (2009-02-15 05:09:42 CST) built-in shell (msh)</code><code><br />
Enter 'help' for a list of built-in commands.<br />
</code><code><br />
# screen -r</code><code><br />
[screen terminating]</code><code><br />
# cd /tmp/boot/rstests &#038;&#038; ls -la *.zip<br />
-rwxr-xr-x    1 root     root     12535355 Mar 16 09:19 WDTV_FW_1_00_01_03_B-RAD.CC_DVD-ENABLED.zip<br />
-rwxr-xr-x    1 root     root     13693232 Mar 16 09:36 WDTV_FW_1_01_02_03_B-RAD.CC_DVD-ENABLED.zip<br />
-rwxr-xr-x    1 root     root     18084506 Mar 16 09:53 opt.bin-0.2.zip<br />
</code></p></blockquote>
<p>Looks like everything downloaded correctly as it should, now to go find some other more interesting stuff to download : )</p>
<p>Tune in for next time, when i show how to automate SlimRat with directory monitoring and a custom autoextract script...</p>
<p><center><script type="text/javascript"><!--
google_ad_client = "pub-9002025493541599";
/* 468x60 b-rad.cc, created 3/6/09 */
google_ad_slot = "6711839104";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center></p>
<img src="http://b-rad.cc/wp-content/plugins/pixelstats/trackingpixel.php?post_id=198&amp;ts=1328392744" style="display:none;" alt=""/>]]></content:encoded>
			<wfw:commentRss>http://b-rad.cc/198/wdtv-optware-tips-rapidshare-with-slimrat/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>WDTV Optware tips #1 &#8211; resizing opt.bin *updated*</title>
		<link>http://b-rad.cc/170/wdtv-optware-tips-resizing-optbin/</link>
		<comments>http://b-rad.cc/170/wdtv-optware-tips-resizing-optbin/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 02:23:00 +0000</pubDate>
		<dc:creator>b-rad</dc:creator>
				<category><![CDATA[WDTV]]></category>
		<category><![CDATA[WDTV Optware tips]]></category>
		<category><![CDATA[blackberry]]></category>
		<category><![CDATA[digital media]]></category>
		<category><![CDATA[ext3-boot]]></category>
		<category><![CDATA[firmware]]></category>
		<category><![CDATA[htpc]]></category>
		<category><![CDATA[ipkg]]></category>
		<category><![CDATA[nas]]></category>
		<category><![CDATA[nslu2]]></category>
		<category><![CDATA[Optware]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[resize disk]]></category>
		<category><![CDATA[resize partition]]></category>
		<category><![CDATA[usb]]></category>
		<category><![CDATA[western digital]]></category>

		<guid isPermaLink="false">http://b-rad.cc/?p=170</guid>
		<description><![CDATA[Back in my post about Optware for the WDTV, I mentioned how I had limited opt.bin to 128MB and made a comment hinting about being able to resize it if you need. Well I was called out [sasa ; )] so heres the easy steps to resize your opt.bin to whatever you&#8217;d like. 128MB really [...]]]></description>
			<content:encoded><![CDATA[<p>Back in my post about <a href="http://b-rad.cc/optware-for-wdtv">Optware for the WDTV</a>, I mentioned how I had limited opt.bin to 128MB and made a comment hinting about being able to resize it if you need. Well I was called out [sasa ; )] so heres the easy steps to resize your opt.bin to whatever you&#8217;d like. 128MB really isn&#8217;t that much after all.</p>
<p>Note: this will require either access to a Linux computer, cygwin shell with ext2fs tools, or if you have time and patience it can be executed straight on the WDTV using Zoranders ext3-boot. It will take a long time on the WDTV though.<br />
<span id="more-170"></span><br />
<center><script type="text/javascript"><!--
google_ad_client = "pub-9002025493541599";
/* 468x60 b-rad.cc, created 3/6/09 */
google_ad_slot = "6711839104";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center><br />
Fire up whatever shell you&#8217;re going to use and navigate to the location of opt.bin. Lets check out how much space I have left.</p>
<blockquote><p><code>$ cd /wdtv<br />
$ mkdir optMount<br />
$ mount -o loop opt.bin optMount<br />
$ df ./opt<br />
Filesystem           1K-blocks      Used Available Use% Mounted on<br />
/dev/loop3              126931    111483      8895  93% /wdtv/opt<br />
$ umount optMount<br />
</code></p></blockquote>
<p>: O Gettin pretty tight! We need to extend this filesystem and give a lot more room to grow, but how to make the opt.bin file itself larger? There are two possible methods, copying to a new file with padding or expanding the file in place. </p>
<p><b>Method 1: copying</b><br />
First we&#8217;ll create a new file that consists of our original opt.bin with a lot of zeroes appended to the end. I want my new opt.bin to be 512MB.</p>
<blockquote><p><code>$ dd if=/dev/zero of=zeroes bs=1024k count=384<br />
384+0 records in<br />
384+0 records out<br />
402653184 bytes (403 MB) copied, 10.6317 s, 37.9 MB/s<br />
</code></p></blockquote>
<p>This creates the padding, 384MB, since opt.bin comes stock as 128MB. If you&#8217;d like something other than 512MB, then change 384 above to whatever you wish. Now to create the new image.</p>
<blockquote><p><code>$ cat opt.bin zeroes > bigger.opt.bin<br />
$ ls -la opt.bin bigger.opt.bin zeroes<br />
-rw-r--r-- 1 b-rad b-rad 536870912 2009-03-09 17:12 bigger.opt.bin<br />
-rw-r--r-- 1 b-rad b-rad 134217728 2009-03-02 22:08 opt.bin<br />
-rw-r--r-- 1 b-rad b-rad 402653184 2009-03-09 17:11 zeroes</code></p></blockquote>
<p>This combines the two files into a new file. Perfect, so now we have a new bin that is 512MB. But is it <b>really</b> 512MB?</p>
<blockquote><p><code>$ mount -o loop bigger.opt.bin optMount<br />
$ df optMount<br />
Filesystem           1K-blocks      Used Available Use% Mounted on<br />
/dev/loop3              126931    111483      8895  93% /wdtv/optMount<br />
$umount optMount</code></p></blockquote>
<p>No Its not. Although the file containing the filesystem is 512MB, the filesystem still thinks its 128MB because it hasn&#8217;t been told otherwise. So let us resize it to fill up the maximum size opt.bin can hold, using resize2fs.</p>
<blockquote><p><code>$ resize2fs bigger.opt.bin<br />
resize2fs 1.41.3 (12-Oct-2008)<br />
Please run 'e2fsck -f bigger.opt.bin' first.</code></p></blockquote>
<p>resize2fs rightly asks you to force check the integrity of your target filesystem before you extend it, using e2fsck.</p>
<blockquote><p><code>$ e2fsck -f bigger.opt.bin<br />
e2fsck 1.41.3 (12-Oct-2008)<br />
Pass 1: Checking inodes, blocks, and sizes<br />
Pass 2: Checking directory structure<br />
Pass 3: Checking directory connectivity<br />
/lost+found not found.  Create&lt;y&gt;? yes</code></p>
<p><code>Pass 4: Checking reference counts<br />
Pass 5: Checking group summary information</code></p>
<p><code>bigger.opt.bin: ***** FILE SYSTEM WAS MODIFIED *****<br />
bigger.opt.bin: 1500/32768 files (0.3% non-contiguous), 23102/131072 blocks</code></p>
<p><code>$ resize2fs bigger.opt.bin<br />
resize2fs 1.41.3 (12-Oct-2008)<br />
Resizing the filesystem on newImage.bin to 524288 (1k) blocks.<br />
The filesystem on newImage.bin is now 524288 blocks long.</code></p></blockquote>
<p>Note above I answered yes when asked to create lost+found. </p>
<p>Does bigger.opt.bin contain a file system with 512MB of space yet?</p>
<blockquote><p><code>$ mount -o loop bigger.opt.bin optMount<br />
$ df optMount<br />
Filesystem           1K-blocks      Used Available Use% Mounted on<br />
/dev/loop3              507748    112243    369293  24% /wdtv/optMount<br />
$ umount optMount</code></p></blockquote>
<p>: D Yes it does.</p>
<blockquote><p><code>$ mv opt.bin opt.bin.small<br />
$ mv bigger.opt.bin opt.bin<br />
$ rm zeroes</code></p></blockquote>
<p><center><script type="text/javascript"><!--
google_ad_client = "pub-9002025493541599";
/* 468x60 b-rad.cc, created 3/6/09 */
google_ad_slot = "6711839104";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center><br />
<b>Method 2: expanding opt.bin in place</b></p>
<p>This is a slightly more advanced method of expanding opt.bin, which accomplishes the same thing without any extra files.</p>
<blockquote><p><code>$ cd /wdtv<br />
$ ls -la opt.bin<br />
-rw-r--r-- 1 b-rad b-rad 134217728 2009-03-02 22:08 opt.bin<br />
</code></p></blockquote>
<p>This opt.bin starts out at 128MB like the one above. Now we&#8217;ll use <b>dd</b> again, but this time in append mode. This means that the zeroes will be added to the end of opt.bin.</p>
<p><b>NOTE:</b> if something goes wrong here it could be bad, so make a backup copy first if you desire.</p>
<blockquote><p><code># dd if=/dev/zero of=opt.bin bs=1024k count=384  \<br />
oflag=append conv=notrunc<br />
384+0 records in<br />
384+0 records out<br />
402653184 bytes (403 MB) copied, 18.6361 s, 21.6 MB/s<br />
$ ls -la opt.bin<br />
-rw-r--r-- 1 b-rad b-rad 536870912 2009-03-12 17:05 opt.bin</code></p></blockquote>
<p>Notice its the exact same size as using the first method, as it should be. Since we already know that the filesystem won&#8217;t realize its larger yet, we&#8217;ll do those steps right away.</p>
<blockquote><p><code>$ e2fsck -f opt.bin<br />
opt.bin: recovering journal<br />
Pass 1: Checking inodes, blocks, and sizes<br />
Pass 2: Checking directory structure<br />
Pass 3: Checking directory connectivity<br />
/lost+found not found.  Create<y>? yes</code><br />
<code><br />
Pass 4: Checking reference counts<br />
Pass 5: Checking group summary information</code><br />
<code><br />
opt.bin: ***** FILE SYSTEM WAS MODIFIED *****</code><code><br />
opt.bin: 1558/32768 files (7.8% non-contiguous), 24643/131072 blocks<br />
$ resize2fs opt.bin<br />
resize2fs 1.41.3 (12-Oct-2008)<br />
Resizing the filesystem on opt.bin to 524288 (1k) blocks.<br />
The filesystem on opt.bin is now 524288 blocks long.<br />
$ mkdir optMount &#038;&#038; mount -o loop opt.bin optMount &#038;&#038; df optMount &#038;&#038; umount optMount &#038;&#038; rmdir optMount<br />
Filesystem           1K-blocks      Used Available Use% Mounted on<br />
/dev/loop6              507748     21261    460275   5% /wdtv/optMount</code></p></blockquote>
<p>There you go, in place file system expansion. Just be <b>extremely sure to umount opt.bin before doing these operations.</b></p>
<p>Now with two different methods of expansion I&#8217;ve covered all the bases, enjoy the new free space on your wdtv!<br />
<center><script type="text/javascript"><!--
google_ad_client = "pub-9002025493541599";
/* 468x60 b-rad.cc, created 3/6/09 */
google_ad_slot = "6711839104";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center></p>
<img src="http://b-rad.cc/wp-content/plugins/pixelstats/trackingpixel.php?post_id=170&amp;ts=1328392744" style="display:none;" alt=""/>]]></content:encoded>
			<wfw:commentRss>http://b-rad.cc/170/wdtv-optware-tips-resizing-optbin/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

