Thursday, August 23, 2012

Death of a Time Capsule Part 3 - Rescuing the Data from the TC Disk

This is the third post of a blog about my experiences with replacing an Apple Time Capsule with a Synology Disk Station DS212j. In the previous post I wrote about the first steps of setting up the DS212j, which ended by finding that all data is deleted from the hard disk(s) being installed in the DS - something that was catastrophic for me as some valuable data was on the disk not backed up yet.

What Options Were Available to Save the Data on the former Time Capsule Disk?

First of all a summary of the hardware available for the operation:

  • The 1 TB Western Digital hard disk I recovered from the Time Capsule (see my first post of this series).
  • 1 old Dell PC running under Windows XP. I used this PC to check if the Time Capsule Disk was still alive.
  • 1 USB 1 TB disk which I used to do backups of data on the time capsule. The disk was formatted in Mac OS Extended format.
From my experiences with doing a health check of the Time Capsule SATA disk I knew it could be connected to the Dell PC. Fortunately, the PC had 2 physical hard disks inside which I partitioned in a way that the system and the programs reside on two partitions on the first disk, the second hard disk hosted one larger volume for data.  By this partitioning the Windows system was able to boot, even with the "DATA" disk replaced by the old Time Caplsule disk.

Reading Mac Formatted Hard Disks under Windows XP

The first step was made: the TC disk was physically running in my old Dell PC. Unfortunately, this disk was formatted in a Mac Format (didn't check exactly which) which cannot be read easily under Windows.
Some research in the web led me the the Windows utility "MacDrive" which is available under www.mediafour.com. It can be downloaded as 30-day evaluation version, which is free of charge. I downloaded the program, installed it and after a reboot the Mac formatted disk was available in the Windows explorer :)))) I connected as well the USB-disk (as well Mac formatted) which was available in the explorer as well.
However, the copying of data from the TC disk to the USB drive went not so smooth. It was not possible to simply copy the root folder of the TC disk to the USB drive, because in some cases Windows choked on some path names which were too long. I didn't manage to create a compressed data file from the TC data, as I didn't find a compression program being able to manage roughly 350 GB of data.
In the end I simply copied those folders where I knew that new data since the last backup was in. ...Not very convenient, but the only option I had.

In the End - Happy End

After all, I managed to recue all the data important to me on the USB disk. What saved my in the end was an old Windows PC and the program MacDrive. As I used it only for two days, this very important  tool even didn't cost me anything. Finally, the former Time Capsule disk was ready to be re-used in the newly purchased empty Synology DS212j case.

I will write another post about my experiences with the DiskStation up and running.

Death of a Time Capsule Part 2 - Setting up a Synology DS212j

A couple of days ago, I blogged about our Apple Time Time Capsule, which ended its service unexpectedly. As discussed there, I decided to replace the Time Capsule with a combination of an Apple Airport Express in combination with a Synology Disk Station DS212j where I wanted to re-animate the Time Capsule's hard disk which I recovered. Here I want to talk about my experience with the device.

DS212j - What is in the Box?

I ordered the DS212j case without hard disk via Amazon and it arrived after three days at my home.  The box contains:
  • the disk case
  • a power supply with cable
  • a network cable
  • a set of screws to fix the disk(s) in the case
  • a "first steps" user manual
  • a CD with documentation and utility programs


Everything seems to be quite solid and of good quality. The case is equipped with some  electronics and a big fan for cooling te disks.

Mounting the disk

The mechanical mounting of the disk is very simple and does not represent any challenges. Simply slide the disk in one of the foreseen slots. In the DS212j there are two of them:



Fix the disk in the frame with the screws coming with the case. On the picture below I mounted the disk in slot 2:



Close the cover of the case and connect the device with power and to the network - in my case the Apple Airport Express.

Setting Up - Not Only Simple...

