<?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>damontimm.com &#187; nas</title>
	<atom:link href="http://blog.damontimm.com/tag/nas/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.damontimm.com</link>
	<description>Where I go to remember what I did</description>
	<lastBuildDate>Fri, 13 Jan 2012 10:54:16 +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>How To: Store iMovie &#8217;09 Events and Projects on a Network Volume (NAS)</title>
		<link>http://blog.damontimm.com/how-to-store-imovie-09-events-and-projects-on-a-network-volume-nas/</link>
		<comments>http://blog.damontimm.com/how-to-store-imovie-09-events-and-projects-on-a-network-volume-nas/#comments</comments>
		<pubDate>Sat, 10 Apr 2010 15:33:32 +0000</pubDate>
		<dc:creator>Damon</dc:creator>
				<category><![CDATA[how to]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[iMovie]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[nas]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blog.damontimm.com/?p=248</guid>
		<description><![CDATA[Purpose: while iMovie &#8217;09 allows you to store your events and projects on physically attached hard drives (external or internal) it doesn&#8217;t offer an out-of-the-box way to store them on a network attached storage (NAS) device. I have a file serve and I want to use it. how to set it up The only way [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Purpose</strong>: while iMovie &#8217;09 allows you to store your events and projects on physically attached hard drives (external or internal) it doesn&#8217;t offer an out-of-the-box way to store them on a network attached storage (NAS) device.  I have a file serve and I want to use it.</p>
<p><span id="more-248"></span></p>
<h2>how to set it up</h2>
<p>The only way I have found to circumvent this annoyance is to play a little trick on iMovie.  And that trick is to move the original <code>~/Movies</code> folder under a different name and put a symlink in its place (to the network folder of your choice).</p>
<p>Here are the steps I took from the Terminal to do this (you will need to have Administrator privileges and you will need to know where your network folder is attached):</p>
<ul class="terminal">
<li><code>sudo mv ~/Movies/ ~/Movies-original</code></li>
<li><code>ln -s /Volumes/my-network-volume/Movies/ ~/Movies</code></li>
</ul>
<p>Now, when I load up iMovie it will use the networked volume.  If you don&#8217;t like this, you can always move your <code>~/Movies-original</code> folder back where it was.</p>
<h2>remaining issues</h2>
<p>Unfortunately, this isn&#8217;t a perfect fix.  There are two caveats or issues I have found.  </p>
<p>One, is that now my hard drive (called Papa Bear) is listed twice in the <em>Project Library</em>:</p>
<p><img src="http://blog.damontimm.com/wp-content/uploads/2010/04/imovie-duplicate-project-libraries.png" alt="" title="imovie-duplicate-project-libraries" width="415" height="96" class="aligncenter size-full wp-image-249" /></p>
<p>And two, is that when you delete an event or project from within iMovie, it moves the project into a temporary folder rather than actually deleting it.  The next time you open iMovie, it will show up again.  I&#8217;m sure this is because it <em>thinks</em> it is working with a bona fide Trash system but its not (because it is network storage.  See this example:</p>
<p><img src="http://blog.damontimm.com/wp-content/uploads/2010/04/imovie-temporary-folders.png" alt="" title="imovie-temporary-folders" width="423" height="93" class="aligncenter size-full wp-image-250" /></p>
<p>In order to get around this annoyance, I created a Python script which removes the temporary files for me and created a cron job to run the script from time to time (cleaning up the mess iMovie leaves behind).</p>
<pre class="brush: python; gutter: true;">#!/usr/bin/env python
'''
Simple script to remove all directories that match the name:
    /iMovie Temporary Items */  [note the star!]

'''
import os
import fnmatch
import shutil

# tuple of directories to search through (you can add more than one)
DIRS = ('/Volumes/leaker-damon/tps/Videos/',)

for directory in DIRS:
    for root, dirnames, filenames in os.walk(directory):
        for directory in dirnames:
            if fnmatch.fnmatch(directory,'iMovie Temporary Items *'):
                shutil.rmtree(os.path.join(root,directory))</pre>
<h2>make this more better</h2>
<p>Am interested to hear how other people have been handling this &#8212; this approach certainly isn&#8217;t perfect, but it seems to work (for now).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.damontimm.com/how-to-store-imovie-09-events-and-projects-on-a-network-volume-nas/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>How To: Test Connection Speed Between Two Machines</title>
		<link>http://blog.damontimm.com/how-to-test-connection-speed-between-two-machines/</link>
		<comments>http://blog.damontimm.com/how-to-test-connection-speed-between-two-machines/#comments</comments>
		<pubDate>Sun, 25 Jan 2009 14:58:26 +0000</pubDate>
		<dc:creator>Damon</dc:creator>
				<category><![CDATA[how to]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[nas]]></category>
		<category><![CDATA[nc]]></category>
		<category><![CDATA[pv]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://blog.damontimm.com/?p=166</guid>
		<description><![CDATA[Purpose: as a quick diagnostic tool, sometimes it&#8217;s nice to know exactly how fast two machines can (theoretically) be connected.  I was having some slow downs on my NAS and using these command line tools, was able to determine that it was my NIC (and not my hard drives) that was causing the slow down.  [...]]]></description>
			<content:encoded><![CDATA[<p>Purpose: as a quick diagnostic tool, sometimes it&#8217;s nice to know exactly how fast two machines can (theoretically) be connected.  I was having some slow downs on my NAS and using these command line tools, was able to determine that it was my NIC (and not my hard drives) that was causing the slow down.  I learned this from a <a href="http://tech.slashdot.org/comments.pl?sid=1064679&amp;cid=26139847" target="_blank">thread at slashdot</a>. </p>
<p><span id="more-166"></span></p>
<h3>install nc and pv</h3>
<p>If you are on a mac, you can use <a href="http://blog.damontimm.com/how-to-install-macports-on-os-x-leopard-105/">MacPorts</a> to install this easily enough:</p>
<ul class="terminal">
<li><code>$ sudo port install netcat pv</code></li>
</ul>
<p>If you are on Ubuntu, you just need to get <code>pv</code> installed (<code>nc</code> is already there):</p>
<ul class="terminal">
<li><code>$ sudo aptitude install pv</code></li>
</ul>
<p>Once you have <code>nc</code> and <code>pv</code> installed, it&#8217;s really simple.  On one machine, run the following command:</p>
<ul class="terminal">
<li><code>$ nc -ulp 5000 &gt; /dev/null</code></li>
</ul>
<p>On the second machine run the following command (you need the IP address of the first machine):</p>
<ul class="terminal">
<li><code>$ pv &lt; /dev/zero | nc -u ip.addy.of.other.machine 5000</code></li>
</ul>
<p>And you should get some output with a little &lt;=&gt; sign moving across the screen that resembles this (static):</p>
<pre class="brush: text;">1.15GB 0:00:19 [ 218MB/s] [             &lt;=&gt;                  ]</pre>
<p>This will show you the number of MB/s the connection is averaging; if you watch if for a bit, you can get an idea of where things stand.  Here are some of the results I got between my PowerMac, PowerBook, and EEE PC:</p>
<pre class="brush: text;">localhost:                      218MB/s
gigabit Ethernet:               143MB/s
100MB ethernet:                 11.5MB/s
wireless (poor connection):     141kB/s</pre>
<p>If you read the <a href="http://tech.slashdot.org/comments.pl?sid=1064679&amp;cid=26139847">original post on slashdot</a>, it seems you can us pv to measure a lot of other stuff as well &#8212; I haven&#8217;t played with it yet but should, one day.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.damontimm.com/how-to-test-connection-speed-between-two-machines/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How To: Network Trash on Ubuntu File Server (NAS) with SFTP (SSH + Fuse) and AFP (netatalk)</title>
		<link>http://blog.damontimm.com/network-trash-ubuntu-file-server-nas-sftp-ssh-fuse-afp-netatalk/</link>
		<comments>http://blog.damontimm.com/network-trash-ubuntu-file-server-nas-sftp-ssh-fuse-afp-netatalk/#comments</comments>
		<pubDate>Sun, 22 Apr 2007 13:13:50 +0000</pubDate>
		<dc:creator>Damon</dc:creator>
				<category><![CDATA[how to]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[nas]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[trash]]></category>

		<guid isPermaLink="false">http://www.damontimm.com/blog/network-trash-ubuntu-file-server-nas-sftp-ssh-fuse-afp-netatalk/</guid>
		<description><![CDATA[Purpose: create a Network Trash functionality for a Ubuntu Linux file server (NAS). Reason being: by default, files deleted from the command line on file server go away permanently. If I am connected to my file server from my Mac via AFP (through netatalk) or SSH (SFTP through Fuse) and delete a file, that file [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Purpose:</strong> create a Network Trash functionality for a Ubuntu Linux file server (NAS).  Reason being: by default, files deleted from the command line on file server go away permanently.  If I am connected to my file server from my Mac via AFP (through <a href="http://www.damontimm.com/blog/how-to-install-netatalk-afp-on-ubuntu-with-encrypted-authentication/">netatalk</a>) or SSH (SFTP through Fuse) and delete a file, that file is gone forever!  This is a problem, because often I find I want them back.  Enter: <a href="http://pages.stern.nyu.edu/~marriaga/software/libtrash/">libtrash</a>!</p>
<p><span id="more-37"></span></p>
<p>Tested on: Ubuntu 6.06.1, 6.10, 10.04.</p>
<h3>install libtrash and test it out</h3>
<p>The version of libtrash in the repository is not the latest &#8212; I prefer to grab it from source which, in this case, is very easy:</p>
<ul class="terminal">
<li><code>sudo aptitude install build-essential</code></li>
<li><code>wget http://pages.stern.nyu.edu/~marriaga/software/libtrash/libtrash-latest.tgz</code></li>
<li><code>tar xzf libtrash-latest.tgz</code></li>
<li><code>cd libtrash-3.2/</code></li>
<li><code>make</code></li>
<li><code>sudo make install</code></li>
</ul>
<p>Unlike a lot of software on linux, installing it isn&#8217;t quite enough to get it running.  I think this is because it is a lib package and not an actual program &#8212; it seems to be meant to be used by other programs in the background and not directly interact with the user (in the way that I want it to).</p>
<p>To test it out briefly, run the following to start the libtrash engine in your terminal prompt:</p>
<ul class="terminal">
<li><code>export LD_PRELOAD=/usr/local/lib/libtrash.so</code></li>
</ul>
<p>After the above command has run, you can do a little test by creating a file (the <code>touch</code> command doesn&#8217;t seem to work, so create a real file) and then delete it.  It should show up in your <code>~/Trash</code> folder.</p>
<p>If it isn&#8217;t working at this point, check out the documentation at: <code>/usr/share/doc/libtrash/</code></p>
<p>To make sure libtrash is running every time you login you need to add the <code>export</code> command to the top of <code>/etc/profile</etc>:</p>
<ul class="terminal">
<li><code>sudo nano /etc/profile</code></li>
</ul>
<pre class="brush: text"># /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

export LD_PRELOAD=/usr/local/lib/libtrash.so

[...]</pre>
<p>You should be all set in the terminal, at this point.</p>
<p>There are a few more steps that need to be taken in order to begin utilizing Trash folders for the users on your system.  For each method of connecting/utilizing the files on the server (through the command line, through <a href="#ssh">sshFS</a>, or <a href="#afp">AFP</a>), the LD_PRELOAD option needs to be called for libtrash.  Also, I recommend you use one of the Trash cleaning scripts (<a href="#cron">outlined below</a>).</p>
<h2 id="ssh">using libtrash with SFTP (sshFS)</h2>
<p>I like to mount my home server remotely using sshFS (which utilizes FUSE).  sshFS  can be used on the Mac through the MacFUSE project or on Ubuntu through Places/Go to Server Menu on 7.04).  To initialize libtrash, we need to create small script that loads the module just before the sftp-server is started and then tell openssh (in my case) to run that script (rather than starting the sftp-server directly).</p>
<p>I created by file at <code>/usr/local/lib/libtrash-sftp-server</code> and entered:</p>
<pre class="brush: bash;">#!/bin/bash
export LD_PRELOAD=/usr/local/lib/libtrash.so
/usr/lib/openssh/sftp-server</pre>
<p>Change permissions to make it executable:</p>
<ul class="terminal">
<li><code>sudo chmod +x /usr/local/lib/libtrash-sftp-server</code></li>
</ul>
<p>Then open the configuration file for ssh (<code>/etc/ssh/sshd_config</code>) and make the following change near the very end of the file (comment out the original and add your own):</p>
<pre class="brush: bash;">#Subsystem sftp /usr/lib/openssh/sftp-server
Subsystem sftp /usr/local/lib/libtrash-sftp-server</pre>
<p>Restart your ssh server and then, when you connect via sshFS (in Ubuntu go to Places < Connect to Server and choose a SFTP (SSH) server; on the Mac, you will need MacFuse and SSHFS) you'll be using your ~/Trash folder.</p>
<ul class="terminal">
<li><code>$ sudo /etc/init.d/ssh restart</code></li>
</ul>
<h2 id="afp">using libtrash with AFP (netatalk)</h2>
<p>I was able to use libtrash with netatalk by inserting the following line in the <code>/etc/init.d/netatalk</code> file (10.04 version shown here):</p>
<pre class="brush: bash; gutter: true; first-line: 88; highlight: 3;">
case "$1" in
	start)
        export LD_PRELOAD=/usr/local/lib/libtrash.so
		if [ "x$ATALK_BGROUND" = "xyes" ]; then
			echo "Starting Netatalk services in the background."
			atalk_startup >/dev/null &#038;
		else
			echo -n "Starting Netatalk services (this will take a while): "
			atalk_startup
			echo "."
		fi
	;;
</pre>
<p>I added line 90.  After, simply restart netatalk.</p>
<ul class="terminal">
<li><code>sudo /etc/init.d/netatalk restart</code></li>
</ul>
<h3 id="cron">how to empty the trash automatically</h3>
<p>If you look in <code>~/src/libtrash-x.x/cleanTrash/</code> you will find a couple different cleaning scripts.  I like strash the best.  If you do this, you can extract the script, install it to a usable path, and setup the man file (so you can read about its cleverness).</p>
<ul class="terminal">
<li><code>cd ~/src/libtrash-3.2/cleanTrash/</code></li>
<li><code>tar xvf strash.tar.gz</code></li>
<li><code>sudo cp strash-0.9/strash /usr/local/sbin/strash</code></li>
<li><code>sudo mkdir -p /usr/local/share/man/man8</code></li>
<li><code>sudo cp strash-0.9/strash.8 /usr/share/man/man8/strash.8</code></li>
</ul>
<p>You can read the man page for strash now, which will show you all the nifty options.  I added a line to my root crontab (by running: <code>sudo crontab -e</code>) that deletes all files over one week old:</p>
<pre class="brush: bash; gutter: true;">
# m h  dom mon dow   command
30 01 * * * /usr/sbin/strash --age 7d
</pre>
<p>Seems to work well.  Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.damontimm.com/network-trash-ubuntu-file-server-nas-sftp-ssh-fuse-afp-netatalk/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

