Tuesday, 27 August 2013

Public BTSync Secrets

Following is a list of BitTorrent Sync secrets I am using to share files with colleagues;

SharePoint Support Files
Read only secret: B3XNA62PYSAAH7LGKCIORW536DVG3OME2
This repository hosts information and files related to installing, configuring, maintaining, and developing for Microsoft's SharePoint.

Lync Support Files
Read only secret: BXJDISWQTV6S2MJKVCK3HBV3DDPXZR4TG
This repository hosts information and files related to installing, configuring, maintaining, and developing for Microsoft's Lync Server.

PowerShell Support Files
Read only secret: B5CQA6PNTYAMQCJBUBNB32XQV4WJGL2YQ
This repository hosts resources for working with Microsoft Windows PowerShell.

If you would like to get read write access to any of the above repositories to add to the resource, please contact me and I will send you the secret.

This list will expand as I add more repositories.


BitTorrent Sync Thoughts

Update: Don't use BTSync. Checkout SyncThing instead.

As I broaden my usage of BitTorrent Sync (BTSync) I am coming up with more and more ways of making my life easier with this brilliant tool.

Here is a quick list of ways to use BTSync;
  • Sync your photos from your phone to your desktop
  • Sync your music from your desktop to your phone
  • Backup your files
  • Deploy software development solutions such as websites or script files (PowerShell).
  • Share files with family and friends
  • Support your family and friends remotely (screenshots etc.)
  • Share files with customers
  • Sync your installed games to multiple machines

One of the problems I had when first using BTSync was the naming of the folders and where to store them.   After using it for a month I came up with a good name for the root folder where I place all my synchronised folders.   I now have a folder called "Pool" and inside are all of the folders being synchronised.


This Pool folder is used for simple synchronised folders while I have backups and other large synced folders stored elsewhere.

BTSync is only new and I started using it with a little apprehension.   Because of a build up of trust in the stability of BTSync over the last month I decided to start synchronising a large folder on my home file server.   My file server is running on a Raspberry Pi, so I had expectations that the indexing (hashing) process would be rather slow on a 900GB directory of pictures, music, documents and more.   As it turns out, the btsync daemon is crashing often.   It looks like the software package needs more resources than the Pi can deliver which is a real shame.   I am hoping bugs like this will get fixed as the product matures over time.

If you haven't given BTSync a spin yet, give it a go.   You may find it saves you time and gives you access to your files in ways you never thought of.

If you have thought of a unique way to use BTSync, let me know about it in the comments below.


Monday, 26 August 2013

Determine the Active IP Address on a Windows Machine with PowerShell

If you have ever had a need to install multiple NICs onto a Windows machine, or use a Virtual Technology like Virtual Box, it can be difficult to determine your local network IP address because of all the logical network interfaces.   It is easy enough to run the ipconfig /all command and see the results but to determine which IP address is being used to access remote networks by using a script requires a little work.

The best approach I could come up with was to use the Windows routing table.   If you run the "route print" command on a Windows machine you will see the default network interface that is being used to route traffic to remote networks. Using this information you can determine which IP address is being used as the source address when accessing remote networks.

I had a need to detect the local subnet on a Windows 7 machine and came up with the below script. It will return a PSCustomObject populated with the active network interfaces details.

Using three WMI classes being Win32_IPv4RouteTable, Win32_NetworkAdapter, and Win32_NetworkAdapterConfiguration I could determine the information I was after.

Firstly I retrieved the Windows routing table filtered to the default routes. This gets sorted by the metric and I select the route with the lowest metric. This gave me the InterfaceIndex of the active network interface. Using this index number I could retrieve the network adapter and its configuration.

To use this script either copy the text below into a new function or, as I do, copy it into a ps1 file saved in your path and call the file directly. Here is the Gist link: https://gist.github.com/grantcarthew/7000687



Thursday, 18 July 2013