Quite excited I fired up the assembled box. The DS212j starts with flickering control lamps and after about a second, it signals with a beep that it is ready for the next steps.
The first step after the DS has been started, is to start the step assistant program which comes together with the remaining equipment. Alternatively one can download the latest version of the setup program from synology.com. What you see after the program start is the following screen (please excuse the German screens):

The first thing that made me suspicious was the term "Not Installed" for my newly assembled Disk Station. The next step is to double click either on the line with the Synology server or to mark the line  of the server you want to administer and click on the "install" button in the menu on top of the window. The next window ended my dreams of keeping the data on the old Time Capsule disk:

The message on the screen told me that ALL THE DATA ON THE DISK WOULD BE ERASED during the installation process :(
What next? For me it was important to save the data which piled up in the timeframe since my last backup. Especially pictures of our last holiday were among the things I definitely did not want to get lost.

Please read my next blog post to learn how to master this kind of crisis.

Sunday, August 19, 2012

Death of a Time Capsule Part 1 - Recovering the Hard Disk

Yesterday, our Apple Time Capsule (1TB) died after 4 years of service a silent and unexpected death. Besides a faint flash of the status lights of the ethernet connectors, it did not give any signal of life any more - all lights dark and the disk not starting any more. This event gave rise to a couple of thoughts:

1) What caused the failure?


Unfortunately I cannot exactly tell, as I do not have the equipment at home to do test. But from the behavior of the device I would fingerpoint to the power supply, which seems to have given up. I betted on thermal problems, which would be in line with the comments given on timecapsuledead.org.

2) What hard disk is hidden inside a Time Capsule?


There are a couple of blogs about the disks Apple uses for its TCs, most musing about the 'server grade' disks supposed to be found inside. I wanted to open the TC myself to check what is inside, and furthermore I wanted to get the hard disk out as I assumed that this was not broken and could be reused, and all my family's photos, videos, music and data is on there (YES: I do have a backup, but still...).
So I followed the description given on applefritter.com, and opened the thing.
What I found - not very unexpected - was a 1 TB Western Digital Caviar Black (WD1001FALS) SATA disk:



3) Did the Disk Survive?


As I mentioned before, my hope was that the disk was still functional and I could reuse it somewhere somehow. To check the disk I opened my goog old Dell PC which has 2 SATA disks. I unconnected one of these and connected the disk from the TC to the PC's controller.
Next I fired up the computer and started the BIOS menu (you have to hit one of the F-keys, don't remember which...). The BIOS setup rountines give the possibilities to run disk checks on the disks connected - what I did. After a while (actually, the disk check takes while) the disk check told me that my TC disk was still OK and did not show any errors:



 4) What Next???


Now I could think of a replacement for our Time Capsule. After a deep thought and a couple of discussions with my wife we identified the following things we wanted to change with a new setup:

  • Separate the disk from the WLAN router to avoid collateral damage if one of the devices breaks
  • We wanted to realize a setup which allows streaming music directly from the disk without the need to have a computer running
  • Connection to our HiFi equipment
  • Price should be kind of reasonable
  • With the TC I did the data backup manually, it would be nice to get this automated in a RAID array
  • What I got from reading a couple of forums, it would be nice if the device to come had an iTunes server on board.
  • I wanted as well to connect a PS3 to the disk to view photos via the PS3
After some time studying forums and technical datasheets, we decided for the following setup:
  • The WLAN router will be realized by an Apple Airport Express. As this is able to receive streaming data via Apple Airplay, I connected it to the HiFi amplifier
  • The Time Capsule's hard disk will be reused in a Synology DS212j. I expect that this device is able to talk Airplay and that I can connect to the Airport Express. Furthermore, it has an iTunes server on board providing a local shared library. Besides this I has to slots for disks, one to be equipped with a backup disk (still to be bought) which can be set-up as RAID array. Last but not least it has many interesting features and can be connected to a PS3.
The Synology will arrive in a couple of days. I'll keep you updated in my next blog post.


Saturday, August 11, 2012

PostgreSQL DB under Mac OS X Lion

Background


