<?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>Terminal.app &#187; Mac OS X</title>
	<atom:link href="http://terminalapp.net/category/mac-os-x/feed/" rel="self" type="application/rss+xml" />
	<link>http://terminalapp.net</link>
	<description>All computers should be destroyed. And flies too.</description>
	<lastBuildDate>Sat, 04 Sep 2010 15:03:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Amanda: recovering a Mac OS X client</title>
		<link>http://terminalapp.net/amanda-recovering-a-mac-os-x-client/</link>
		<comments>http://terminalapp.net/amanda-recovering-a-mac-os-x-client/#comments</comments>
		<pubDate>Sat, 04 Sep 2010 14:14:38 +0000</pubDate>
		<dc:creator>Miguel Arroz</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Mac OS X Server]]></category>
		<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://terminalapp.net/?p=295</guid>
		<description><![CDATA[This is the third post about Amanda, an open source backup system for UNIX-based computers. The previous two posts were a general introduction to Amanda inner workings, and instructions for configuring a Mac OS X amanda client. In this post &#8230; <a href="http://terminalapp.net/amanda-recovering-a-mac-os-x-client/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is the third post about <a href="http://amanda.org/">Amanda</a>, an open source backup system for UNIX-based computers. The previous two posts were a <a href="http://terminalapp.net/amanda-on-mac-os-x/">general introduction to Amanda</a> inner workings, and instructions for <a href="http://terminalapp.net/amanda-installing-a-mac-os-x-client/">configuring a Mac OS X amanda client</a>.</p>
<p>In this post I&#8217;ll explain how to recover from a catastrophic failure, like when a hard drive dies. Although much of the steps are identical, this post is focused on how to recover the entire file system and not a small set of files that an user accidentally deleted. To recover something like that, you can simply run <code>amrecover</code> on the server, recover the files you need and transfer them using SFTP or any other protocol to the client machine.</p>
<p><span id="more-295"></span>Before going any further, let me just point out an important detail: if you have a downtime on a machine that lasts for a few days, and your tape rotation cycle is not long enough, you may loose your backups at some point (assuming you backup frequently enough). To avoid this, you have several options. The easiest one is to simply disable whatever mechanism triggers your backups (launchd, crontab, etc). Of course, this only makes sense if you have only one machine being backed up on a given Amanda configuration. If stopping the backups is not possible, you can copy the tape directories or, better yet, the tar files that match the affected machine&#8217;s volumes to a safe place. Remember you have to copy the correct files, from level 0 to whatever level you are on. If Amanda overwrites the tapes after doing this, you can always recover directly from the tar files.</p>
<p>To recover from an Amanda backup, you should be prepared with a small hardware setup that will make your life easier. I recommend you prepare the following before a problem occurs, so you can avoid doing this under stress. What you&#8217;ll need is an external hard drive with Mac OS X installed and the Amanda client installed on it. This way, you can boot the Mac with the freshly installed empty drive and restore the backed-up contents directly to that drive. Note that if you handle PowerPC and Intel Macs, you&#8217;ll need to be ready for both situations. The easiest way is to have two drives, although I believe it&#8217;s possible to have two bootable partitions on the same drive using a few tricks. Also, I recommend you install the latest OS for both processor families (Leopard on PowerPC, Snow Leopard on Intel).</p>
<p>When recovering, the Amanda client needs to contact the server, which means (assuming you&#8217;re using ssh security) you need to generate a public/private key pair on the client and install the public key on your server. I recommend you remove the public key from the server as soon as your recovery operation ends, for security reasons.</p>
<p>So, let&#8217;s assume you have a client made out of a Mac with a new, formatted and empty internal hard drive, and running Mac OS X installed from an external drive, with Amanda client installed and a public/private ssh key pair whose public key is already on the server. Let&#8217;s also assume the volume list of this machine is the one I recommended on my <a href="http://terminalapp.net/amanda-installing-a-mac-os-x-client/">previous post</a>:</p>
<pre>
/
/Applications
/Library
/Users
</pre>
<p>Here are the steps to recover everything from the backups to the empty drive:</p>
<p><strong>1. Launch <code>amrecover</code> on the client using the following command.</strong> This will start the recovering console.</p>
<pre class="brush: bash; light: true;">/usr/local/sbin/amrecover -C configname -s my.server.com -t my.server.com -oauth=&quot;ssh&quot;</pre>
<p>Replace <code>configname</code> by the name of the Amanda configuration you want to use for recovering, and <code>my.server.com</code> for your backup server. Note that you must refer to your backup server using a canonical name, not an IP. If you don&#8217;t have a canonical name, you can edit /etc/hosts and create one.</p>
<p><strong>2. Run the <code>sethost</code> command to set the host you want to recover.</strong> You can get a list of hosts managed by the current Amanda configuration using <code>listhost</code>. To recover from a host called andromeda, you would use:</p>
<pre class="brush: bash; light: true;">sethost andromeda</pre>
<p><strong>3. Use the <code>setdisk</code> command to define what volume you want to recover.</strong> Let&#8217;s start with the root volume, so type the following:</p>
<pre class="brush: bash; light: true;">setdisk /</pre>
<p>Like in the hosts case, you can use the <code>disklist</code> command to list the backed-up volumes.</p>
<p><strong>4. Use the <code>lcd</code> and <code>lpwd</code> commands to move to the root of the empty disk.</strong> This will tell Amanda where you want to recover stuff to. If your empty disk is called NewDisk, the command would be:</p>
<pre class="brush: bash; light: true;">lcd /Volumes/NewDisk/</pre>
<p>You can use the <code>lpwd</code> command to verify you defined the local directory to the correct path. <strong><span style="color:red;">It&#8217;s extremely important you don&#8217;t forget to define the local directory!</span></strong> Doing so results in Amanda recovering the data to whatever local directory is starts on, which is almost certainly not what you want to happen.</p>
<p><strong>5. Add the list of items to recover.</strong></p>
<p>We want to recover everything, so let&#8217;s just add the root directory:</p>
<pre class="brush: bash; light: true;">add /</pre>
<p>You can use the usual UNIX commands (<code>cd</code>, <code>pwd</code>) to navigate trough the backed-up hierarchy and select exactly what you want to recover. Note the paths are relative to the root of the current volume, not the root of the original client.</p>
<p><strong>6. Initiate the recovering procedure.</strong> To do that, simply use the <code>extract</code> command:</p>
<pre class="brush: bash; light: true;">extract</pre>
<p>Amanda asks you to confirm the operation, and will ask you if you want to load the needed tapes during operation. For unattended operation, I recommend you to hit the return key several times to answer &#8220;Yes&#8221; to all the tape change questions (assuming you&#8217;re using virtual tapes, and not real tapes, of course). This will take a while.</p>
<p>Repeat the following 3 steps for the remaining volumes (I&#8217;ll use /Library as an example):</p>
<p><strong>7. Use Finder or another terminal window to create the root folder of the volume:</strong></p>
<pre class="brush: bash; light: true;">
cd /Volumes/NewDisk
mkdir Library
</pre>
<p><strong>8. Back on Amanda, change disk and local directory to match the new volume:</strong></p>
<pre class="brush: bash; light: true;">
setdisk /Library
lcd /Volumes/NewDisk/Library
</pre>
<p><strong>9. Add all the files in the current volume, and initiate extraction:</strong></p>
<pre class="brush: bash; light: true;">
add /
extract
</pre>
<p>Again, repeat the previous steps for all the volumes you want to recover.</p>
<p><strong>10. Use Disk Utility to Repair Disk Permissions on the new disk.</strong> This will make sure the proper ownership and permission settings are assigned to the directories you created (and everything else).</p>
<p>You should now be able to boot from the recovered drive. You&#8217;re done. :)</p>
]]></content:encoded>
			<wfw:commentRss>http://terminalapp.net/amanda-recovering-a-mac-os-x-client/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Amanda: installing a Mac OS X client</title>
		<link>http://terminalapp.net/amanda-installing-a-mac-os-x-client/</link>
		<comments>http://terminalapp.net/amanda-installing-a-mac-os-x-client/#comments</comments>
		<pubDate>Fri, 03 Sep 2010 12:29:36 +0000</pubDate>
		<dc:creator>Miguel Arroz</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Mac OS X Server]]></category>
		<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://terminalapp.net/?p=213</guid>
		<description><![CDATA[In my previous article, I presented Amanda, its basic concepts, and how does it compare to Time Machine. Now, I&#8217;ll give you an example of how to install and configure a Mac OS X machine to be an Amanda client. &#8230; <a href="http://terminalapp.net/amanda-installing-a-mac-os-x-client/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://terminalapp.net/amanda-on-mac-os-x/">previous article</a>, I presented <a href="http://www.amanda.org/">Amanda</a>, its basic concepts, and how does it compare to Time Machine. Now, I&#8217;ll give you an example of how to install and configure a Mac OS X machine to be an Amanda client. The next post will explain how to properly recover after a catastrophic failure.</p>
<p>As with any UNIX tool, Amanda can be compiled, installed and configured in a lot of different ways. How you should do it depends on your needs, so don&#8217;t feel pressured to do everything in the same way I did, as it&#8217;s not &#8220;the right way&#8221;, just one way. Also, everything I describe here should work on the Leopard or Snow Leopard versions of either Mac OS X or Mac OS X Server on Intel or PowerPC Macs. I&#8217;m not sure about previous versions of the OS, but you may find more information about those in the <a href="http://wiki.zmanda.com/index.php/Installation/OS_Specific_Notes/Installing_Amanda_on_Mac_OS_X#On_10.3_and_10.4">Mac OS X installation notes</a> page of the Amanda wiki.</p>
<p><span id="more-213"></span>Also, I won&#8217;t write anything here about installing an Amanda server. I&#8217;m assuming either you already know how to do it and just want to check how to backup Mac OS X clients, or that you are new to Amanda and will follow the <a href="http://wiki.zmanda.com/index.php/Quick_start">appropriate tutorials</a> and do some experimentation before moving Amanda to production.</p>
<p>Before installing Amanda on a client, you need to decide what you want to backup, and how to split that into Amanda &#8220;disks&#8221;. I usually backup the entire machine (a single Mac OS X volume), so the obvious choice to make would be to consider the root of the file system as the only Amanda disk. But I recommend you to <em>not</em> do that. Why? Two reasons:</p>
<ul>
<li>If you consider the entire Mac OS X volume to be a single disk, a level 0 backup will use a lot of space, and take a long time to complete. Even worse, if the space needed for a level 0 backup is as large, or larger, than a single tape, you may not be able to perform the backup at all. By splitting the volume into smaller disks, Amanda will spread level 0 backups of those disks over time, which will also spread the space and time used for those necessary level 0 backups.</li>
<li>Different parts of your Mac OS X volume have different usage patterns. The /System directory, for instance, contains mostly read-only files that change only when installing a system update, which is a relatively rare event. On the other hand, the /Users folder contains user home directories, whose contents may change on a daily basis. This different behaviors lead Amanda to optimize it&#8217;s planning, specifically the decision to maintain of increase the backup level of a given disk, as explained in the previous article. If you don&#8217;t split two main directories like these, with radically different usage patterns, in different disks, you are making it harder for Amanda to make the right decision.</li>
</ul>
<p>The way I split an OS X volume into several disks depends on what machine is used for. However, I end up doing it always the same way for normal use desktop machines. I create the following disks:</p>
<pre>
/
/Applications
/Library
/Users
</pre>
<p>This usually works fine. Note that, if you are not careful, by considering / (the root) a disk, you&#8217;ll include all the other disks (those directories are inside the root) and any other devices (hard drives, CD-ROMs, USB pens, etc) that may be plugged in that computer (they will be mounted into the /Volumes directory). I was told Amanda won&#8217;t include mountpoints (which means it would not backup anything inside /Volumes anyway) but I haven&#8217;t tested. We&#8217;ll see how to solve this issue shortly.</p>
<p>If your users home dirs contain a lot of data, or data that don&#8217;t need to be backed up, you may consider splitting the /Users directory into smaller disks, and excluding easily restorable directories, like ~/Music. I never had to split the /Users directory, but I do exclude the ~/Music directories and any directories that contain virtual machine hard drive images (like Parallels or VMWare). Those files are huge, and change every time an user launches their virtualization software. If your users don&#8217;t have important data on those virtual hard drives (like in my case, we only use Windows to run IE), you can easily re-install Windows from scratch. If you do have important data on those drives, I recommend you install backup software on the virtualized OS to keep that data safe.</p>
<p>Ok, enough talking, let&#8217;s do it.</p>
<p><strong>1. Install a recent version of Xcode.</strong> You&#8217;ll need it to compile the needed stuff. Xcode 3.2.3 is the most recent version at the time I&#8217;m writing this and will do just fine.</p>
<p><strong>2. Install <a href="http://www.macports.org/">MacPorts</a>.</strong> Amanda needs glib2 to compile. glib2 has a lot of dependencies, so the easiest way to install it is using MacPorts. To do that, simply open the <a href="http://www.macports.org/install.php">MacPorts installation page</a>, download and run the appropriate installer for your version of OS X.</p>
<p><strong>3. Install glib2.</strong> After having installed MacPorts, this can be achieved using one simple command (run it as superuser):</p>
<pre class="brush: bash; light: true;">/opt/local/bin/port install glib2</pre>
<p>All glib2 dependencies (and glib2 itself) will be downloaded, compiled and installed. This will take a while, specially on PowerPC Macs, so if you need to have a snack or refill your coffee mug, this is a good time to do it.</p>
<p><strong>4. Create a user for Amanda and add it to the admin group.</strong> The best way to achieve this is to run the following list of commands as superuser:</p>
<pre class="brush: bash;">
sudo dscl localhost -create /Local/Default/Users/amandabackup
sudo dscl localhost -create /Local/Default/Users/amandabackup RecordName amandabackup
sudo dscl localhost -create /Local/Default/Users/amandabackup UserShell /bin/bash
sudo dscl localhost -create /Local/Default/Users/amandabackup RealName &quot;Backup User&quot;
sudo dscl localhost -create /Local/Default/Users/amandabackup UniqueID 5000
sudo dscl localhost -create /Local/Default/Users/amandabackup PrimaryGroupID 0
sudo dscl localhost -append /Local/Default/Groups/admin GroupMembership amandabackup
sudo dscl localhost -create /Local/Default/Users/amandabackup NFSHomeDirectory /Users/amandabackup
sudo ditto -rsrcFork '/System/Library/User Template/English.lproj/' /Users/amandabackup
sudo sh -c &quot;echo 'amandabackup_server.example.com amandabackup' &gt; /Users/amandabackup/.amandahosts&quot;
sudo chmod 600 /Users/amandabackup/.amandahosts
sudo chown -R amandabackup:wheel /Users/amandabackup
sudo passwd amandabackup
</pre>
<p>The last command defines a password for amandabackup user. You can later configure your ssh deamon to accept only public key authentication.</p>
<p><strong>5. Download Amanda.</strong> You may obtain Amanda&#8217;s source code from the <a href="http://www.amanda.org/download.php">Amanda downloads page</a>. Although the 3.* versions are already available, I&#8217;m using 2.6.1p2 for now. This instructions assume you&#8217;ll be using the same version. I&#8217;m not sure if version 3 compiles well on OS X. After downloading, uncompress the file.</p>
<p><strong>6. Compile and install Amanda.</strong> Amanda is installed using the standard UNIX configure/make/make install commands. You have, however, to provide some information on the configure command. The one I use is:</p>
<pre class="brush: bash; light: true;">
./configure --with-user=amandabackup --with-group=admin --with-ssh-security --without-server
</pre>
<p>After that, just run the usual:</p>
<pre class="brush: bash; light: true;">
make
sudo make install
</pre>
<p><strong>7. Create the /usr/local/var/amanda directory with the appropriate ownership.</strong> The install procedure somehow fails to create this directory, so you need to create it manually and give it the right ownership. So, as superuser, run the following commands:</p>
<pre class="brush: bash; light: true;">
mkdir -p /usr/local/var/amanda
chown amandabackup /usr/local/var/amanda
</pre>
<p>Amanda is now installed on the client. If you are going to use ssh as the tunnel for your connection, you should now copy the server&#8217;s ssh public key to the client and test the connection. You can then add the client&#8217;s volumes to the disklist and run amcheck to test the configuration.</p>
<p>Now you need to add exclude files to make sure the root volume won&#8217;t contain all the others, and to exclude large files whose backup is not needed (like music or movies). To do that, you have to add a configuration directive in your Amanda server configuration files. That directive tells Amanda the name of the file that includes the exclude list, which is the list of files to be excluded from backup. This is a sample configuration I use:</p>
<pre>define dumptype comp-tar {
    program "GNUTAR"
    compress fast
    index yes
    record yes
    auth "ssh"
    exclude list optional ".amanda-exclude.list"
}</pre>
<p>Now you need to create the exclude files where needed, named &#8220;.amanda-exclude.list&#8221;. I usually use two of those files. One in the root of the file system with the following content:</p>
<pre>
./Volumes
./Applications
./Library
./Users
./home
</pre>
<p>This excludes the other Mac volumes (that are mounted in the /Volumes directory) and the other defined Amanda volumes (the word &#8220;volume&#8221; is used on both contexts which may lead to confusion, but you want to exclude both kinds of volumes, so it&#8217;s ok). If you&#8217;re wondering about /home, it has no useful content (I suppose it&#8217;s there just for compatibility with some UNIX tools) and causes problems if not excluded.</p>
<p>The second file would go in /Users directory, and contain something like this:</p>
<pre>
./&lt;user&gt;/Music
./&lt;user&gt;/Documents/Virtual Machines.localized
</pre>
<p>Replace &lt;user&gt; with the username of the machine user, and duplicate the lines for additional users. This would exclude the user&#8217;s music directory and the VMWare disk images. Of course, your milage may vary. If you want to backup everything, just don&#8217;t add this second file.</p>
<p>You should now have a perfectly functional Amanda client.</p>
]]></content:encoded>
			<wfw:commentRss>http://terminalapp.net/amanda-installing-a-mac-os-x-client/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Amanda on Mac OS X</title>
		<link>http://terminalapp.net/amanda-on-mac-os-x/</link>
		<comments>http://terminalapp.net/amanda-on-mac-os-x/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 14:42:15 +0000</pubDate>
		<dc:creator>Miguel Arroz</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Mac OS X Server]]></category>
		<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://terminalapp.net/?p=181</guid>
		<description><![CDATA[Given that Retrospect 8 is essentially a piece of crap, I&#8217;ve been searching for an alternative I can use when Time Machine is not an option for backing up Macs. The main two points I&#8217;m focused on is reliability and &#8230; <a href="http://terminalapp.net/amanda-on-mac-os-x/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Given that Retrospect 8 is essentially a piece of crap, I&#8217;ve been searching for an alternative I can use when Time Machine is not an option for backing up Macs. The main two points I&#8217;m focused on is reliability and speed. I want a backup system I can trust that won&#8217;t take the age of the universe to recover a file.</p>
<p>I&#8217;ve been using <a href="http://www.amanda.org/">Amanda</a> for a while now to backup all the Macs in our workgroup (10 machines) and so far I&#8217;m nothing but happy. Amanda is an open source backup system for UNIX-based operating systems, Mac OS X included (I believe it can also backup Windows clients, but I couldn&#8217;t care less).</p>
<p><span id="more-181"></span>Amanda was originally designed to backup to tapes. Today, since hard drives became cheap and are a great media for backup, Amanda also supports virtual tapes. A virtual tape is a directory on disk that essentially acts as a tape, storing raw information. While configuring an Amanda server, you create a set of tapes of an arbitrary size (100 GB, for instance) and Amanda will use at least one tape per day, eventually rotating trough all of them.</p>
<p>I&#8217;ll now lay down some considerations about how Amanda works and how does that reflect on usage and backup planning. Also, I&#8217;ll do some comparisons with Time Machine.</p>
<p><strong>Scheduling</strong></p>
<p>In amanda, you define one or more configuration files. Each configuration can have a set of hosts (a backed-up machine), and for each host a set of disks (a disk is any directory you want to backup, it&#8217;s not needed to match Amanda disks with physical disks or logical HFS+ volumes). You generally run a backup operation that will backup all the disks of all the hosts on that configuration file.</p>
<p>Launching a backup operation is done by simply executing an UNIX command from whatever mechanism you prefer (cron, launchd, manually, etc). This means you can define how often does your backup run, and at what time. Usually, a daily backup is performed, but you may want to backup every 6 hours or only once per week, depending on how often does your data change and how bad is it to loose a few hours of work. This means that, in Amanda, the server is proactive and initiates the backup procedure whenever you set it to. In Time Machine, backup operations are initiated by the clients every hour. The server is simply a dumb file server where backups are stored.</p>
<p><strong>Storage</strong></p>
<p>Amanda uses the tar format to store data on a virtual tape. For each backed-up disk Amanda creates a tar file inside the tape with data. Amanda stores data in incremental fashion, using some redundancy as well. This is implemented trough the concept of backup levels. The base backup (where all the files on a disk are backed-up) is level 0. From there, backup levels are incremented, and each level essentially means it contains the incremental changes relative to an archive in the immediate lower level. This means a level 3 backup contains the changes relative to a level 2 backup. That level 2 backup contains the changes relative to a level 1 backup which contains, as expected, the changes relative to the level 0 backup.</p>
<p>Amanda decides on the level is should operate on based on a complex planner that considers several factors that result in a decision. You may add some configuration options to customize the weight of some of those factors in the final planner decision. Essentially, Amanda tries to obtain the right balance between reliability (which, in this context, means the probability of recovering a backup successfully) and used disk space. Reliability decreases as the backup level increases, due to the fact that, if you want to recover a level 5 backup, you need to have the consistent level 0, 1, 2, 3, 4 and obviously 5 backups, because each of those build upon the previous one. A level 0 backup is more reliable in the sense that you only need the level 0 backup itself to recover. Of course, a level 0 backup is an &#8220;everything&#8221; backup. If you do a level 0 backup every day, you&#8217;ll use a lot of disk space.</p>
<p>This is an example of a production Amanda installation for a host called bergman and volume / (the root):</p>
<pre>

date                host    disk lv tape or file file part status
2010-07-01 06:05:24 bergman /     2 DAILYS-6       15  1/1 OK
2010-07-02 04:19:11 bergman /     3 DAILYS-7       23  1/1 OK
2010-07-04 04:47:44 bergman /     3 DAILYS-9        9  1/1 OK
2010-07-05 02:51:01 bergman /     0 DAILYS-10      21  1/1 OK
2010-07-06 02:51:34 bergman /     1 DAILYS-11      11  1/1 OK
2010-07-07 04:59:40 bergman /     1 DAILYS-12      12  1/1 OK
2010-07-08 02:59:32 bergman /     1 DAILYS-13      15  1/1 PARTIAL
2010-07-10 02:46:41 bergman /     1 DAILYS-15      20  1/1 OK
2010-07-11 05:25:49 bergman /     2 DAILYS-16       8  1/1 OK
2010-07-12 03:43:04 bergman /     0 DAILYS-17      16  1/1 OK
2010-07-13 04:25:23 bergman /     1 DAILYS-18      11  1/1 OK
2010-07-14 02:56:48 bergman /     1 DAILYS-19      15  1/1 OK
2010-07-15 02:54:01 bergman /     2 DAILYS-20      11  1/1 OK
2010-07-16 02:46:30 bergman /     2 DAILYS-1       11  1/1 OK
2010-07-17 05:05:08 bergman /     3 DAILYS-2       12  1/1 OK
2010-07-18 03:00:43 bergman /     3 DAILYS-3        9  1/1 OK
2010-07-19 05:11:36 bergman /     3 DAILYS-4        7  1/1 OK
2010-07-20 02:49:03 bergman /     4 DAILYS-5       24  1/1 OK
</pre>
<p>The backup level is indicated by the &#8220;lv&#8221; column. As you can see, I have 20 virtual tapes, and the last one to be used was DAILYS-5. The next one will be DAILYS-6 (its content will be erased and the tape will be reused). You may be asking yourself why are there two level 0 backups, and a lot of consecutive repeated backups with the same level.</p>
<p>Consider two rules of thumb to understand that:</p>
<p>1) A level 0 backup is needed to recover, so Amanda must make sure at least one level 0 backup exists at any time, given the number of tapes and their rotation. Also, bad stuff can happen, like a machine being down or unavailable at the time the backup runs. If that happens during a few Amanda runs, it may happen than you hit a number of rotations where you effectively loose the level 0 backup without creating a new one. That&#8217;s why Amanda makes a few level 0 backups among the way, to make sure you still have a second level 0 backup if the first one is destroyed. You can configure the maximum number of runs that go by without a level 0 backup being created. It&#8217;s highly recommended that that number is lower than the half of the total amount of tapes you have, so that, in the worst case (like in my example, where I have 20 tapes), you have a level 0 backup in the &#8220;middle&#8221; of your tape recycling circuit. Now, why did Amanda created two level 0 backups, one in July 5, and another one in July 12, effectively less than the maximum time allowed? See below.</p>
<p>2) Despite what seems intuitive, Amanda does not increase the backup level every run until it gets back to zero again. I don&#8217;t know in detail all the data the planner uses to make a decision, but there are at least two interesting considerations the planner takes into account.</p>
<p><em>The first one</em>, is a level N+1 backup a lot smaller than a level N? If the answer is no, Amanda decides to keep the same level. There&#8217;s no point in increasing the level (and lowering reliability) if no significative amount of disk space will be saved. This may happen if you change approximately the same set of files in each run. In that case, the incremental backup from level N to N+1 would be of almost the same size as the N-1 to N.</p>
<p><em>Second</em>, Amanda sometimes promotes level 0 backups ahead of schedule to spread them trough time. Doing all the level 0 backups in the same day would be very slow and might not fit in the maximum number of tapes allowed for a single run (you can define that value on the config file). There&#8217;s also another factor: free space on the tape. Remember that, for now, Amanda cannot use the same tape in two consecutive runs, so there&#8217;s no point in leaving unused space on a tape. If there&#8217;s enough space to perform a level 0 backup instead of a higher level, Amanda may decide to do it.</p>
<p>As you can see by now, data storage is handled quite differently in Amanda and Time Machine. I&#8217;ll assume you know how Time Machine works, so I&#8217;ll get straight to the point: in Amanda you may have more than one copy of the entire volumes you are backing up (ie, several level 0 backups of the same data), so you need to take that in consideration while planning storage space. On the other hand, amanda allows gzip compression (and encryption) of backup data, so it&#8217;s not completely obvious how much more (or less) space you need for Amanda backups compared to Time Machine. In some situations, if your data is highly compressible, you may even end up with two level 0 backups taking <em>less</em> space than a single Time Machine backup, although the opposite will happen most of the time. What&#8217;s cool is that if you use compression, Amanda learns with time how compressible your data is, and adjusts it&#8217;s planning according to that.</p>
<p>Another interesting note is Amanda using standard file formats for storing backups (tar and optionally gzip). This allows recovering of data even in machines where Amanda is not present. If you navigate into a virtual tape directory on your file system and run the &#8220;head&#8221; command in one of the stored files, you&#8217;ll see something like this:</p>
<pre>
AMANDA: FILE 20100715010001 serpa /Library  lev 2 comp .gz
  program /usr/bin/gnutar
DLE=&lt;&lt;ENDDLE
&lt;dle&gt;
  &lt;program&gt;GNUTAR&lt;/program&gt;
  &lt;disk&gt;/Library&lt;/disk&gt;
  &lt;level&gt;2&lt;/level&gt;
  &lt;auth&gt;ssh&lt;/auth&gt;
  &lt;compress&gt;FAST&lt;/compress&gt;
  &lt;record&gt;YES&lt;/record&gt;
  &lt;index&gt;YES&lt;/index&gt;
  &lt;exclude&gt;
    &lt;list&gt;.amanda-exclude.list&lt;/list&gt;
    &lt;optional&gt;YES&lt;/optional&gt;
  &lt;/exclude&gt;
&lt;/dle>
ENDDLE
To restore, position tape at start of file and run:
	dd if=&lt;tape&gt; bs=32k skip=1 | /usr/bin/gzip -dc |
          /usr/bin/gnutar -xpGf - ...
</pre>
<p>The first part is metadata used by Amanda. After the metadata ends, there are two lines used to tell you how to restore the data stored on that file with standard UNIX tools. This means you don&#8217;t need to worry about being able to recover your backups if Amanda development happens to stop for some reason. As long as you have an UNIX machine, you&#8217;ll be able to restore your data.</p>
<p><strong>Security</strong></p>
<p>There are two points I want to mention about security: transport and storage encryption, and system architecture. I&#8217;ll assume we&#8217;re always talking about having a backup server and several clients. If the problem you&#8217;re trying to solve is so simple that it can be fixed with an USB disk and Time Machine, you&#8217;re just wasting your time reading this. :)</p>
<p>Amanda supports encryption both during the data transport and on data storage. Transport security is guaranteed by using ssh with public/private key pairs. It also supports data encryption on the data storage by using symmetric private-key based encryption of public/private key pairs. Encrypting your backups is important, specially if you store them in an offsite location (either via network transfer to a remote data center, or by physically storing hard drives or real tapes in a safe). In the event data ends up in the wrong hands, encryption will rend it useless for the bad guys. Things are substantially different in Time Machine. Data storage encryption is simply non-existing (unless you use a lower level encryption method, like PGP). Transport encryption may be provided by the AFP protocol, used by Time Machine to connect to the backup server, depending on your server configuration.</p>
<p>More interesting, in my opinion, is the implicit security resulting from the client/server architecture used by Amanda. A backup server should be one of the most safer and well guarded machines you have in your network. All your data will be there. If the backup server gets compromised, it means <strong>all</strong> the data from <strong>all</strong> the backed-up machines might now be in the wrong hands. You would want your backup server to run as few services as possible, and to allow access to the server (like ssh) only by trusted admins from controlled networks.</p>
<p>In Amanda, this is possible. As I described before, when a backup operation starts, the Amanda server will contact its clients using the method you chose in the configuration (ssh in my case). So the connection is made from the server to the client, and not the opposite. This means your user&#8217;s machines (which will naturally be less secure than your server because those pesky users will run all the crap they get from the internets!) will never access the backup server, and though compromise it&#8217;s security. Time Machine works in the opposite direction. There&#8217;s no concept of a &#8220;backup server&#8221;. The clients run the show, and the server is simply a file server where backups are stored. This exposes the user backups to whatever malware and trojan horses they may have running on their Macs. If the server is misconfigured, or if some hacker exploits an unknown vulnerability in the AFP protocol, other users backups may be compromised as well.</p>
<p><strong>Conclusions</strong></p>
<p>Amanda may be a great option to backup always-on Macs, like xServes or desktop machines (along with Linux or FreeBSD servers, of course). It offers a vey fast, reliable and secure infra-structure upon you may build your backup system. However, it lacks the user interface and simplicity of Time Machine (most configurations require sysadmin intervention for recovering data from a backup). Also, Time Machine may be more appropriate if you rely heavily on laptops that will not be available on the network on a predictable schedule.</p>
<p>Amanda pros:</p>
<ul>
<li>Works on any UNIX system (and Windows clients) which may help when planning a multi-OS backup scenario.</li>
<li>Offers very good control of used disk space.</li>
<li>Allows data encryption and compression.</li>
<li>Secure client/server architecture.</li>
<li>May be used on real tapes, not just hard drive-based backups.</li>
</ul>
<p>Amanda cons:</p>
<ul>
<li>Not appropriate for laptops that may be out of network reach during backup operations.</li>
<li>Step learning curve, a little hard for beginners to configure and get everything running smoothly.</li>
<li>Unless your users are computer experts and have access to the backup server, it requires sysadmin intervention for recovering data.</li>
<li>Recovering a single file may take some time, because the entire tar archive has to be read until the file is found.</li>
<li>Backups are usually less frequent than Time Machine.</li>
</ul>
<p>Time Machine pros:</p>
<ul>
<li>Very simple setup.</li>
<li>Non-expert users may recover lost files and easily browse filesystem history using the stunning user interface, without requiring sysadmin intervention.</li>
<li>Works fine with laptops with intermittent network connections.</li>
<li>Very well integrated with Mac OS X, makes backing up and recovering very easy and part of normal usage and new machine installation workflow.</li>
</ul>
<p>Time Machine cons:</p>
<ul>
<li>Works only on Mac OS X, and requires a Mac OS X Server as backup server (unless you go with unsupported devices and face possible consequences).</li>
<li>Offers no data storage security.</li>
<li>Very hard/impossible to control data storage strategy and used space.</li>
<li>Requires clients to access server, which decreases security.</li>
<li>Works only with disk-based backups.</li>
</ul>
<p>There&#8217;s no clear winner here, it highly depends on your needs and restrictions. I hope this article gave you a general idea of what Amanda is, how does it work, and it&#8217;s advantages and weaknesses. In the next article, I&#8217;ll describe how to install a Mac OS X amanda client, and how to recover from a catastrophic drive failure.</p>
]]></content:encoded>
			<wfw:commentRss>http://terminalapp.net/amanda-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Retrospect w8</title>
		<link>http://terminalapp.net/retrospect_w8/</link>
		<comments>http://terminalapp.net/retrospect_w8/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 02:11:02 +0000</pubDate>
		<dc:creator>Miguel Arroz</dc:creator>
				<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://terminalapp.net/?p=145</guid>
		<description><![CDATA[There&#8217;s a rule of thumb for software development: make it, make it good, make it fast. For those unfamiliar with it, this means you should first build the core functionality of the software. Then, fix it&#8217;s bugs and make it &#8230; <a href="http://terminalapp.net/retrospect_w8/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a rule of thumb for software development: make it, make it good, make it fast. For those unfamiliar with it, this means you should first build the core functionality of the software. Then, fix it&#8217;s bugs and make it as reliable as you can. Finally, optimize it to make it fast enough for your needs.</p>
<p>Retrospect 6 was a very good backup software, but its age was showing up. It was still fundamentally a Mac OS 9 app running on top of OS X Carbon API. The worst part about this was the need to launch the application in Finder, forcing you to have automatic login configured and remote-acess your backup machine via Remote Desktop or VNC, assuming it was running on a data center. Despite that, it was very reliable (I had two situations where Retrospect complained about corrupted data, and both situations were caused by faulty hardware). Also, it was not the fastest software I had seen, but it was good enough. Keep in mind Retrospect was designed when file systems had hundreds or a few thousand files on them, not a million or more like it&#8217;s normal today (I have about 1.5 million files on my laptop drive).</p>
<p><span id="more-145"></span>Facing the unavoidable, EMC decided to re-write Retrospect from the ground up as a modern OS X product, using Cocoa APIs and changing it&#8217;s architecture to a proper UNIX daemon (with a remote graphic console). Besides theoretically solving all the version 6 downfalls, they added some nice goodies, like AES 256 encryption, grooming, and some details. A nice one is that the disk backups are now stored in 100 MB files instead of a unique, giant file. This solves a lot of problems related to NAS systems.</p>
<p>Assuming you need backup software, you would think this were great news, right? Well, so did I. However, reality seems to be a lot worse than the perfect scenery I described above. EMC worked a lot of time on this version, and you would think they had made it, made it good and made it fast, right? Well, they decided to stop somewhere in the &#8220;Make it good&#8221; part. The problem is, rules of thumbs are nice, but common sense helps. If you launch a product that is simply too slow to be useful, people won&#8217;t use it.</p>
<p>Our backup machine at the university is an old G4, dual CPU (1 Ghz, I guess). Yes, it&#8217;s not exactly a screamer, but what the hell, we are talking about copying and storing files. It&#8217;s not exactly rocket science, and if the machine was up to the task when it was new, it should be up to the task now. We upgraded the RAM to a decent amount, of course.</p>
<p>So, last week I needed to recover the /etc directory of a colleague&#8217;s laptop to recover some apache and PHP settings that Snow Leopard installer happily overwrote. We&#8217;re talking about 3 MB of data, something that should be as simple as pressing a few buttons and get the data back. The laptop had about 750 thousand files on it, which, in my opinion, is not that many for today&#8217;s standards. So, why the hell took me about <strong>3 hours</strong> to recover those files? Loading the catalog into the UI took almost 2 hours. Deselecting the whole file tree took almost 1 hour. The rest was the recovery process itself.</p>
<p>Ok, EMC. I know this stuff is optimized for Intel, and you do a lot of byte-order swapping on PowerPC. I know I&#8217;m using an old machine. But for god sake. What the hell are you doing to my CPU that needs 3 god damn hours to load a 750 000 files catalog into memory? And what&#8217;s the story with deselecting all the files? Are you telling me that, when I press the checkbox on the file root, you REALLY go trough the entire file tree and deselect each individual file? (In a rather inefficient way, because changing 750 000 booleans would take about&#8230; what? 1 millisecond on a 1 Ghz CPU?)</p>
<p>Well, I have at home a Dual 2 Ghz PowerPC machine that acts as backup storage, among other things. I have an AES 256 encrypted disk image (note that, at the university, I&#8217;m not using encryption, or else it would render things unbearable), served by AFP, acting as the time machine target for my laptop. When I installed Snow Leopard, I also had to recover some stuff from the /etc directory. Do you know how long it took? About 5 freaking seconds! And please, don&#8217;t tell me it&#8217;s because the G5 is faster!</p>
<p>Enough is enough, and 3 hours to recover a few files is ridiculous. I&#8217;ll study the possibility of migrating backups to Time Machine. Yes, space management is worse. Yes, client machines have to access the server, making the whole setup less secure than Retrospect where the server accesses the clients. But people won&#8217;t have to stop working for hours waiting for some files to be recovered.</p>
<p>Lesson for you, EMC: I&#8217;m not asking for you to make it fast before making it good, but at least make performance acceptable before releasing the product. Specially after taking so many years to build it.</p>
]]></content:encoded>
			<wfw:commentRss>http://terminalapp.net/retrospect_w8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apple 2009 wish list</title>
		<link>http://terminalapp.net/apple-2009-wish-list/</link>
		<comments>http://terminalapp.net/apple-2009-wish-list/#comments</comments>
		<pubDate>Fri, 02 Jan 2009 00:31:09 +0000</pubDate>
		<dc:creator>Miguel Arroz</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Generic]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Mac OS X Server]]></category>
		<category><![CDATA[WebObjects]]></category>

		<guid isPermaLink="false">http://terminalapp.net/?p=70</guid>
		<description><![CDATA[It&#8217;s a brand new year. So here&#8217;s my wish list for Apple: Please fix the wireless driver that causes my Mac to crash about 10% of the times I turn Airport off. Please fix the trackpad driver, or whatever is &#8230; <a href="http://terminalapp.net/apple-2009-wish-list/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a brand new year. So here&#8217;s my wish list for Apple:</p>
<ul>
<li>Please fix the wireless driver that causes my Mac to crash about 10% of the times I turn Airport off.</li>
<li>Please fix the trackpad driver, or whatever is causing the trackpad to behave strongly erratic during about 30 seconds after waking the Mac up.</li>
<li>Please fix the damn copy/paste bug that makes the paste command paste the previously copied object and not the most recent one. This is specially irritating when you cut a piece of text, paste and you realize you are pasting something else, and that your supposedly cut piece of text is lost forever, unless you can undo and get it back.</li>
<li>Please fix the irritating bug that causes an iChat window to keep being the active one even after I click Safari, making its window go in front of iChat&#8217;s. That&#8217;s specially annoying when I type apple-W to close the Safari window, and the ichat one goes away.</li>
<li>Please provide replacement keyboards for people who has pre-unibody MacBook Pros that, you know, actually sense a keystroke every time the key goes all the way down, without the need to almost punch the key.</li>
<li>Please fix whatever is causing my father&#8217;s MacBook Pro to keep waking up and going back to sleep when the lid is closed and the charger on, despite I had already turned off every god damn thing that could wake it up, including the lid open event.</li>
<li>Speaking about the charger, please provide chargers where the charge light doesn&#8217;t go off for some unknown reason. It still works, but it doesn&#8217;t inspire a lot of confidence in it ans it&#8217;s safety.</li>
<li>Please provide granular updates to Mac OS X Server. Please please please pretty please.</li>
<li>Please care a little more about the entreprise and IT markets, namely your own web application technology (WebObjects, of course).</li>
</ul>
<p>Thank you, guys! You must hate me but you&#8217;re nice people anyway. Sometimes.</p>
]]></content:encoded>
			<wfw:commentRss>http://terminalapp.net/apple-2009-wish-list/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Versions is out</title>
		<link>http://terminalapp.net/versions-is-out/</link>
		<comments>http://terminalapp.net/versions-is-out/#comments</comments>
		<pubDate>Mon, 24 Nov 2008 02:19:50 +0000</pubDate>
		<dc:creator>Miguel Arroz</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[subversions]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[Versions]]></category>

		<guid isPermaLink="false">http://terminalapp.net/?p=53</guid>
		<description><![CDATA[Versions is finally out! :) João Pavão, together with the Sofa team, released their new Subversion client. It&#8217;s a really powerful application made by people who deeply understand how a Mac application should be. In a world full of dubious &#8230; <a href="http://terminalapp.net/versions-is-out/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p align="center"><a href="http://versionsapp.com"><img src="http://terminalapp.net/wp-content/uploads/2008/11/versions.png" alt="" title="Versions Icon" width="158" height="140" class="size-full wp-image-54" /></a></p>
<p><a href="http://versionsapp.com">Versions</a> is finally out! :) <a href="http://picodev.com/">João Pavão</a>, together with the <a href="http://www.madebysofa.com/">Sofa</a> team, released their new Subversion client. It&#8217;s a really powerful application made by people who deeply understand how a Mac application should be. In a world full of dubious software, it&#8217;s good to see that some people still care a lot about their code quality and the detail. I feel honored for having been one of the few who saw this application being born and getting mature enough to be released in the wild. Congratulations, João! :)</p>
]]></content:encoded>
			<wfw:commentRss>http://terminalapp.net/versions-is-out/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PGP Desktop 9.9 mini-review</title>
		<link>http://terminalapp.net/pgp-desktop-99-mini-review/</link>
		<comments>http://terminalapp.net/pgp-desktop-99-mini-review/#comments</comments>
		<pubDate>Sun, 14 Sep 2008 01:16:37 +0000</pubDate>
		<dc:creator>Miguel Arroz</dc:creator>
				<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://terminalapp.net/?p=48</guid>
		<description><![CDATA[Introduction As I previously wrote in my blog, I was waiting for a whole disk encryption solution to be made available for Mac OS X. Some months ago, Checkpoint released what I believe was the first solution ever to support &#8230; <a href="http://terminalapp.net/pgp-desktop-99-mini-review/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>As I previously wrote in my blog, I was waiting for a whole disk encryption solution to be made available for Mac OS X. Some months ago, <a href="http://www.checkpoint.com/">Checkpoint</a> released what I believe was <a href="http://www.checkpoint.com/products/datasecurity/pc/index.html">the first solution ever</a> to support full disk encryption on the Mac, including the boot disk. Recently, <a href="http://terminalapp.net/pgp-desktop-99-released/">as I noted before</a>, <a href="http://www.pgp.com/">PGP Corporation</a> release <a href="http://www.pgp.com/products/wholediskencryption/index.html">PGP Desktop 9.9 for Mac OS X</a>, supporting full boot-disk encryption for the first time on this platform. I opted for trying PGP, as they made a demo version available (that will work for 30 days) and it&#8217;s possible to buy a license online. Checkpoint, on the other hand, doesn&#8217;t seem to have a downloadable demo, and doesn&#8217;t sell the product online. This was enough for me to forget Checkpoint solution at all, specially having the PGP demo ready to be downloaded from their site and installed. So, PGP it is.</p>
<p><strong>Why should you care?</strong></p>
<p>Today, you easily buy a laptop with a large hard drive. That drive will quickly be full of important data. Many people consider &#8220;important data&#8221; to be private emails, trip photos, holiday movies, and such. But that&#8217;s just the tip of the iceberg. Letting anyone read your email or pick at your photos can be a problem, but it&#8217;s nothing compared to <em>really</em> important data. I&#8217;m talking about company reports. Source code. Data about your customers. Intelectual property. Financial data. Anything that keeps your business going, and that can put it in a very delicate position if it gets to the wrong hands.</p>
<p>Also, there&#8217;s an even more important fact you should take into account: some data you are carrying on your laptop is not yours, but other people&#8217;s data. Confidential emails with clients or business partners. Marketing and product information that should not be disclosed before a certain date. Governmental and military information, including private data from citizens (as an example, recently some events like this one happened in UK, where <a href="http://news.zdnet.co.uk/itmanagement/0,1000000308,2077931,00.htm">laptops with sensitive official information were stolen or lost</a>). This means that you are no longer responsible just for your data security, but also for other people&#8217;s. </p>
<p>On top of this, you must think about the consequences of letting this information be revealed to the wrong persons. Important information about your clients may leak. Intelectual property that keeps your company ahead of the concurrency may become public, destroying your company advantage or, in the worst case, destroying the company itself. Governmental agencies may be placed in the hot seat for letting private information about the citizens be stolen and accessed.</p>
<p>All this together should be more than enough to make you worry about your computer&#8217;s data security and convincing you to do something about it.</p>
<p><strong>Whole disk encryption</strong></p>
<p>Computer security is a very wide subject, and there are a lot of things to consider. Network security, host security, etc. In this article, I&#8217;m covering whole disk encryption. So, what is whole disk encryption?</p>
<p>Whole disk encryption is a technique where all the drive contents are encrypted using a secret key (which can be a password, a key stored in a USB dongle, etc). When I say &#8220;all the drive contents&#8221;, I mean it. Even the operating system is encrypted. This means that you will only be able to access that drive&#8217;s contents if you have the key to access them, and this includes booting the computer from that drive. If you don&#8217;t have the key, you won&#8217;t be able to read the data whatever you try. Mounting it on other computers of physically installing it on a different computer won&#8217;t work. For anyone who doesn&#8217;t have the key, the drive will be as good as an empty one. All the contents will appear to be random garbage.</p>
<p>For those who have the right key, the main advantage of whole disk encryption is that it won&#8217;t affect the computer usage at all. The only thing you have to do is to type in the password right after powering up your machine. After you type the password, the OS will boot normally and the machine will work as if nothing special was happening. The secret is that PGP runs between the hardware and the OS itself, intercepting all the data input and output from and to the hard drive. All the applications, and even the OS itself won&#8217;t even realize that the hard drive is encrypted because the PGP layer will decrypt data requested by the applications on the fly. This is great, because it makes very unlikely that some application won&#8217;t work because of the disk encryption process. All the magic happens below the OS itself, as close to the hardware as it can be.</p>
<p>This will protect your data against one of the attack vectors that is most hard to defend yourself against: someone having physical access to (and some time alone with) your machine. This included the machine being stolen (which is very likely to happen at some point to laptop computers), someone entering your home or office and remove a hard drive from a computer, and even accessing data centers and stealing hard drives or entire servers (and if you think that doesn&#8217;t happen&#8230; think again, it&#8217;s more frequently that what most people believe).</p>
<p>I want to make clear that this will <strong>not</strong> protect your mac against other types of attacks. As I stated before, the OS and the applications will run in the same way they did before. So, if you have a virus or a trojan horse on your system, the virus or trojan will work. If you have a compromised network service, hackers will be able to get in using it. If you download an application that erases all your files, all the files will be erased. The whole disk encryption system has the only purpose to keep all the data on your hard drive protected when the system is not running. As long as you type in the password and boot the OS, all the OS-level security weaknesses that were there before will be there again. PGP Desktop has some more security features but I won&#8217;t cover them here.</p>
<p><strong>What about Apple&#8217;s File Vault?</strong></p>
<p>Apple provides you with some &#8220;transparent&#8221; data encryption features on Mac OS X, namely File Vault. File Vault will encrypt all the files in your home directory and store them on an encrypted disk image. You will always be able to turn the Mac on, but you must provide your account password on the login for that disk image to be accessed. As with PGP, data will be encrypted and decrypted on the fly. So, why not use it? There are many reasons why using File Vault is impractical:</p>
<ol>
<li>It&#8217;s not <strong>whole</strong> disk encryption, only home directory encryption. One may argue that all the important files are in the home directory, but that&#8217;s not entirely true. Many applications write temporary files to directories outside of your home directory, like /tmp. This files may contain sensitive information, and that information will be recorded unencrypted on your drive. Also, software like databases of other kind of servers store their data outside of user&#8217;s home directories, and that data will also be stored in clear.</li>
<li>It conflicts with some applications, specially backup solutions. For any application executed by another user, including the OS itself, a user home directory will be a single, huge file, the encrypted disk image. The backup software will not be able to peek inside your home and only backup the files you changed since the last backup operation, so it will try to copy the entire file. Worse yet, if you change the file during the backup, you can corrupt the backup, making it hard or impossible to restore it if needed.</li>
<li>For the same reason, remote services will not work because they won&#8217;t be able to decrypt your home directory. This is the case of a remote shell, for instance. If you ssh to a Mac with your home directory under the domain of File Vault, you won&#8217;t be able to access your files.</li>
<li>It&#8217;s slow an unreliable. File Vault works by creating an encrypted virtual file system inside a file that grows and shrinks as needed that is itself stored in the real file system on your drive. There&#8217;s a huge load of things that can go wrong with this. This is corroborated by the fact that every time I tried to create disk images with many (hundreds of thousands) of files, the disk image inevitably corrupted and I could not access it&#8217;s content any more. Don&#8217;t forget that your entire home directory will be really a single huge file with some complex data and mechanisms that make it work. Now compare this with the simplicity of the PGP solution: just insert a layer between the OS and the drive, and don&#8217;t ever think about it again. It just works, it doesn&#8217;t need to care about files, folders, file systems, or anything else. It&#8217;s just raw data. OS asks it to write a sector on the drive, PGP layer encrypts the sector, and the sector goes to the drive. No complex processing, no complex data modeling, no complex code to fail. The PGP layer doesn&#8217;t even need to know what&#8217;s doing, it blindly encrypts and decrypts data on the fly. The OS will know what to do with that data.</li>
</ol>
<p>For these reasons, I believe whole disk encryption is a much better solution than File Vault. I strongly believe Apple should provide this with their Macs right out of the box, but judging by the way the company handles security issues, I don&#8217;t believe that will happen any time soon.</p>
<p><strong>PGP</strong></p>
<p>What can you say when a product that is supposed to do what it does in the background and be totally transparent to the user actually works fine? Well, nothing. That&#8217;s precisely the point &#8211; providing security without being a pain to the user. So far, that&#8217;s my experience with PGP. I really have nothing much to say, except that it works.</p>
<p>I installed PGP, rebooted and typed in my demonstration registration key, valid for 30 days. Then, I read the manual, skipped all the &#8220;please verify your file system consistency before proceeding&#8221; warnings (what could go wrong?), set a password for my MacBook Pro drive, and fired up the encryption. You can use your mac normally while the initial encryption is done, as PGP is smart enough to know what disk sectors are already encrypted and which ones are not, allowing the system to work normally during the whole process. You will probably notice a very high loss of performance during the initial encryption process because the hard drive will be in really heavy usage (after all, PGP has to read and rewrite the entire disk surface).</p>
<p>After that, you won&#8217;t notice a thing. The only signs your mac will show you related to PGP are the small PGP icon on the menu bar, and, of course, the password window before the system boot. You won&#8217;t notice any performance degradation due to the real time encryption, at least I didn&#8217;t. Based on the UNIX &#8220;top&#8221; tool, it appears that PGP doesn&#8217;t use more than 2 or 3 percent of the CPU, which is negligible (remember that we are talking about 100% <em>per CPU</em>, which means that in a modern laptop with a Core 2 Duo processor, PGP is using 3%&#8230; of 200%).</p>
<p>You can create several &#8220;users&#8221; for your hard drive, with different passwords for each one. Please keep in mind this is only a way to avoid sharing the passwords. This is NOT a real accounting feature like in a normal UNIX system, where each user has different permissions and credentials to (supposedly) access only what he should. Here, any password will provide access to the entire drive contents. The normal access permissions will be granted by Mac OS X, of course, but PGP offers no data protection as soon as someone &#8211; whoever it is &#8211; types in a valid password.</p>
<p><strong>Side notes</strong></p>
<p>There are some important things to keep in mind when using PGP to encrypt your drive:</p>
<ul>
<li>PGP asks for the password on system boot, but not on system awake. So, make sure to turn on the system awake password in the System Preferences, or you can allow a burglar to access your data if he stoles your Mac while it&#8217;s sleeping (and at least I always carry my laptop in sleep mode). If you want absolute security, turn off your mac before taking it with you.</li>
<li>Target mode (using your mac as a firewire drive) will work, but the drive contents will not be decrypted on the fly by the machine in target mode itself. You have to install PGP on the host machine so that it&#8217;s able to decrypt the contents of the target disk.</li>
<li>You have to be careful if you need to clone an encrypted drive. The most reliable way to do it is to decrypt it before cloning. If you want to clone an encrypted drive, check <a href="http://forum.pgp.com/pgp/board/message?board.id=48&#038;thread.id=1609&#038;view=by_date_ascending&#038;page=1">this thread in the PGP Forum</a> for more details.</li>
<li>I haven&#8217;t tested this, but from what I recall from the manual, you may install PGP on a machine and use it unlicensed to read the contents of an encrypted drive (assuming you know the password, of course).</li>
<li>BootCamp won&#8217;t work. If you need Windows, you have to run Parallels, VMWare or any other virtual machine software. Those will work fine, providing that the Windows disk image is a file on the OS X file system, and not a dedicated Windows-formatted partition.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://terminalapp.net/pgp-desktop-99-mini-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PGP Desktop 9.9 released</title>
		<link>http://terminalapp.net/pgp-desktop-99-released/</link>
		<comments>http://terminalapp.net/pgp-desktop-99-released/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 23:47:24 +0000</pubDate>
		<dc:creator>Miguel Arroz</dc:creator>
				<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://terminalapp.net/?p=47</guid>
		<description><![CDATA[PGP finally released the 9.9 version of it&#8217;s PGP Desktop product I had mentioned before, featuring full boot-disk encryption for OS X (Intel only). The demo version is not yet available, but I can hardly wait to try it. I &#8230; <a href="http://terminalapp.net/pgp-desktop-99-released/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>PGP finally released the <a href="http://www.pgp.com/products/wholediskencryption/index.html">9.9 version</a> of it&#8217;s PGP Desktop product <a href="http://terminalapp.net/pgp-whole-disk-encryption-for-mac-os-x/">I had mentioned before</a>, featuring full boot-disk encryption for OS X (Intel only). The demo version is not yet available, but I can hardly wait to try it. I hope they handle correctly booting in target mode and verbose or single user mode.</p>
]]></content:encoded>
			<wfw:commentRss>http://terminalapp.net/pgp-desktop-99-released/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PGP Whole Disk Encryption for Mac OS X</title>
		<link>http://terminalapp.net/pgp-whole-disk-encryption-for-mac-os-x/</link>
		<comments>http://terminalapp.net/pgp-whole-disk-encryption-for-mac-os-x/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 17:07:49 +0000</pubDate>
		<dc:creator>Miguel Arroz</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[full disk encryption]]></category>
		<category><![CDATA[pgp]]></category>

		<guid isPermaLink="false">http://terminalapp.net/?p=40</guid>
		<description><![CDATA[PGP is about to release a new version of it&#8217;s PGP Whole Disk Encryption product. This version will fully support the Mac, including the boot disk. I&#8217;m looking for a full disk encryption system for a long time now, as &#8230; <a href="http://terminalapp.net/pgp-whole-disk-encryption-for-mac-os-x/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.pgp.com">PGP</a> is about to release a new version of it&#8217;s <a href="http://www.pgp.com/mac">PGP Whole Disk Encryption</a> product. This version will fully support the Mac, including the boot disk. I&#8217;m looking for a full disk encryption system for a long time now, as it&#8217;s a really nice solution in a world where the number of stolen laptops keeps increasing. This won&#8217;t help at all recovering a stolen Mac, but at least gives you peace of mind about the data in your stolen computer drive. The drive contents will appear as random data for anyone who doesn&#8217;t own the PGP password, so you know that, despite having to buy another laptop, your data won&#8217;t be seen by anyone else. As we carry more and more vital data inside our laptops (not just the data itself, but also passwords and ssh keys that allow access to servers with even more important data), protecting all that stuff in case of theft of loss is becoming more important every day.</p>
<p>I hope they release a demo version, as I would like to know how the system reacts when awaking the machine from sleep and using target mode. Until then, you can <a href="http://www.pgp.com/mac">register yourself</a> at the PGP site to be notified on the release date.</p>
]]></content:encoded>
			<wfw:commentRss>http://terminalapp.net/pgp-whole-disk-encryption-for-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Back from USA</title>
		<link>http://terminalapp.net/back-from-usa/</link>
		<comments>http://terminalapp.net/back-from-usa/#comments</comments>
		<pubDate>Sun, 15 Jun 2008 23:01:07 +0000</pubDate>
		<dc:creator>Miguel Arroz</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[WebObjects]]></category>
		<category><![CDATA[WOWODC WWDC 2008 WebObjects LEWOStuff Houdah Stanford]]></category>

		<guid isPermaLink="false">http://terminalapp.net/?p=39</guid>
		<description><![CDATA[Well, I&#8217;m back from another WOWODC and WWDC. I&#8217;m still really tired, but some quick notes: As David LeBer already mentioned, Pascal did an amazing job organizing WOWODC all by himself. Great room (a bit cold on the first day &#8230; <a href="http://terminalapp.net/back-from-usa/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Well, I&#8217;m back from another WOWODC and WWDC. I&#8217;m still really tired, but some quick notes:</p>
<ul>
<li>As <a href="http://davidleber.net/?p=319">David LeBer already mentioned</a>, Pascal did an amazing job organizing <a href="http://www.wocommunity.org/wowodc08/">WOWODC</a> all by himself. Great room (a bit cold on the first day ;) ), large windows and sunlight on the halls. Food (well&#8230; not that good, but after all, it&#8217;s USA!) and caffeine provided frequently. Very very nice. Suggestion for the next year: a bigger (and brighter) screen, and eventually plasma screens among the room to make it easy for people in the back to read the code.</li>
<li>I learned a lot about WO frameworks out there (like <a href="http://projectwonder.blogspot.com/">Wonder</a>, <a href="http://code.google.com/p/houdah-webobjects-frameworks/">Houdah</a> and specially <a href="http://homepage.mac.com/andrewlindesay/le/page_lestuff.html">LEWOStuff</a> that I did not know before). I met for the first time some very talented people, and of course, all the folks from the previous conferences. It&#8217;s great to be able to have technical discussions and know different views on the same problems from all those skilled and experienced people out there, face to face.</li>
<li><a href="http://developer.apple.com/wwdc/">WWDC</a> had some interesting news on many stuff. As you know, I cannot talk about the stuff under NDA, so I shall only say that some interesting stuff is being done on the WO side. Also, as you all know by now, the <a href="http://www.apple.com/iphone/">iPhone is now 3G</a>, includes a GPS, the price was slashed, and will be available in many countries of the world. I just hope the service providers slash the data roaming prices, because that makes the iPhone useless when you go to foreign countries. Finally, <a href="http://www.apple.com/macosx/snowleopard/">Snow Leopard</a> was announced, and, as already expected, the focus is not on new features, but on a big cleanup of the OS infrastructure. Not only this are great news for us, developers, but also shows some courage from Apple and a lot of respect for their users. They want to focus the next year on improving the quality of their OS, rather than packing it up with some new features just to win the race against the competition.</li>
<li>As a side note, the <a href="http://www.mactech.com/">MacTech</a> people was giving away some magazines for free to the people who were <a href="http://www.flickr.com/photos/velouriadark/2571799198/">standing</a> <a href="http://www.flickr.com/photos/velouriadark/2570973867/">in line</a> <a href="http://www.flickr.com/photos/velouriadark/2571799478/">during the morning</a>. I took the time to read most of it during my flight, and I really liked it. I was a MacTech subscriber in the past, but I cancelled it because, during my graduation, I didn&#8217;t have time to read it (it&#8217;s good to graduate on a place where you actually don&#8217;t have time to learn, isn&#8217;t it?). Maybe I&#8217;ll subscribe it again now.</li>
<li>Not related to the conferences themselves, we went to visit the bay area surroundings on Friday afternoon. We did the classic trip to the Apple and Google campuses, because we are all geeks, but we also went to the Stanford and Berkeley campuses. The Standford campus totally blow me away. You have to see it to believe it. From now on, I&#8217;ll laugh, really laugh, every time I hear a faculty from my university stating that we actually have a campus. The Berkeley campus did not impress me much. It&#8217;s more urban style, more crowded and dense. I prefer the Stanford way, with space, a huge amount of space, tons and tons of space, really. Almost made me want to return to the univ! :)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://terminalapp.net/back-from-usa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accessing Mac virtual hosts from a Parallels VM</title>
		<link>http://terminalapp.net/accessing-mac-virtual-hosts-from-a-parallels-vm/</link>
		<comments>http://terminalapp.net/accessing-mac-virtual-hosts-from-a-parallels-vm/#comments</comments>
		<pubDate>Sun, 30 Mar 2008 23:26:05 +0000</pubDate>
		<dc:creator>Miguel Arroz</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://terminalapp.net/accessing-mac-virtual-hosts-from-a-parallels-vm/</guid>
		<description><![CDATA[I finally moved to an Intel machine. Despite the dramatic speed improvement in everything Java-related, namely Eclipse, there&#8217;s another big advantage: being able to run IE on Windows using a virtual machine. Unfortunately, that&#8217;s something every web developer must do &#8230; <a href="http://terminalapp.net/accessing-mac-virtual-hosts-from-a-parallels-vm/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I finally moved to an Intel machine. Despite the dramatic speed improvement in everything Java-related, namely Eclipse, there&#8217;s another big advantage: being able to run IE on Windows using a virtual machine. Unfortunately, that&#8217;s something every web developer must do to ensure his or her application will work on the most used (and crappy) browser on earth.</p>
<p>I installed Parallels and created two virtual machines, one for IE 6 and another one for IE 7. This way I&#8217;m sure there are no weird problems between those two versions (having more than an IE version on Windows can only be accomplished by hacks, and hacks are bad). Also I can install Visual Web Developer Express Edition on each of the VMs, and use either IE 6 or 7 to debug.</p>
<p>My apps run inside virtual hosts on Mac OS X apache, under a fake DNS name. On Mac OS X it&#8217;s easy to add the DNS entry to the /etc/hosts file, under the 127.0.0.1 entry. This way, your DNS name will always point to your mac, and you&#8217;ll be able to reach your virtual host.</p>
<p>I wanted to do the same from inside Windows running on Parallels. An easy way would be to edit the Windows hosts file, adding the Mac OS X public IP to the file. But that will only work if the OS X IP doesn&#8217;t change. My Intel mac is an MBP, and I change the network I use often, so I needed a little more flexibility. So, this is the way I found to do this:</p>
<ol>
<li>Configure your VM to use Shared Networking. This wall, Parallels extensions installed on your Mac will create a NAT network where your virtual machine will be hooked into.<br/><br />
<a href='http://terminalapp.net/wp-content/uploads/2008/03/parallels.png' title='Paralleles Configuration Screen'><img src='http://terminalapp.net/wp-content/uploads/2008/03/parallels.thumbnail.png' alt='Paralleles Configuration Screen' /></a></li>
<li>Open Mac System Preferences, and look for the &#8220;Parallels NAT&#8221; network port. This is an interesting one, because it allows the Mac itself to be connected to the virtual NAT network, using an IP on the NAT subnet. Write down that IP: this will be the IP you&#8217;ll use to access the Mac virtual hosts from within the virtual machines.<br/><br />
<a href='http://terminalapp.net/wp-content/uploads/2008/03/systempreferences.png' title='System Preferences'><img src='http://terminalapp.net/wp-content/uploads/2008/03/systempreferences.thumbnail.png' alt='System Preferences' /></a></li>
<li>Finally, edit Windows hosts file. This file is located on \WINDOWS\system32\drivers\etc\hosts. Add a line with the IP (in my case, 10.211.55.2) and the name of the virtual host, just like you do on the Mac.<br/><br />
<a href='http://terminalapp.net/wp-content/uploads/2008/03/notepad.png' title='Windows hosts file'><img src='http://terminalapp.net/wp-content/uploads/2008/03/notepad.thumbnail.png' alt='Windows hosts file' /></a></li>
</ol>
<p>That&#8217;s it. Now you can access your Mac virtual hosts from Windows, whatever the Mac IP is. Ick, what&#8217;s a Windows screenshot doing in my blog!?</p>
]]></content:encoded>
			<wfw:commentRss>http://terminalapp.net/accessing-mac-virtual-hosts-from-a-parallels-vm/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>drawImage performance on Leopard</title>
		<link>http://terminalapp.net/drawimage-performance-on-leopard/</link>
		<comments>http://terminalapp.net/drawimage-performance-on-leopard/#comments</comments>
		<pubDate>Wed, 27 Feb 2008 16:54:31 +0000</pubDate>
		<dc:creator>Miguel Arroz</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[WebObjects]]></category>

		<guid isPermaLink="false">http://terminalapp.net/drawimage-performance-on-leopard/</guid>
		<description><![CDATA[A not very fast but handy way to downscale images in a WebObjects application is using Java 2D APIs, with code like this: BufferedImage reducedImage = new BufferedImage(newX, newY, BufferedImage.TYPE_INT_RGB); Graphics2D g = reducedImage.createGraphics(); g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED); &#8230; <a href="http://terminalapp.net/drawimage-performance-on-leopard/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A not very fast but handy way to downscale images in a WebObjects application is using Java 2D APIs, with code like this:</p>
<p><code><br />
BufferedImage reducedImage = new BufferedImage(newX, newY, BufferedImage.TYPE_INT_RGB);<br />
Graphics2D g = reducedImage.createGraphics();<br />
g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);<br />
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);<br />
g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);</p>
<p>g.drawImage(originalImage, 0, 0, newX, newY, 0, 0, originalImage.getWidth(), originalImage.getHeight(), null);<br />
g.dispose();<br />
</code></p>
<p>Although not blazing fast, this is enough for many applications. I could reduce a 7 Mega-Pixels image to something like 250 pixels wide in about one second, or less, in my PowerBook G4. But this was in Tiger.</p>
<p>In Leopard, as some of you may have noticed (and if you have applications deployed on Leopard Server, be aware) this is incredibly slow. When I say slow, I say five minutes, or even more, with the CPU being used at 100% during that time.</p>
<p>There are two reasons that lead to this. The first (which is not a problem in itself, but it&#8217;s a cause of the problem): Apple switched from Quartz to Sun2D graphics engine as the default one for Java applications on Leopard. So, all your image manipulation is being done using the Sun pipeline now. This would not be a problem, except for the second reason: <del datetime="2008-03-18T17:58:17+00:00">the Apple JVM implementation has a bug that is slowing Sun&#8217;s pipeline drawImage method to a crawl</del>. Actually, that was not the real reason. I testes this on FreeBSD (using Diablo JDK) and the speed was similar to Leopard&#8217;s. Sun2D is REALLY slow, to the point of being useless. I&#8217;m now using ImageMagick.</p>
<p>The only solution for now is forcing the application to use Quartz engine. You can do that using the command line option -Dapple.awt.graphics.UseQuartz=true. And, of course, <a href="http://bugreporter.apple.com">file a bug</a> on this!</p>
]]></content:encoded>
			<wfw:commentRss>http://terminalapp.net/drawimage-performance-on-leopard/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Leopard tech talk, Lisbon</title>
		<link>http://terminalapp.net/leopard-tech-talk-lisbon/</link>
		<comments>http://terminalapp.net/leopard-tech-talk-lisbon/#comments</comments>
		<pubDate>Tue, 04 Dec 2007 17:51:02 +0000</pubDate>
		<dc:creator>Miguel Arroz</dc:creator>
				<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://terminalapp.net/leopard-tech-talk-lisbon/</guid>
		<description><![CDATA[Yesterday I spent all day in the first ever Apple developer event in Portugal. Apple carried out a Leopard Tech Talk in Lisbon, where portuguese developers could learn about some of the new stuff in Leopard, including 64 bit programming and Core &#8230; <a href="http://terminalapp.net/leopard-tech-talk-lisbon/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Yesterday I spent all day in the first ever Apple developer event in Portugal. Apple carried out a <a href="http://developer.apple.com/events/techtalks/europe.html">Leopard Tech Talk</a> in Lisbon, where portuguese developers could learn about some of the new stuff in Leopard, including 64 bit programming and Core Animation. The speakers were splendid, and with great technical knowledge about what they were talking about. It&#8217;s always great to watch a technical presentation made by real coders, and not by the full-of-bullshit marketing people.</p>
<p>Some presentations were very superficial, but the most interesting ones went as deep as some of the WWDC sessions I attended. The event was actually a micro-WWDC, and even included a nice buffet with plenty of food for lunch and coffe-breaks, all for free. As I spend almost all the WWDC week on the IT track, it was cool to learn about the desktop stuff Apple is working on.</p>
<p>The room was packed, and people were motivated and participative. The Apple guys really liked that, as they say those are the main factors they use to evaluate how successful and event it, specially when going to a new country for the first time. I know I&#8217;ll be there next time!</p>
]]></content:encoded>
			<wfw:commentRss>http://terminalapp.net/leopard-tech-talk-lisbon/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Testing memory</title>
		<link>http://terminalapp.net/testing-memory/</link>
		<comments>http://terminalapp.net/testing-memory/#comments</comments>
		<pubDate>Sun, 12 Aug 2007 18:47:56 +0000</pubDate>
		<dc:creator>Miguel Arroz</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Mac OS X Server]]></category>
		<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://terminalapp.net/testing-memory/</guid>
		<description><![CDATA[I wrote some days ago about badblocks for testing a hard drive surface. Now, the same for memory. As I said, I bought a second-hand PowerMac G5 to replace my old G4. When I got the new machine, I run &#8230; <a href="http://terminalapp.net/testing-memory/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://terminalapp.net/bad-blocks-badblocks/">I wrote some days ago about badblocks</a> for testing a hard drive surface. Now, the same for memory.</p>
<p>As I said, I bought a second-hand PowerMac G5 to replace my old G4. When I got the new machine, I run Apple Hardware Test (AHT), using the Extended Test. AHT tested my hardware, including the 2.5 GB of RAM, taking more than two hours (and making a hell of a noise, because during tests, the G5 ventilation system works in failsafe mode, which means, full power). Everything seemed to be fine. Until I installed <a href="http://www.emcinsignia.com">Retrospect</a>. I use Retrospect to make all my backups at home, and despite all it&#8217;s quirks, it always worked fine on the G4. Since I installed it on the G5, I got strange errors (the famous &#8220;internal consistentcy check&#8221;) and even crashes.</p>
<p>After nailing down all the possibilities (trashing preferences and existing backup sets, reinstalling Retrospect, etc) I suspected it could be an hardware problem, because I was told that the &#8220;internal consistentcy check&#8221; appears when the backup set contents are corrupted. So, I thought, my hard drive is corrupting data. I duplicated one backup set with about 80 GB, and surprise &#8211; after duplicating and running an md5 checksum on it (and diff), the files were different! This was NOT supposed to happen, naturally. So I tried the same thing on my boot drive &#8211; same problem. Ops&#8230; it&#8217;s not the drives. So, if it&#8217;s not the drives, and supposing (more exactly, <em>praying</em>) that it was not a motherboard issue, it must be the memory.</p>
<p>All my collegues at IST System Adminstration team use <a href="http://www.memtest.org/">memtest</a> on PCs to test the memory. This great distribution of memtest has a really nice touch: you can burn this on a CD, and boot the PC from it. It takes less that 200K of RAM, so all the other memory will be tested. Unfortunately, it&#8217;s not possible to boot it in Macs (not even Intel Macs &#8211; I tried it!). So, you must get the Mac OS X version of memtest, and boot the OS in Single User mode (using command-S during the boot sequence). The OS will take about 50 MB of RAM, which is, of course, much worse than the 200K used by the PC version, because those 50 MB will simply not be tested. But it&#8217;s better than nothing.</p>
<p>The official site for the Mac OS X version of memtest is <a href="http://www.memtestosx.org/">here</a>, but unfortunately, the author requires you to pay a small ammount for the download. I don&#8217;t like the approach very much because I don&#8217;t really know what I&#8217;m buying. the author says that, after paying, he sends a password for the encrypted DMG you downloaded. But I cannot download without paying, because the link is no-where. So&#8230; what happens when a new version comes out? Do I have to pay it again? Well, anyway, someone else is distributing memtest for OS X for free. Yes, it&#8217;s legal, because the software is under GNU license. So, if you don&#8217;t want to pay, just click <a href="http://www.deepthought.org/~dcooper/memtest-414.zip">here</a> and grap your own free copy. Happy testing!</p>
<p>By the way, some tests take a lot of time. Let all of them run. Don&#8217;t assume the fact that all the &#8220;quick&#8221; tests passed means your memory is OK. Some problems may only be found with the more complex and slower tests &#8211; that&#8217;s why they are there. So, let it run. And if you have a G5, get the hell out of there, or use ear-plugs. It won&#8217;t be a nice office to work during testing, trust me.</p>
<p>memtest will detetct lots of common problems in memories, and will probably identify more than 99% of the defective memory modules arround. But never forget: it&#8217;s impossible to be entirely sure that a memory module is OK, simply because it&#8217;s not possible, in a reasonable time frame, to test all the possible combinations of data. Also, memory may pass all the tests in a day, and fail the next day. There are many factors that may trigger a hidden problem in memory modules: temperature, electrical flutuations, the data it contains, age, etc. If you suspect you have a bad memory module, and if you have time, run memtest for several days in a row, using the option to do many passes.</p>
]]></content:encoded>
			<wfw:commentRss>http://terminalapp.net/testing-memory/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Mac-compatible ethernet card</title>
		<link>http://terminalapp.net/mac-compatible-ethernet-card/</link>
		<comments>http://terminalapp.net/mac-compatible-ethernet-card/#comments</comments>
		<pubDate>Fri, 03 Aug 2007 15:57:50 +0000</pubDate>
		<dc:creator>Miguel Arroz</dc:creator>
				<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://terminalapp.net/mac-compatible-ethernet-card/</guid>
		<description><![CDATA[For those of you who need an ethernet card that works with Mac OS X, this may be a useful tip: Mac OS X has a built-in driver for the RealTek RTL8139 chip. I looked arround and found this Netgear &#8230; <a href="http://terminalapp.net/mac-compatible-ethernet-card/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For those of you who need an ethernet card that works with Mac OS X, this may be a useful tip: Mac OS X has a built-in driver for the RealTek RTL8139 chip. I looked arround and found <a href="http://www.netgear.com/Products/Adapters/WiredAdapters/FA311.aspx">this Netgear card</a>, based on that chip. It&#8217;s not Gigabit, but I wanted it to connect my &#8220;new&#8221; PowerMac G5 to the ADSL modem, so 100 Mbps is fine. It&#8217;s not PCI-X, but it complies to the PCI 2.x specification, which means it will work on the G5 PCI-X slots (although the entire PCI bus will work at PCI speed, not PCI-X). It&#8217;s cheap, it works, and I can have the G5 doing all the NAT routing stuff, as I like.</p>
]]></content:encoded>
			<wfw:commentRss>http://terminalapp.net/mac-compatible-ethernet-card/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bad blocks? badblocks!</title>
		<link>http://terminalapp.net/bad-blocks-badblocks/</link>
		<comments>http://terminalapp.net/bad-blocks-badblocks/#comments</comments>
		<pubDate>Mon, 16 Jul 2007 10:36:50 +0000</pubDate>
		<dc:creator>Miguel Arroz</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://terminalapp.net/bad-blocks-badblocks/</guid>
		<description><![CDATA[There are not many things I miss from Mac OS 9. But there&#8217;s one that was really useful: the ability to test a hard drive surface. OS 9 disk formatter (I don&#8217;t even recall it&#8217;s name) had a &#8220;Test Disk&#8221; &#8230; <a href="http://terminalapp.net/bad-blocks-badblocks/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>There are not many things I miss from Mac OS 9. But there&#8217;s one that was really useful: the ability to test a hard drive surface. OS 9 disk formatter (I don&#8217;t even recall it&#8217;s name) had a &#8220;Test Disk&#8221; option that would perform a surface scan of the selected hard drive. That was awsome to test for bad blocks on the drives.</p>
<p>Unfortunately, that&#8217;s impossible to do with Mac OS X, at least with it&#8217;s built-in software. There are some commerical applications to do that (like <a href="http://www.micromat.com/index.php?option=content&#038;task=view&#038;id=31">TechTool Pro</a>), but I get a little pissed off when I have to spend a lot of money buying a software that does a zillion things when all I want is surface scans, and specially when I could do it with the &#8220;old&#8221; OS and not with the new powerful UNIX-based one.</p>
<p>Well, Linux has the badblocks command that will do just that: test the disk surface for bad blocks. It&#8217;s a simple UNIX command, so I thought there must be a port of that to OS X (and, of course, I could try to compile it in OS X as last resource). After some googling, I found out badblocks is part of the <a href="http://e2fsprogs.sourceforge.net/ext2.html">ext2fs</a> tools. And, fortunately, Brian Bergstrand has already done the <a href="http://sourceforge.net/projects/ext2fsx">port to OS X,</a> including a nice installer.</p>
<p>The installer installs all the ext2fs stuff, including an extension that will allow you to access ext2fs volumes on OS X. As always, this is a somewhat risky operation. Personally, I avoid as many extensions as I can, because they run too close to the kernel for me to feel confortable. So, if possible, install it on a secondary OS (like an utility/recover system on an exteral hard drive, or so).</p>
<p>The badblocks command will be installed in /usr/local/sbin/badblocks, and it will probably not be on your PATH, so you have to type the entire path when using, or edit your PATH environment variable.</p>
<p>Usage is simple. First, run the &#8220;mount&#8221; command, so that you know the device names for the drives you want to test. You can obtain something like this:</p>
<p><code>arroz% mount<br />
/dev/disk0s3 on / (local, journaled)<br />
devfs on /dev (local)<br />
fdesc on /dev (union)<br />
<volfs> on /.vol<br />
automount -nsl [142] on /Network (automounted)<br />
automount -fstab [168] on /automount/Servers (automounted)<br />
automount -static [168] on /automount/static (automounted)<br />
</code></p>
<p>The internal hard drive is /dev/disk0 (note that /dev/disk0 is the entire drive, /dev/disk0s3 is a single partition). Imagining you want to test the internal hard drive you would type the command (as root):</p>
<p><code>badblocks -v /dev/disk0</code></p>
<p>This would start a read-only test on the entire volume. The -v is the typical verbose setting, so you may follow what&#8217;s happening. This will take a long time, depending on the hard drive you use. For a 160 GB hard drive, it took between 2 and 3 hours in a G5 Dual 2 Ghz.</p>
<p>I mention this because time is an important factor when testing hard drives! You should run badblocks on a known-to-be-in-good-condition hard drive, so that you can get the feeling of how fast (or slow) badblocks is. Later, if you test a possibly failing hard drive, and badblocks progresses notably slower, it will probably mean that the hard drive is in bad condition (even if it doesn&#8217;t have badblocks).</p>
<p>After running the command, you may get two results: your disk has, or hasn&#8217;t badblocks! :) You will see many outputs of a successful surface scan, so I leave here an example of a not-so-successful one:</p>
<p><code>/usr/local/sbin arroz$ sudo ./badblocks -v /dev/disk0<br />
Password:<br />
Checking blocks 0 to 156290904<br />
Checking for bad blocks (read-only test): 120761344/156290904<br />
120762872/156290904<br />
120762874/156290904<br />
done<br />
Pass completed, 3 bad blocks found.<br />
</code></p>
<p>This is the result of a test on a 160 GB hard drive with 3 bad blocks.</p>
<p>After getting something like this, you may try to run badblocks again, in write mode. <strong>Note that this will destroy all the information you have on the hard drive!</strong> badblocks won&#8217;t copy the information to memory, and than back to disk. It simple destroys it. The point of running a write-enabled badblocks check is forcing the hard drive to remap the damaged sectors. Hard drives have a reserved space to use when bad blocks are found. The bad blocks are remapped to that reserved space, until it fills. And this will only happen on a write. So, run badblocks in write mode, and then again in read-only mode. If badblocks finds no bad blocks, your hard drive is fine (for now). If badblocks still finds bad blocks, it means that there are so many damaged blocks on the disk surface that the reserved area is full. Forget it, and throw the disk away. It&#8217;s useless.</p>
]]></content:encoded>
			<wfw:commentRss>http://terminalapp.net/bad-blocks-badblocks/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Backups, rsync, and &#8211;link-dest not working</title>
		<link>http://terminalapp.net/backups-rsync-and-link-dest-not-working/</link>
		<comments>http://terminalapp.net/backups-rsync-and-link-dest-not-working/#comments</comments>
		<pubDate>Sun, 20 May 2007 17:42:40 +0000</pubDate>
		<dc:creator>Miguel Arroz</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Mac OS X Server]]></category>
		<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://terminalapp.net/backups-rsync-and-link-dest-not-working/</guid>
		<description><![CDATA[I use Retrospect to backup most of the machines at GAEL. You may wonder why do I use a commercial tool that still shows it&#8217;s OS 9 roots, instead of open source alternatives. Well, Retrospect has some cool advantages (namely &#8230; <a href="http://terminalapp.net/backups-rsync-and-link-dest-not-working/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I use <a href="http://www.emcinsignia.com/products/smb/retroformac/">Retrospect</a> to backup most of the machines at <a href="http://gael.ist.utl.pt">GAEL</a>. You may wonder why do I use a commercial tool that still shows it&#8217;s OS 9 roots, instead of open source alternatives. Well, Retrospect has some cool advantages (namely the very good support of laptops that may be disconnected abruptely from the network while a backup is in progress). Also, when I first did this setup, <a href="http://www.amanda.org/">Amanda</a> and other tools did not work reliably with Mac OS X file format.</p>
<p>While this works to backup all the desktop workstations and laptops of GAEL members, I have a problem with our <a href="http://www.apple.com/xserve/">xServe</a>. It runs Mac OS X Server, and Retrospect will not backup machines with the Server version of Mac OS X with the license we have. To do that, we would have to buy a much more expensive license.</p>
<p>No problem. A server, due to it&#8217;s nature, doesn&#8217;t have the &#8220;sudden disappearing&#8221; problem of the laptops, so I can use a &#8220;classic&#8221; UNIX approach &#8211; and my choice was rsync and the &#8211;link-dest option. You may read about this option in the <a href="http://samba.anu.edu.au/ftp/rsync/rsync.html">rsync manpage</a>, but in case you don&#8217;t know, what it does is the following: instead of synchronizing a directory in the usual way, it will create a new directory with a new file tree. But, to save space, it won&#8217;t copy the non-updated files from the old tree to the new one. Instead, it creates hard links, so that both entries in the file system point to the same data on the hard drive (to the same inode), thus saving space. So, everytime you update your backup, you will create a new tree, but you will only waste the space required by the files that were updated since the last backup, and some more space for the filesystem structures that support the directory tree. You can use a command like this:</p>
<p><code><br />
// rotate old dirs<br />
rm -rf /Volumes/Storage/test/test.5<br />
mv /Volumes/Storage/test/test.4 /Volumes/Storage/test/test.5<br />
mv /Volumes/Storage/test/test.3 /Volumes/Storage/test/test.4<br />
mv /Volumes/Storage/test/test.2 /Volumes/Storage/test/test.3<br />
mv /Volumes/Storage/test/test.1 /Volumes/Storage/test/test.2<br />
mv /Volumes/Storage/test/test.0 /Volumes/Storage/test/test.1</p>
<p>/usr/bin/rsync --rsync-path=/usr/bin/rsync -az -E -e ssh --exclude=/dev/\* --exclude=/private/tmp/\* --exclude=/Network/\* --exclude=/Volumes/\* --exclude=/private/var/run/\* --exclude=/afs/\* --exclude=/automount/\* --exclude=/.Spotlight-V100/\* --link-dest="/Volumes/Storage/test/test.1" "root@my.machine.com:/Users/arroz/TestDirectory" "/Volumes/Storage/test/test.0/"<br />
</code></p>
<p><em>Side note: the -E option (capital E) is an option present on Mac OS X rsync version, that forces rsync to copy all the extended Mac file system attributes, including <a href="http://en.wikipedia.org/wiki/Resource_fork">resource forks</a>. It only exists in Mac OS X 10.4 (Tiger) or newer versions. If you are still using 10.3 (Panther) or older, use <a href="http://archive.macosxlabs.org/rsyncx/rsyncx.html">rsyncx</a>. Do not use rsyncx with Tiger.</em></p>
<p>Until about a week ago, my backup machine (an old PowerMac G4) had an external SCSI Raid with 640 GB, and an internal RAID 0 (2 * 80 GB drives), besides the boot disk. All the Retrospect backups were being placed on the external RAID, and the server backups were going to the internal RAID 0. Now, I know it&#8217;s living on the edge to backup to a RAID 0. But there was really no more space, and it was a temporary situation, because the new drives for the external RAID were already ordered.</p>
<p>When the new drives arrived, I stored all the backups where I could for some days (640 GB was <em>huge</em> when we purchased the RAID, but today is relatively managable), switched the drives and created a new fresh RAID 5. Formatted it in the HFS+ file system, and copied back all the backups, including the server backups and finally trashed the internal RAID 0.</p>
<p>Some path adjustements on my server backup scripts, and we are back in business. But the RAID free space was getting dramatically shorter every day. I used the &#8216;ls -i&#8217; command to compare the inodes of files that were supposed to be unchanged from the backup of a day to the other in the next day, and as I suspected, rsync was duplicating all the files, instead of hard-linking them.</p>
<p>After Googling a lot, I could not find answers for this. I tried to see if &#8216;cp -la&#8217; would successfully create hard links, but to my surprise, I found out that the Mac OS X built-in &#8216;cp&#8217; command would not support the &#8220;l&#8221; option. Nice. Before installing the GNU &#8216;cp&#8217; version (and because I&#8217;m lazy and I didn&#8217;t want to do that) I started thinking about everything I had done since the new drives arrived. The OS was the same, the rsync command was the same, it worked before, so it <em>had</em> to work now. The only reason why it could be not working was because rsync, somehow, thought that all the files were changing, even when they did not.</p>
<p>Suddenly, the solution poped up in my head. Mac OS X has an option, associated to every HFS+ volume, called &#8220;Ignore ownership on this volume&#8221;. This is turned off by default on the boot drive, but <strong>it&#8217;s turned on by default</strong> on all the external drives you format. There&#8217;s a good reason for this: Mac OS X is a consumer product. And average users want to buy an external drive, store data on it, bring it to another Mac, and read their data. They don&#8217;t care if their UID is the same on both machines or not.</p>
<p>But this causes serious problems to rsync. Althought the file system will store the owner of the files, it probably won&#8217;t report it to the applications who try to read it (or will mask them to the user who&#8217;s trying to access them). Somewhere this information is filtered, between the file system and application layers. So, rsync was not getting the real UID of the files. As the files that came from the server had real UIDs, both UIDs wouldn&#8217;t match, and rsync would create a new copy because, from it&#8217;s point of view, the file had been changed.</p>
<p>The solution was simple &#8211; just going to the machine console, and &#8220;Get Info&#8221; of the external volume. I turned off the &#8220;Ignore ownership on this volume&#8221; setting, and rsync started operating normally again.</p>
]]></content:encoded>
			<wfw:commentRss>http://terminalapp.net/backups-rsync-and-link-dest-not-working/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>