BitTorrent Sync - My new favorite Private Cloud File Sync Tool

If you have been following my previous posts you will see a trend of late. I am heavily into file access and file storage for my personal use. I thought I had come up with a great solution for my own Private Cloud Storage which involved a Raspberry Pi, Samba, AjaXplorer and Deluge.

As of this morning I was informed that a product I was very interested in, but did not think suited my needs, now has an Android client. I am talking about BitTorrent Sync (BTSync).

When I first looked at BTSync and played around with it as a possible solution for my file access, I dismissed it because I was more interested in getting access to my file server rather than syncing to my devices. Using AjaXplorer I can access my home file server from anywhere with ease. What AjaXplorer lacked at the time was a desktop sync client.

Now that there is an Android client for BitTorrent Sync, I have the ultimate Private Cloud solution. On top of the Raspberry Pi, Samba, AjaXplorer and Deluge I now have BTSync to synchronise selected files from my home file server to my laptop, desktop or mobile phone. BTSync complements AjaXplorer rather than replaces it. AjaXplorer provides a beautiful web interface to all the files on my file server while BTSync keeps my frequently accessed files at my fingertips.

Better yet, on top of BTSync synchronising my frequently accessed files I have configured the new Android BTSync client to synchronise my phones DCIM (Digital Camera IMage) folder to my file server and desktop. Now if I take a photo with my phone it is automatically available on my file server for my wife to access and on my desktop for me to manage. Using my desktop I can delete poor pictures and generally manage my photos and the changes will be synchronised.

What about backups? The BTSync client has a trash folder and an archive (versioning) folder, but nothing beats a manual backup. Once a week I backup my file server to an external USB hard disk drive. I still have a Dropbox account and have decided to use it for only one purpose. I have my Android Dropbox client configured to automatically upload photos. I will forget about my Dropbox account unless there is some need to access the uploaded files.

I am not going to post on my blog about how to install BTSync because it is so easy to do on a running Debian system. See this forum post for details.


 

Thursday, 13 June 2013

Private Cloud Storage

I am a big fan of Dropbox.   I have been in the information technology industry for well over a decade now and my first smart phone made me very interested in the cloud storage solutions available.   It's not until you have a modern mobile phone that you realize how handy it is having your data available whenever and wherever you are.

So with my new HTC Incredible S purchased December 2011 I installed Dropbox.   I then proceeded to install other Dropbox clients on my Windows desktops and Linux desktops.   Low and behold my files just appear everywhere at the same time, perfect.

Then I learnt about Evernote.  At the time I thought Evernote was handy and complemented Dropbox quite nicely.   After using Evernote for a year or so and learning how to use it properly, I discovered the benefit of building an information architecture based around the Tags in Evernote.

So here I am in the year 2013 with some experience on personal cloud storage and I have found a few interesting observations about my use of these services.   Firstly, Dropbox is less important to me than it was to start with.   In fact when I look back now, it was never really that useful to me on my phone.   I found it very useful on my Desktop but not my phone.   Secondly, the information you want on the run is normally text.   Evernote is absolutely brilliant for handling text notes and photos that you want to use for research or reference.

I should add at this point that I don't like spending money on services if I can avoid it.   Call me cheap if you wish but I am a dad with four kids and my beautiful wife stays at home running the household and home schooling the bunch.   My children, wife, house and life in general will always be a higher priority for me than cloud storage and hence the finances get steered in that direction.

This is where Dropbox and Evernote now need to be compared.   Both Dropbox and Evernote are businesses and need to make money.   Both services need to attract customers to make their service popular and get support from third parties making their services even more valuable.   Dropbox chose the path of storage amount restrictions to cause customers to pay for their service while Evenote chose the path of storage traffic restrictions.

