Showing posts with label archlinux. Show all posts
Showing posts with label archlinux. Show all posts

Friday, August 30, 2013

PogoPlug Airport Airplay Express Music Receiver


Thanks to user,delakota555, who replied to a recent Airplay post. I went ahead and looked into Shairport. Shairport is an open source AirTunes emulator. It runs in Linux and I installed it on my hacked 15ドル ArchLinux PogoPlug.

OK, this is pretty awesome. I had a spare 3ドル USB sound card dongle lying around and in less than 15 minutes, I had an Airplay remote speaker set-up using a PogoPlug V4 I had lying around. Why is this awesome? 20ドル in parts and you have yourself a streaming Airplay iTunes receiver. You can buy a few of these and litter them around your house for remote speaker set-ups.

Pictured below is the V4 PogoPlug, a USB stick, the USB sound card, ethernet and voila, Airplay!



The Pogoplug instantly shows right up on my iPhone.



On iTunes, I can stream music to multiple speakers around the house. I think I'll be investing in some more 15ドル PogoPlugs shortly.

As you can see below, I can stream Airplay music to multiple Airplay devices including the PogoPlug. I love this. I love the ability to walk from room to room, floor to floor and hear the same music streamed throughout the entire house.




I followed this blog post for a pre-compiled binary and that was it.

Link: Shairport





Monday, March 18, 2013

Practical UNIX style backups using an ArchLinux PogoPlug

If there was ever a reason to get a 15ドル pogoplug hacked to run Arch Linux, this article may sway you.




I'm going to show you how I turn an ordinary 15ドル linux gadget into a useful "rsync" backup client.

The tasks which I will share with my readers is the typical things I would do administering *NIX based servers. We set up redundancy and failover using some simple and tried and true methods. There really is no rocket science involved. After doing it a few times, it becomes second nature. And because of the simplicity, it becomes apparent why I love small gadgets running Linux.

The articles and methods are pretty much simplified but they illustrate the simple and powerful nature of the powerful command line.

Today, I decided to turn one of my Pogos into a remote robo-copying slave. Its only job is to do remote backups of my GIT server. Then I realize, it should be running independently as a working droid (thinking Star Wars) to find,scan my network and backup any *NIX computers running in my household. I have a few spare older 250-320GB drives that needed to put to good use, so I pared them to a Pogo.

Normally, you would initiate the copy and backup from your desktop/laptop to the PogoPlug running some form of Linux/NAS. Here, I do the reverse. I have my pogoplug go out and do all the work.

So if I turn on my NetBSD G4 mac from 5 years ago, or come home with my Thinkpad, or turn on my iMac, it would automatically back them up without my intervention. I wouldn't have to think about it. If I was working on some code on my Thinkpad. I could go out to the back-yard to my patio and from my Macbook, I can pull source code that was already synced 5 minutes earlier off the Thinkpad.

Think of it as a reverse time machine. The concept is not new. We have dedicated backup servers that do nothing else but do remote backups off-site. Here, I am using a low powered PogoPlug running ArchLinux.

In fact, it took me 30 minutes to implement it. This is the power of *NIX. So I will share it with my readers today. Everything is meant to be done on the Pogo itself.

First, I logged into my Pogo and copy my SSH keys from my Pogo to all my target computers. So if I change my passwords, it would still authenticate against it. As I write this, I am thinking R2-D2 talking to the main-frame of the Death Star. If you don't know what SSH keys are, take a detour and google it before proceeding further. In short, keys allow machines to talk to one another without using passwords.

In arch, it is pretty easy.

ssh-copy-id username@remote_server

It will simply copy your keys over to the remote machine.




Next, I wrote a small bash script that pings the remote machine. If the machine pings, it means it is online and it will then attempt to rsync with it. Rsync is the tried and true industry standard for remote file synchronization/file copies.

Feel free to use this bash script. Simply, change the variable of the "remote_machine" to the IP or hostname of the computer you want it to ping and rsync. Since my network employs Avahi/Bonjour, it pretty much works by hostname. EG. My Thinkpad is accessible via ThinkpadT420.local
In this example, my remoteserver.local is my intended target.