Currently I am learning Ruby on Rails an I am following the excellent tutorial by Michael Hartl "Ruby on Rails Tutorial - Learn Web Development with Rails", where you learn how to build a full featured web miniblog app.
The application of the tutorial is based on a database, where all the data required for the app is stored in.  In the exercises of chapter 3.5 of the tutorial, the student is asked to move his/her development environment to a PostgreSQL database environment as this is a better choice than the previously used Sqlite3 db. I performed this exercise and want to report on the experiences I made. From reading a couple of blogs and forums, my impression was that there is not too much information available about the specifics of a Mac OS X system environment - I am working on OS X 10.6 (Lion).

Installing the DB on the System

As I am not a hacker, but rather like the straight forward path, I simply downloaded the postgresql Mac OS X app, which is available on http://postgresapp.com/ in its latest version. The downloaded ZIP file only contains one file "postgres.app". You can copy this file to your "Applications" folder to have it in a convenient place. The database is started simply by double-clicking on it.
So far so simple. What is kind of confusing is the fact that the postgres.app starts without any configuration dialog or alike. It simply starts to the background and that's it. At least I asked myself at this point: "and what about user and connection settings???". Well as I didn't find any configuration file I first tried to continue my RoR tutorial.

Using the Postgres DB in Ruby on Rails

The first challenge - well not a big one - was to identify the right connection parameters to be used in the database.yml file. Google brings up a plentitude of hits to the query "postgresql database.yml rails". I picked "Postgres - how to connect?" which provides:

production:
    adapter: postgresql
    database: foo_production
    username: postgres
    password: secret
    host: localhost
    encoding: UTF8
What confused me was the use of username and password.  As mentioned before, I didn't have any option to choose a user or password, so what to enter here? I played around a bit and in the end it worked by simply skipping these two parameters together with the encoding parameter. The following configuration worked in my development environment:

production:
    adapter: postgresql
    database: sample_db
    host: localhost

Database GUI Application

So with these settings I was able to continue the tutorial without problems. However, in chapter 6 the first user data is to be created in the DB and here I started to look for a database GUI application. There are a couple of choices, and I picked pgadmin, which seemed to be the standard. Pgadmin is available for download at pgadmin.org, for Mac OS X the is a file available here. The installation of pgamin is simple as for every Mac programm, simple put the pgadmin.app into the Application directory and that's it.
The usage of the program however, I did not find so simple. Pgadmin starts with a screen where only a "server group" is available without any content:

To add a connection to a database / database server one can do this via the menu File --> Add Server:


The window that opens to enter the connection data looks like this:

Here I got stuck:
Name: freetext, description of your configuration 
Host: localhost 
Port: in a couple of forums it seemed that 5432 is OK 
Service: ???? no idea 
Maintenance DB: "sample_db" assumed 
User Name: ???? no idea 
Password: ???? no idea, but should be empty 
I tried "sample_db" as value for the service and "postgres" as User Name. In the end everything I tried ended in an error messge:


My Solution

A google search did not yield any really useful results. I found one article which talks about "Securely Manage Remote PostgreSQL Servers with pgAdmin on Mac OS X". I used the information about the SSH tunnel, followed the instructions there and created the PERL script file postgresql-tunnel.pl with the corresponding information therein but in the end this did not provide any solution.
A bit desperate I tried to connect to my DB via the command line by using the console command
$ psql -h localhost
which gives console access to the local Postgresql database server. What finally gave me the hint solving the problem was the look to the available databases:
# \l
which yielded the following result:
Very promising seemed to try the database owner "Wolfi" (my user on the Mac) together with a blank password:


Name: freetext, description of your configuration 
Host: localhost 
Port: 5432
Service: <leave blank> 
Maintenance DB: sample_db 
User Name: Wolfi 
Password: <leave blank>
Finally this worked. I was able to connect to my DB and able to administer it:

Here a screenshot showing my development db and the table I created in the tutorial. 

That was it - I hope you find this blog kind of helpful...