With Dropbox you get a fixed amount of storage for free.   At the time of writing this post that amount is 2GB.   You can get up to 18GB of storage for free if you invite a lot of people to use Dropbox.   If someone installs Dropbox from an invite you sent then, both you and the person you invite will get an extra 500MB of free storage.   If you use the Dropbox link at the very top of this post and become a member of Dropbox I will get an extra 500MB as will you.

Now the business model that Dropbox has is not bad.   If you love the service and need it for work or storing large amounts of data then you pay for a subscription.   If you don't need to store a lot of data, it is free.   Over years of use you will find they increase your storage quota also.   The problem is most people have many gigabytes of data stored somewhere and it will cost them money to store this in the cloud.   An example is my CD collection.   I ripped all of my CDs many years ago and having a little OCD when it comes to information technology I used a lossless codec.   This comes to 82GB of storage and only includes my music.   Add to that the videos, pictures and other documents it is going to cost me $500 a year to store it in the cloud with Dropbox.

How about Evernote?   Well Evernote could have chosen the same storage limit business model as Dropbox but they didn't.   They chose, in my opinion, a much better solution.   Evernote only charges you for traffic to their site and it is only accumulated monthly.   At the time of writing this post you can upload 60MB of data per month for free.   My quota used today is 2.2MB or 4% and this will be reset in 9 days.   What this means for someone like me is that the service is totally free and is unlikely to ever cost me money.   Does that mean that I am a leech on Evernote and not contributing to it?   Definitely not.   By using Evernote and blogging about Evernote and showing people Evernote to explain information architecture for SharePoint content types I am giving them free publicity.   I am making the product more popular.   I am one of the many millions of people who have the app installed on my phone adding support to its popularity.   Evernote benefits by supporting me as a free customer.

So where are we?   Well you have gathered by now that I am a big fan of Evernote and still a fan of Dropbox.   But I don't need Dropbox.   I have a 4TB USB hard disk attached to a Raspberry Pi at home and it has all of my files stored on it.   I have another 4TB USB disk I use to backup all of the files in case of hardware failure.   This file server storage I have setup has cost me only a minimal amount.   The Western Digital USB drives cost $198 each.   The Raspberry Pi cost $50 with a case.   So for under $500 I have massive amounts of storage that will last for a few years at least.

All of this led me to research private cloud storage.   I don't need Dropbox to store my files.   What I need is access to my files from anywhere.   I started researching open source private cloud storage solutions with the intent of replacing Dropbox but I learned after installing a few of them that I didn't want file sync on my phone.   I just want to be able to access the files.   Similarly I do want file sync for my desktops.

I started my private cloud storage research with ownCloud.   I tried very hard to love this open source product but found it very buggy.   In fact it has so many bugs it is unusable.   So I started looking at other solutions.   This Reddit post helped a lot with my research.

Here is a list of private cloud storage solutions I looked into or installed and a brief comment on each.
  • ownCloud 
    I installed this and found it buggy and poorly programmed for its primary task.
  • git-annex
    I am a developer and LOVE git, but this isn't quite what I wanted.
  • Seafile
    I installed this and was very happy with it except that the files are stored in a database format rather than just allowing easy access.
  • SparkleShare
    I was keen on this solution but I could not see an Android client on Google Play so did not install it.
  • BitTorrent Sync
    This is an awesome file sync tool but again, not quite what I was looking for.
  • SpiderOak
    This solution is not open source so I didn't really look into it.
  • Unison
    I didn't look into this solution at all.
  • AjaXplorer
    This is a brilliant browser and mobile file access solution with a desktop client on the way.
 After evaluating some of the above private cloud solutions I settled on AjaXplorer.   Here is my previous blog post about installing it on a Raspberry Pi.   It gives me access to my files from my mobile with a nice client interface.   I can access my files with a browser if need be.   And I will be able to sync files to my desktop once the desktop client is released.