I do a simple IF THEN conditional check in my bash script. If the machine doesn't ping, alert us with a message. Otherwise, proceed to rsync.


 #!/bin/bash 
 remote_machine="remoteserver.local" 
 PINGCOUNT=2 
 PING=$(ping -c $PINGCOUNT $remote_machine | grep received | cut -d ',' -f2 | cut -d ' ' -f2) 
 if [ $PING -eq 0 ]; then 
 echo "Something wrong! server: $remote_machine down" 
 else 
 echo "All good: $remote_machine" 
 echo "We will rsync now" 
 rsync -au --progress --stats root@remoteserver.local:/var/www/ /media/passport/rsync/vps/www/ 
 fi 


My rsync command is pretty straightforward here. Archive and update. I added progress and stats for my own reference.


rsync -au --progress --stats root@remoteserver.local:/var/www/ /media/passport/rsync/vps/www/ 


Basically, my rsync logs into the remote server, copying the /var/ww/ into my destination of my 1TB Western Digital USB drive labelled, passport. The copies go into a folder, /media/passport/rsync/vps/www


After writing it, I tested it. I named my script vps_backup.sh

I then change the permissions to executable and did a dry run.



As you can see, the files and folders populate from my remote machine. The below screenshot shows two web directories. One from my iMac and another from a remote VPS.





Lastly, I would use a cron job to run every few minutes. You can even do cron job schedules in Webmin. I would recommend installing webmin so you can have a web based administratie interface of your Pogo. It simplify things quite a bit.

When you log into webmin, head over to System . Scheduled Cron Jobs.


Cron Jobs under webmin is pretty much a point and click.

I specified the user running as "root" to have full system rights and pointed to the script I wrote earlier in /root/vps_backup.sh. For this example, I specified a daily midnight schedule but I could change to hourly or every 5-10 minutes.




And there you have it. A simple (well, at least for me) way to do interval backups from a Pogo.



Thursday, March 7, 2013

PogoPlug ArchLinux Speed Testing and Notes



If you've been reading this blog, you know I'm a big fan of the 15ドル-20 Pogoplugs. They're really popular with people who want to run a low-powered embedded ARM Linux server. Depending on drive, they consume a mere 4 to 15 watts of power. The platform of choice and most popular is ArchLinux.

This post is tailored for those who are want to run ArchLinux ARM on their pogo and use it as a NAS/File Server. I also assume you have already ventured into the PogoLand with your unlocked Pogo with Arch installed.

I'm going to go over my findings and offer my recommendations.

First of all, before you do anything, make a full backup of your bootable Arch USB. There are a few ways to do it: DD, rsync, and tar gzipping.

Here is a link to get you started: https://wiki.archlinux.org/index.php/Full_System_Backup_with_rsync

I personally do a TAR gzip of my USB so I can unzip back to a USB stick that may be a different size.

I believe most or all of the Pogoplugs come with Gigabit standard. However, network speed and copies will be dependent on a few things. The filesystem, the limitation of USB mass storage and your network file sharing protocol.

Out of the box, the Pogos run at 60 Megabytes per second in theory. This is serving from RAM and synthetic benchmarks. When you attach a USB drive, that speed will drop considerably. I would say around 35 MB/sec in super ideal situations.

You can stream 720p MKV and H.264 comfortably in most cases.

There are a few things you should take into consideration and YMMV (Your Mileage May Vary).

After making a backup, the next thing you should do is experiment with Jumbo Frames if your router/switch and network supports it. Start off at 4000 and try slowly going up to 9000. If your system is unresponsive, most likely your guest computer or network switch is incompatible. Worst case scenario, something is wrong with your Pogo and you will need to restore from a backup clone.


As you change your MTU to Jumbo frames, test the transfers using a tool like iperf.
To change MTU, you do like you do in any Linux distro:

ifconfig eth0 MTU XXXX




