Copy Files to Pogoplug Without The Pogo Software (using scp)

I recently picked up a Pogoplug on sale from John Lewis and thought I’d give it a whirl with my media.

Although it is a neat little device, one of it’s biggest benefits is also it’s biggest flaw in terms of design – and that is how it requires you to sign into and maintain an account there. It also requires you to mount the pogoplug with their software for transferring and viewing files, rather than acting as a NAS.

Whilst it’s nice to have easy access to media outside of home (without having to fiddle with setting up port forwarding on your firewall and whatnot) it’s a bit of a drag when you’re on your own network. I noticed a severe performance degradation copying media to my pogoplug device using pogoplugfs rather than through a standard means. So I learned that Pogoplug does appear to have a Busybox install and along with that SSH access. In order to enable SSH access, Cloud Engines have been gracious enough to allow this through your portal. You simply go to Security options and enable SSH, and change the password. From there it’s just a simple,

ssh root@<pogoplugIpAddress>

The problem is that there doesn’t seem to be any support for sftp and therefore I couldn’t use ssh in a file manager. Thankfully however ssh provides scp protocol and from there it was just as short script in order to zap files across over local lan without worrying about signing in.

When you attach an external harddrive to the Pogoplug, your files will be installed in a directory similar to ‘/tmp/.cemnt/mnt_sda2/’ where ‘mnt_sda2’ will be the mount point of your media device.

Be aware this script utilises “expect”, but you could use private keys instead.
#set -x
# Provide a list of media extensions to send to pogoplug
extensions=("mp4" "avi" "mkv" "jpg");
ppip="" # The local ip address of your pogoplug
echo ""
echo "Sending video files to PogoPlug ($ppip) for the following extensions..."
for ext in "${extensions[@]}"; do
echo ${ext}
echo ""
for ext in "${extensions[@]}"; do
 expect -c "spawn bash -c \"scp -p *.$ext root@$ppip:/tmp/.cemnt/mnt_sda2/\"
 expect assword ; send \"mysshpassword\r\"; interact"

I think the next step for this is to translate it to another language and wrap it up in a GUI for easy access. So watch this space perhaps.

Live Backup of Minecraft

I use Minecraft on Linux, occasionally I find java crashes whilst I’m playing and I lose my world save. I think it has more to do with some buggy hardware currently than the OS after a discussion I had with someone in meatspace.

Anyway, yeah, no matter what’s at fault, losing a Minecraft world is no pleasant thing, so I created the following script to incrementally backup whilst I’m playing. I run it from my home directory:


# Live backup of the game for java crashes
# Author: Wes Fitzpatrick

if ! [ -d .minecraft_live_backup ]; then
 cp -pr .minecraft .minecraft_live_backup
if ! [ -d .minecraft_current_session ]; then
 cp -pr .minecraft .minecraft_current_session
mv .minecraft_live_backup .mc_last_session`date | awk '{ print $1 $2 $3 $4 }'`
while true; do
 rm -fr .minecraft_current_session && cp -pr .minecraft .minecraft_current_session
 sleep 120
 rm -fr .minecraft_live_backup && mv .minecraft_current_session .minecraft_live_backup

What this does is first backups up your current .minecraft folder, so your last game is preserved, then creates two alternate backups. One is your current (minecraft_current_session) up to the last 2 minutes of play, the second is the previous current (minecraft_live_backup) in case the failure occurs during backup.

I’ve tested the backup copies and both work in event of a crash. This means rather than losing the entire castle, I’ve only lost the last few block placed.

Sharing Files Between Your PC’s

Sharing files between your PC’s independent of operating system has never been easier thanks to a range of new cloud based services appearing starting from last year.

This is particularly useful for those of us who run duel boot systems. It used to be a minor inconvenience to have to save files to an FAT/NTFS partition from Linux, just so you could access it from your Windows partition. Now I just use dropbox and get the added benefit of a temporary backup.

Here are 5 services to get you started:

Dropbox. Creates a dropbox directory in your home folder and will sync anything you put in there to an online account up to 2gb for free. Acts as a backup and can be installed on multiple desktops so you can access synced files from anywhere.

FeelHome. This platform independent and allows you to specify any directories you want for sharing between machines from an internet browser. It does not offer any cloud-based storage though.

SugarSync. Like Dropbox, but with more functionality and ability to specify your own folder. Currently Windows and Mac only but a Linux client is being mulled over (interestingly my reply on this forum thread is no longer there).

Ubuntu One. Similar to Dropbox, but also allows you to automatically sync tomboy notes and other related info between Ubuntu desktops. 2gb free then paid for thereafter.

SpiderOak. SpiderOak positions itself as more of a backup service, but the same functionality is provided as the others, including the option to share and sync your choice of folders.

I’m currently using Dropbox as a temporary share and backup, and Ubuntu One strictly for syncing my notes. I just installed SpiderOak to give it a trial. With the number of services available it may be possible to utilise a couple or more free accounts (2gb limit each) for different backup purposes without having to purchase a full 10gb or more of space.

Recover Your Data with Photorec

Recently my wife had a crisis – she deleted a huge amount of files in a directory all in one go, worse still, she had committed the fatal no-no of saving and working on these documents from a USB flash drive.

For anyone who is doing this – STOP IT! NOW! Flash memory has a limited lifespan, and if you don’t use up the whole memory block each time the parts you do use will wear faster*. What this means is you’re eventually going to lose those files if you’re relying on it effectively as a mobile office! That is of course, assuming you don’t lose your USB memory stick on the bus or the tube on the way to work…

Bottom line USB memory sticks are really for moving files around, not permanent storage, and it’s even worse to not make backups!

Back on topic. My wife was in despair, she thought these files were lost. Now anyone who uses Linux extensively knows that Linux creates a .Trash file which stores all deletions till you come to unmount. Not so on Windows – no Windows has it’s own bizarre rules for external memory depending on size. In the case of flash drives, there is pretty much zero chance of restoring from the Recycle Bin.

But all is still not lost! When she called me I was careful to instruct my wife not to touch anything on the USB drive. That means no saving, modifying or adding new files.

We then took the memory drive home and I plugged it into my trusty Ubuntified Sammy n210. I downloaded a package called Testdisk, which comes with a handy utility called Photorec.

For those lonely Windows users, download an Ubuntu live CD, then run Software Centre and install Testdisk and go from there.

Procedures for doing a recovery of files with Photorec can be found at Ubuntu’s Community Documentation portal.

It’s run from the command line but then there’s a simple intuitive GUI interface that gets you to where you need. Just select the USB device, the directory you want to save to and a few clicks later you can restore pretty much everything on the disk.

A word of warning though, Photorec spits out everything with a generic indexed name. The file extensions are there, but it’s a case of opening them up to discover what is inside and renaming those files. A bit laborious but if the documents are that important – worth it.

And once again – BACKUP YOUR FILES!

*I’m not talking about netbook flash hard-drives of course, they have different technology that evens the wear.