So I now have a headless Raspberry Pi installed in my house running off a phone charger using maybe $15 worth of electricity per year.   Plugged into that is a Western Digital 4TB USB hard disk.   The Raspberry Pi has three primary services running on it being Samba for local file access, AjaXplorer for private cloud file access and Deluge for the odd Bit Torrent file I need to download.

I am still a user and fan of Dropbox.   I use the Camera Upload feature of the Android Dropbox client.   It allows me to share files with other users of Dropbox.   It also lets me share files to non Dropbox users through the public links saving my home upload bandwidth.   But I realized through this whole process that I didn't need a cloud storage solution, I already had one.   All I needed was easy access to it.

I will continue to be a big fan of Evernote.   It is perfect for information access on your mobile devices and desktops.

If you know of any other private cloud storage solutions I have not looked into, please comment below.

[Update - 2013-07-18] -  I have added to my Private Cloud Storage solution and blogged about it here.


Tuesday, 28 May 2013

Installing AjaXplorer with Nginx on Debian

Over the past few months I have been looking into private cloud storage.   I have been using Dropbox for a long time now but am unhappy with the use of a third party for file storage.   That said, Dropbox is an awesome product and I will still use it for some functions in the future.   After much research I think I may have found a solution for private cloud storage that is best suited to my needs.

I will write another post about the different solutions I have found and tested but for now I am installing AjaXplorer.   This product is open source, installable on your own hardware and gives you access to your already existing file server with minor configuration.

Following are the instructions for installing AjaXplorer with Nginx on Debian Wheezy.   The hardware I am using is a Raspberry Pi with a 4TB Western Digital USB hard drive attached.   Because the Raspberry Pi is a low powered device I am using Nginx as the web server with PHP-FPM for processing php.

Assumptions
  • You already have Debian 7.0 (Wheezy) running.
  • You can download the AjaXplorer compressed file to your Debian server.

To start off with we need to install the prerequisite packages.   I am keen to keep my Raspberry Pi lean and so I did some testing to determine the minimum required packages needed to get the full functionality of AjaXplorer.   Note I am not including the requirements for the AjaXplorer desktop client yet because it is in beta and I am not interested in testing it.   If you wish to use the desktop client you will need some rsync php related packages.   So here is the command to install the prerequisites;

apt-get install nginx php5 php5-fpm php5-gd php5-cli php5-mcrypt

Once the prerequisites are installed, create the www directory and set ownership;

mkdir /var/www
chown www-data:www-data /var/www

We need to configure php to support larger file uploads so edit the php.ini file;

vim /etc/php5/fpm/php.ini

Edit the following values to your liking;

file_uploads = On
post_max_size = 20G
upload_max_filesize = 20G
max_file_uploads = 20000

Now we need to configure Nginx to setup our AjaXplorer web site (use your own domain name below);

vim /etc/nginx/sites-available/x.yourdomain.com

Here is the x.yourdomain.com config file I am using. Make sure you change the max_body_size value and replace x.yourdomain.com with your servers DNS name;

server {                                                                                 
  listen 80;
  server_name x.yourdomain.com;
  root /var/www;
  index index.php;
  client_max_body_size 20G;
  access_log /var/log/nginx/x.yourdomain.com.access.log;
  error_log /var/log/nginx/x.yourdomain.com.error.log;

  location / {
  }

  location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
    expires max;
    add_header Pragma public;
    add_header Cache-Control "public, must-revalidate, proxy-revalidate";
  }

  include drop.conf;
  include php.conf;
}

Take note of the two include statements at the bottom of the Nginx site file.   You will need to make these files also;

vim /etc/nginx/drop.conf

And here is my drop.conf contents;

location ^~ /conf/       { deny all; }
location ^~ /data/       { deny all; }
location = /robots.txt  { access_log off; log_not_found off; }
location = /favicon.ico { access_log off; log_not_found off; }
location ~ /\.          { access_log off; log_not_found off; deny all; }
location ~ ~$           { access_log off; log_not_found off; deny all; }