As you can see in the screenshot above, I started to average 110 Megabytes per second which is near the Gigabit's theoretical limit of 125 MB/s.

Now, when I drop it back to normal frames of 1500, you can see my network speed drop to normal of 65 MB/sec.


Changing to Jumbo Frames can also have undesired consequences. If your other client computers do not have Jumbo Frames, performance will suffer. For example, if you are connecting an iPad or Android device to your Pogo via Samba, there is no way to change Jumbo frames on most mobile devices.

In some cases, mismatch MTUs from client and server produced disastrous results. So YMMV. See below. 2.58 MB/sec.



You may be wondering why bother with network speeds when USB disk access is slow (next section).
Well, with faster Gigabit, you can network mount shares from other sources into your Pogoplug. For example, if you plan on building a Squeezebox music server and just the server itself, you can NFS mount from another file server. The same goes with running a torrent server and saving the files elsewhere. Importantly, if you have multiple disk with multiple shares, you want to ensure each client is not using up all the bandwidth.


Disks Considerations:

The most important thing that affects PogoPlugs (and Linux in general) is the filesystem you plan to use. Native EXT3/EXT4 is the only way to go.

NTFS and FAT32/ExFAT is not recommended if you want speed. Fuse based Filesystems have to go through several layers. NTFS and ExFAT is nice because you can store files larger than 4GB. However, Linux EXT filesystems also support large files as well.


The only problem with using EXT3/EXT4 is you can't easily unmount your USB drive and connect to non-Linux running computers. If your main platform of choice is Windows, you may want to stick with using NTFS. I have plenty of Linux computers around the house at my disposal so this is not an issue.

Just for comparison,using the same drive (a 1TB Western Digital Passport drive), NTFS was a slower. Especially in writes, it was horribly bad at 6.5 MB/sec vs 27 MB/sec using EXT3

Here are NTFS disk benchmarks


and EXT3.


I use DD to write and test the same drives. If you plan to use the Pogo as a dedicated server, it is highly recommended to use EXT3 or EXT4.

This also translates over to Network file access. Using Blackmagic's Speed Test on a Macintosh with Samba, I see similar results.


And with EXT3


Interestingly, using Netatalk, I was getting close to 35MB/sec reads.

Encryption will also take your speeds down quite a bit. With SCP/SFTP, you will only get around 5 MB/sec.



NFS did not really fare any better. The best I could get is 8 MB/sec.




In short, if you want the best performance, stick with EXT3 and Samba. USB 2.0 is really the bottleneck with PogoPlugs. They're great at what they do but dont expect them to replace a Synology or any other dedicated NAS for heavy duty work. 25-35 MB/sec is pretty respectable for a USB drive hosted NAS. Backups, Rsync, and Time Machine do not require much more. Then again, a Pogo plus Harddrive consumes 10 watts!

Hopefully this has changed with Series 4 of the PogoPlug. The V4 has a USM SATA dock connector and USB 3.0. However, unlike the Classic Pogos, they don't go for 15ドル-20.
I have one on order and plan to report back soon.





Saturday, September 29, 2012

Stocking up on PogoPlugs

I've been stocking up on these little PogoPlug devices. I have 5 total (3 at work and 2 at home).


18ドル.50 shipped on sale at Adorama is a no-brainer. I've installed ArchLinux and they've been running all sorts of things for me - BIND DNS, MySQL backups, Rsync Daemon, LAMP (PHP and MySQL). They are great fun to play with. I make a point to do everything from my phone and iPad to make sure I am "Intel/X86" free. I definitely think ARM is the future. I have a bunch of old USB sticks lying around so these put them to great use.

With an iPad, it takes a total of 20 minutes from start to finish to build a LAMP server with SAMBA/AFP access. Once you enabled SSH, you are pretty much free to do whatever you want with ArchLinux ARM. Go ahead, install WordPress and host a blog from your house for less than 2ドル a month in electricity.






Subscribe to: Comments (Atom)

AltStyle によって変換されたページ (->オリジナル) /