Pages

Thursday, March 15, 2012

The Marvelous Pogoplug


This is the story of how I replace an old power-hungry web server with a little power-miserly computer.

I've wanted to replace my web server for some time now. It's an old Compaq Proliant DL360 running in my basement. It's been fun to play with, but it's loud, heavy, bulky and chews up 190W of electricity. It's been useful for learning about FreeBSD and how to install and configure the Apache web server, but I want to be able to use my workshop without listening to the whir of the fans all the time.

A few weeks ago, took a look at the Pogoplug made by Cloud Engines. It comes in several models, all very low power (it draws only 5W). When I saw a sale on Amazon for only $20 (and about $7 for shipping), it seemed like a good idea.

Initial Impression
The model I bought is a POGO-B01. It's a tiny, low-power (both in terms of wattage and number-crunching power) computer that runs a version of the Linux operating system. It has four USB ports and one gigabit ethernet port. Other than plugging it into a 110V outlet, that's it for ports.

I was briefly distracted from my initial purpose by considering the Pogo backup service. Cloud Engines allows you to have 5GB online, and you can add a USB disk for additional storage at home. However, after reading their Terms and Conditions, their Privacy Policy and a few concerns about privacy on their forums, I decided their service wasn't for me. It looks like all files on their servers are accessible by their employees - there's no indication that they even try to encrypt the data. Furthermore, the Pogoplug runs some software that enables access to the device via pogoplug.com. Maybe it can be access only through one's own account at [https://my.pogoplug.com], but I didn't see any guarantees that unauthorized access couldn't occur.

Still, the Pogoplug device is pretty cool, so there must be a way to put it to use.


An Alternative Configuration
There's a talented group of developers over at Linux Arch|Arm who have done some marvelous work make available a  full Linux distribution for ARM-based computers. They have relatively simple instructions for replacing Cloud Engine's software. Once Linux is installed, one can install whatever server-software that one wants. I decided to give it a try.


What You Need
  • A Pogoplug
  • A USB flash drive or external hard drive
  • Telecommunications software, like PuTTY, to login to the Pogoplug from your desktop computer.
Obviously, you need a Pogoplug. You'll also need either a USB flash drive, or an external USB hard drive. I recommend the hard drive for even the most basic web server or backup server configuration. The Pogoplug has only 128MB of RAM, which is barely enough to run one service. A swap file is almost required and it's a bad idea to put a swap file on a USB flash drive. If background programs are frequently written to the swap file, it will wear out a flash drive too quickly.

What I actually did, was to install Arch Linux on a USB flash drive. After adding the Apache web server and an Network Time Protocol (NTP) daemon, I found one or the other would occasionally run out of memory and die. Fortunately I have a USB hard drive, which I added to the file system.

Regardless of the final set of daemons, what follows is what I did to replace the Pogoplug services with a fresh copy of Linux.

Turn on SSH Access
Initially the Pogoplug is controlled over the web via your account on [https://my.pogoplug.com]. To get more direct control, you have to turn on SSH access. I pointed my browser to my.pogoplug.com, logged in, selected "Account settings", "Security settings,  clicked a checkbox to enable SSH and set a password.

Install Arch Linux ARM
The detailed instructions are at the [Arch Linux ARM] website. The basic idea is to login to the Pogoplug, stop all the services installed by Cloud Engines, put a file system onto a USB flash drive or hard drive and install a fresh copy of Arch Linux.
1. I retrieved the IP address of my Pogoplug from my router's network page.
2. On my desktop PC, I started Putty and used it to connect to the Pogoplug via SSH. The login name is "root" and the password is the one I set at my.pogoplug.com. This provides a command-line interface in a bash shell.
3. All the Pogoplug services had to be stopped by running
killall hbwd
4. Next, I started fdisk to partition the USB flash or hard drive:
/sbin/fdisk /dev/sda
5. Change your current directory to the
/tmp folder and use wget to download the uboot installer script: wget http://plugapps.com/os/pogoplug/uboot/install_uboot_mtd0.sh
6. Change the permissions on the script so we can run it:
chmod +x install_uboot_mtd0.sh
7. Run the script:
/install_uboot_mtd0.sh
   - Type
ok to continue after the warning message
   - Type
Y to disable the Pogoplug services (because of the auto-update feature which could be used to cripple the device). This is probably redundant, since we ran killall hbwd earlier to kill the services.
   - Select the device you are running from the list displayed. This script works only for the Seagate Dockstar and the Pogoplug v2 Pink.
8. Assuming everything is okay, insert a USB flash-drive into one of the Pogoplug's USB ports.
9. Create a new file system on the USB drive by starting fdisk. Type /sbin/fdisk /dev/sda
   - Enter p to see the partitions
   - Type d 1 to delete the first partition
   - Type d 2 to delete the second partition
   - Repeat until all the partitions are deleted
   - Type p again to make sure there are no more partitions. If none are listed you've deleted them all.
   - Make a new partition by typing n
   - Type p to set it to primary
   - Type 1 to set it to the first partition
   - Press ENTER a few more times to set the default values
   - When it's all done creating your new partition, type w to write the partition and exit fdisk.
10. To get the file system working on this flash drive, we need to download another file. Type wget http://plugapps.com/os/pogoplug/mke2fs

11. Change the permission on the file by typing chmod 755 mke2fs
12. Run the script: ./mke2fs /dev/sda1
13. Make a new directory in /tmp called usb. Type mkdir usb
14. Mount the new file system here by typing mount /dev/sda1 usb
15. Change your directory to usb

16. Get the Plugbox Linux operating system distribution: wget http://plugapps.com/os/1.1/Plugbox-Linux-1.1-rootfs.tar.gz
17. Type tar -xzvf Plugbox-Linux-1.1-rootfs.tar.gz to uncompress the archive
18. Change directory to /tmp and unmount the usb directory (unmount usb).
19. Type /sbin/reboot to reboot the Pogoplug
20. Connect via SSH (note that the Pogoplug might get a new IP address) and login. The user name and password will each be "root".
21. Update the installed packages by typing pacman -Syu. You might have to run this a couple of times to get all of the packages update, because pacman might be out of date.
22. Type passwd to change your password to something other than root.

23. Set the date and time of the system with the date command using the date/time format of MMDDhhmmYYYY, where MM is the two-digit month, DD is the two digit day-of-the-month, hhmm is the 24-hour hour and minute, and YYYY is the four-digit year.
I think that's all there was to the basic installation. I actually bought two of these little boxes. One of them is configured as a web server (it only serves static pages and files stored in several Fossil-SCM repositories). The other is a backup server that has a 2TB USB drive attached and uses rsync to keep my desktop computers backed up. More on those later.

1 comment:

  1. Hi Doug. This was super helpful. Just wanted to say thanks. And to encourage you to post more about setting it up as a backup server etc, if you have the time of course.
    Cheers, Sujai

    ReplyDelete