Note the first two deny all statements above are specific to AjaXplorer.
Now create the php.conf file;

vim /etc/nginx/php.conf

Here is my php.conf contents;

location ~ \.php {                                                                       
  try_files $uri =404;
  fastcgi_param  QUERY_STRING       $query_string;
  fastcgi_param  REQUEST_METHOD     $request_method;
  fastcgi_param  CONTENT_TYPE       $content_type;
  fastcgi_param  CONTENT_LENGTH     $content_length;
  fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
  fastcgi_param  SCRIPT_FILENAME    $request_filename;
  fastcgi_param  REQUEST_URI        $request_uri;
  fastcgi_param  DOCUMENT_URI       $document_uri;
  fastcgi_param  DOCUMENT_ROOT      $document_root;
  fastcgi_param  SERVER_PROTOCOL    $server_protocol;
  fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
  fastcgi_param  SERVER_SOFTWARE    nginx;
  fastcgi_param  REMOTE_ADDR        $remote_addr;
  fastcgi_param  REMOTE_PORT        $remote_port;
  fastcgi_param  SERVER_ADDR        $server_addr;
  fastcgi_param  SERVER_PORT        $server_port;
  fastcgi_param  SERVER_NAME        $server_name;
  fastcgi_pass unix:/var/run/php5-fpm.sock;
}

The last statement in the above file is the mapping between Nginx and PHP5-FPM.

Now that all the Nginx files are created we can enable the site by deleting the default Nginx site and linking to the new site;

cd /etc/nginx/sites-enabled
rm default
ln -s ../sites-available/x.yourdomain.com

Time to get the AjaXplorer files. Download the latest version and save it to your /var/www directory. Extract the downloaded file to the root of the www directory;

cd /var/www
tar -xzf <gz file name here>
ls -l
mv <extracted directory name>/* /var/www
rm -R /var/www/<extracted directory name>
chown -R www-data:www-data /var/www

Prior to opening a browser and seeing the result we need to restart the required services to pick up the new config files;

service php5-fpm restart
service nginx restart

Now open a browser and hit your IP address or DNS name.   The first time you access AjaXplorer you will see a diagnostics page that will look like this.


You will need to fix any issues discovered by the Diagnostics program before continuing. You will notice the warning about SSL Encryption.   I am accessing my server using Pound as a reverse proxy to encrypt the pages using SSL.

Once you have fixed any errors reported by the Diagnostics page click on the link under the title to continue to the AjaXplorer main interface. You will need to log in with a username of admin and a password of admin for the first access.   Make sure you change the password at some point.

The last required configuration for the installation is to adjust the AjaXplorer upload file size limit. This is achieved under settings;


That's it.   AjaXplorer is now installed and waiting for you to configure repositories and other customizations.  There are plugins available and client applications.   I am using the Android client successfully and will look at the Desktop client once it is out of beta.

The Raspberry Pi is an amazing platform for free open tools like this and I am now using a low powered Pi with a USB disk as my home file server cutting my electricity bill and reducing my carbon foot print.



Monday, 29 April 2013

Remotely Connect to Hyper-V with Hyper-V Manager

On Windows 8 or Windows Server 2012 you can install the Hyper-V Management Console and use it to connect to a server or client running Hyper-V Services.

Microsoft has the basic configurations covered at this address;
http://technet.microsoft.com/en-us/library/jj647788.aspx

There is a rather important detail missing though. To connect to the Hyper-V Service running on a different machine, you need to run the Hyper-V Manager using a local account.

Now if you are like me you are thinking to yourself "I am using my local account!" Well you may not be. If you chose to use a Microsoft account when you installed Windows 8, then you are not using a local account.

So make sure you have a local administrative account on both the Hyper-V Server and the Remote Management machine.   Hold down the Shift key and right click the Hyper-V Manager link and select to "Run as different user" and use your local account.

Have a read through the community comments on the bottom of the Technet page for more details.