Subscribe RSS
Raspberry Pi and Crash Plan on Java 8 Embedded Mar 19

I've been playing around with my new raspberry pi unit.  Its now freely available to buy and while I will sound very geeky its a cool thing to play with.

For sure its linux based and the default install of raspberry debian is very easy to use with help from the great internet community.  What I am really loving about it is that it can do so much!  

My first interest was to give it a go.  I come use Windows for work, Mac for home (with remote access to work), but a few years back i was so pissed of with Vista i tried Ubuntu and got into Linux.  Been a fun mix.  I'll still use Mac now the bulk of my daily work, but the linux box takes care of three key things for me.

1.  Deluge Torrents

2. Crashplan back for myself and other friends

3. OwnCloud (this is a new item and still experimental).

Having my linux box with all the disks and high end processor, plus the mac running all day is eating into my power bill.  In Australia energy is not cheap so after playing around and researching the PI it looks like it might fit the bill really well.  

Looking at all the great work been done it made sense to divide the functions.  So my first PI will run my torrents and owncloud and the second will be for the crashplan backups.  Each unit will have its own USB 2TB drive.  Should alot less power consumption that my current setup.

I will focus on this blog on the crashplan setup as it has been the most challenging.

The Basics.

Crashplan needs a Java Virtual machine.  Until a few months ago the only way to run Java was on the the PI without using the hardware floating point ability.  The great news is now we have the core OS with hareware FP and Oracle have release a new preveiw version of Java for embedded devices with hardware FP.

The Setup

I played around with various setups and also pulled in lots of info from other people on here.  If you are going to use a PI as a crashplan device it only makes sense that you will have a USB drive attached to it for storage.  Great news is there are so many and cheap to buy.

So after doing the basic setup of the Pi i added the USB drive to the system.  But there are a few steps to make this work really well.

Load up the basic operating system. and boot into it.  You can use a 2GB card if you like.

after boot up and I like to switch on SSH so i can do it all remotely.

So after intial boot, turn on SSH, you can do localisation again if you want.

Boot and login (via SSH – doesn't matter)

do

sudo apt-get update

so you have the latest updates,

then

sudo apt-get upgrade

so you now have the latest os.

I then wanted the latest firmware so followed this blog to do that.

 

 
this will upgrade the firmware.  I made the mistake of doing this after all my config and has set my SD card to read only, it corrupted it.  Can't confirm if this is a direct result, but my resolution from that mistake was to go back to this step and upgrade the whole system before i moved the rootfs.
 
We now updated system.
 
I went down the whole route of building my system before i moved it, but the process works so you don't need to do that.
 
Attached your USB drive.
 
Now here the steps might get out sync
 
I did the following
apt-get install gparted
 
then started the directly, did a
startx
and then opened a teminal window with
sudo gparted
switched to my sda device and created
sda1 as swap, i used 600 megs, pick you own value.
sda2 as root ext4 with 20 gig
sda3 as data ext4 with the rest of the space
 
Where it got confusing is that followed the below guide to move the root, but also opened another terminal and made changes to fstab.  and guess what they didn't copy. My bad.  So lets assume you need recheck each of your entries.
 
There is also another guide you need to follow for moving you swap file.
 
http://www.bionoren.com/blog/2013/02/raspberry-pi-crashplan/
Go down to the comments from Brad about moving your swap file.  I admit that his instructions did not directly work for me.
What i found was work with gparted and create the swap partition using that.
Then update you fstab file with the swap file info
/dev/sda1 swap swap defaults 0 0
(thats my entry)
 
Critical point from Brad's article thou is to remove the old swap stuff.
 
sudo apt-get purge dphys-swapfile
 
(I am still researching the new values to use in the SWAP file settings.  
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=29&t=8819
has some great information I am trying.
 
Another note here is that I'm not entirely sure about setting the boot partition to read only.  It seemed to work well until i did a firmware upgrade and it blew away my SD care (more on that at the end)
 
I then followed this guide for moving the rootfs to the USB drive.
 
http://darmawan-salihun.blogspot.com.au/2012/12/moving-raspberry-pi-root-filesystem-out.html
 
Test this out yourself.  but it does work.  One note here is that after you move the root to your USB it will still have the same partition size as before (that fooled me for a while, only reason i new i was working on the new partition was updates I had made to the old one were not there.)
 
Easy fix i found was the resizefx command
 
mine was
resizefx /dev/sda2
(as that was my root partition = please check i got this bit right
 
I now have a fully running operating system off my USB drive and space.
 
I then followed the install crash plan from these guys.
 
http://www.bionoren.com/blog/2013/02/raspberry-pi-crashplan/
 
this is collaborative effort and i hope this adds to the great work form these guys.
 
There was a slight change I made, via trial and error and also some later logic.  The guide will have you using the SDK of jave and will certainly work, but after it didn't quite work for me a few times I found it easier to use the jre.  I'm also of the thought that using the optimized code will give better performance.
 
So next are my little steps I did.
 
I didn't add the java system to my path, but did swtich to su.
then went to the Crashplan-install directory and ran
./install.sh
 
System then advised that no JRE was detected and would I like to install.  I accepted that.  As I had already modified my fstab to include the new storage space i also updated that parameter.
 
Let the install run.
 
I then followed the blog and copied all the new files and update the startup (amazing work there guys in sorting that all out.  Next step for me was goto
/usr/local/crashplan and remove the the jre directory.
cd /usr/local/crashplan
sudo rm -r jre
then goto the place you had placed the java 8.  I had followed the guide so mine was at
cd /opt/java1.8.0
then sudo cp -r rte /usr/local/crashplan
 
Simple explanation here is that crashplan installed its own version of the JRE into one of its directories. That install was for intel hosts, so I removed that directory and replaced it with the ARM code.
 
Continue with the startup and if it all worked that Crashplan will start!  and using the commands from the blog it will show the status of still running.
 
I followed the Crashplan blog for headless connection which worked perfectly. I already have an account and it all came up fine.
 
I want to now run this configuration on the new disk and settled system for a few days and see how it works.  Performance is fair given the PI processor.
 
The key principles on this setup are.
1.  You have a USB drive attached. (I would be pointless to use the SD card here).
2.  As we have a USB drive move the swap file to the USB and activate its functionality
3.  Move the rootfs to the USB drive so we get even more space.
4. Opps should be step 0, format your USB drive with swap, root and data space
5. Configure and install crashplan, which includes Java 8
 
next steps.  want to see if we can get crash plan gui working, but its so easy to configure headless.  then also to open it up to my internet users.
 
I have not yet seen the deep compact performace, but even if it takes hours to run, who cares,  this is an embedded device.  Who cares if its spends all days sorting stuff out.
 
To all the guys who did so much work before this thank you so much.  It is actually working.  I hope I can add to the community on how to apply the knowledge you have given along with all the others into a cohesive system.
 
I have quite done how to connect a USB hard drive, but this link is readlly good
http://elinux.org/RPi_Adding_USB_Drives
 
Category: Uncategorized
You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.