Dec 122013
 

In this part, I’m going to go through FreeNAS 9.1.1 from installation to setup and use of the NAS.

FreeNAS has the easiest installation of them all, coming in an .xz file all I had to do was write the image file to the install media – which in this case is a USB thumbstick.

To write the image on a Linux system I used dd and xzcat

# xzcat FreeNAS-9.1.1-RELEASE-x64.img.xz | dd of=/dev/sdh bs=64k

Booting the NAS from the USB stick brings up FreeNAS with it’s web interface running on the normal http port.

Booting after installation took around 8 minutes, though I’m not sure whether it’s my hardware or the USB stick that’s causing the delay, but any bootups after the first one only took around 3-4 minutes.
Keeping in mind though that I had not customised FreeNAS yet, so boot times may be improved by tweaking the settings.

After the NAS booted up, I could access the NAS on it’s web interface using FireFox. Chrome wouldn’t play nice though.

The web interface is very smooth and quick to respond. All configuration can be done from the web interface, from storage operations to networking operations to showing system data. It’s all neatly organised in the menu, with some quick shortcuts along the top. Each function that is opened is opened as a tab, allowing you to flick between tasks quickly and efficiently, without having to navigate through the menu again.

You can see the Reporting, Settings, and System Information Tabs open here

First things first, I had to correct my timezone.
Clicking on the Settings tab at the top provided me some further tabs, as well as the following settings

Updating my Timezone was a simple matter of picking the right one and clicking on save.

Clicking on Reporting shows me a nice graphical overview with some history on the system.

This will allow me to keep an eye on the System to see how well it’s doing under the load of FreeNAS.

I also needed to configure my Default Gateway and Nameserver settings. The DHCP client mustn’t have gotten the settings from my DHCP server.
This is also easily done, just by clicking on the Network button at the top, which brings up the Global Configuration

Next up, I’ll need to actually assign my hard drives to a Volume, or Pool depending on whether I use UFS or ZFS.

Creating Volumes or Pools which are used to store files on was very easy. Clicking on Storage and then ZFS Volume Manager allowed me to create a new volume with the 2 500 GB hard drives that I had in my NAS, setting them up as RAID1 or Mirror configuration.

Once I’ve gone through the volume manager, I can see my new Pool sitting there waiting for me to dump some data onto it

I had other options too – I could have used only 1 drive for my NAS, or had 2 separate devices within that pool created.

Doing something fatal like detaching the volume painted the screen a bright red, instantly making me aware of the dangers of the action.


Don’t think I’ll be doing that just yet.

Volumes are mounted under the /mnt/ directory, so my just created RAID1 volume can be found under /mnt/RAID1/

It takes just a few clicks to create datasets. Datasets allow you to treat a subdirectory like a filesystem with access controls, compression, and snapshot ability.

Clicking on Storage at the top, then selecting RAID1, and then clicking the New Dataset button down the bottom brings up the new dataset window.
Enter in a name, click add dataset, and it’s created !

Now, time to setup some shares so I can dump data onto the NAS.
Clicking on the big Sharing button brings up the tabs for Apple (AFP), UNIX (NFS), and Windows (CIFS).
Since I don’t have any Apple or Windows devices, I’ll start setting up a NFS share.
Clicking on the UNIX (NFS) tab gives me a Add Unix (NFS) Share button.
Easy enough.

Clicking on that button brings up this window, allowing me to configure the settings for my new NFS share.

Setting up an authorised network, and the path that the share pointed to was easy enough.
After creating the new NFS share, it even asked me if I wanted to enable the NFS service.

After enabling it, I was able to poke it to see if it existed with the showmount command from another computer.

# showmount -e 10.0.0.201
Export list for 10.0.0.201:
/mnt/RAID1 10.0.0.0

As you can see, poking it showed that it was available.
I can now mount the NFS share with a simple command from any linux pc –
mount 10.0.0.201:/mnt/RAID1 /mnt/point

With it mounted, I can now copy and paste files to the NAS !

In my next post, I’ll have a look at FreeNAS’s plugins.

Share

Dec 042013
 

I’ve been wanting to obtain a NAS of some sort for a while now, and after seeing some of the abilities of the Synology NAS enclosures, I was set on just buying one of the Synologies.
However, after looking at the cost of the 4 bay NAS, I wasn’t so sure I could shell out for one.

So I’ve decided to build my own NAS rather than buying a pre-built one.
The pros of building my own is that it’s more flexible than the pre-built ones, and plus I also get some experience with some more Linux Distros on the side !

I’m using some old recycled hardware to save on money as I wanted to shell out as little as possible.
I’ve managed to scrounge up some old old parts to host this NAS on –

  • Asus A8N-SLI Deluxe Motherboard
  • AMD Athlon64 3200
  • 4GB DDR400 Ram
  • Generic Case
  • thermaltake 430W Power Supply
  • A few 500GB Hard drives

Not exactly the latest and greatest, but it should do for the purposes of serving up a few files and whatnot.

The first thing I need to do after I’ve got my hardware, is to choose a Distro.
I’m going to try three distros before I settle on one to actually use as my NAS, just so I can get a feel of the pros and cons of the different distros.
The three that I’ve chosen for this particular project are –

All 3 distros are free to download, so there’s no cost involved in obtaining the distro itself. Support can be bought for FreeNAS and OpenFiler.

A quick rundown on the features, pros, and cons that I’ve found of these 3 Distros so far –

FreeNAS

Features

  • Replication – File system snapshots
  • Data Protection – Raid Z/Z2/Z3
  • Backup Services – Windows Backup / Apple Time Machine / Linux rsync / BSD Life-Preserver
  • Encryption – Volume level encryption
  • File Sharing – CIFS/NFS/AFP/FTP/iSCSI + more
  • Web Interface – No CLI required
  • Plugins – Add functionality easily

Pros

  • Slick Web Interface
  • Lots of plugins available

Cons

  • Requires dedicated install drive
  • Higher Hardware Requirements
  • Not many plugins out of the box

OpenMediaVault

Features

  • Based on Debian – Has all the normal Linux Features – apt/cron/avahi/Volume Management
  • Web Interface – No CLI Required
  • Plugins – Add functionality easily
  • Link Aggregation – Make two NICs act like one
  • Wake On Lan – Wake up the computer remotely
  • Monitoring – The normal Linux monitoring abilities – Syslog/Watchdog/SMART/SNMP/etc.
  • Services – The normal Linux services – SSH/FTP/TFTP/NFS/CIFS/rsync

Pros

  • Nice Web Interface
  • Standard Debian shell and commands
  • Low System Requirements

Cons

  • Requires dedicated install drive
  • Not Many Plugins out of the box

OpenFiler

Features

  • RAID support – Supports Hardware and Software RAID
  • Clustering – Supports clusters with block level replication
  • Multipath I/O – supports Multipathing
  • Based on the Linux 2.6 kernel
  • Scalable – Can do online resizing of filesystems and volumes
  • Volume Sharing – iSCSI / Fibre Channel
  • File Sharing – CIFS/NFS/HTTP DAV/FTP/rsync
  • Web Interface – No CLI Required
  • Quotas – User and Group quotas
  • Based on rPath Linux

Pros

  • Nice Web Interface
  • Doesn’t require dedicated install media
  • Low System Requirements

Cons

  • Not many plugins out of the box

In the next part of this series, I will explore FreeNAS and see what it can do for me.
Originally I was having some issue installing it, so hopefully this time around I can get it to install !

Stay tuned for more :)

Share

Aug 032013
 

A few people have asked for the scripts that I use to generate Raspbian Server Edition.

So here they are !

The package list is just a dump from dpkg of all the packages that have been removed.
The script is a very rough script, so there’s no error checking.
The syntax is

pkgs.sh pkgs.txt

Share

Jul 192013
 

Hey Everyone.
This version of Raspbian Server Edition is just 2.4 but it’s been upgraded to Jessie rather than Wheezy.
Not much has changed apart from that, but it’ll save you an update :)

5431be436a23fd05e779f3a14e8fe05d5a9dc581 RSE2.5.img
4cbb92b1b7700dff3eab95581c3b043a1ccaee1f 1GB-RSE2.5.img

The images can be grabbed from here –
RSE 2.5
RSE 2.5 1GB

Share

Jun 272013
 

I’ve been building a “Stats Grabber” for one of the managers at work. The ServiceNow instance that I’m using only has the XML interface enabled at the moment so I’ll be using that.

This will just be a quick overview of what I’ve used to build this, won’t go into the details too much as each configuration will differ.
The stats that I needed were to be sorted by day, so I’ve defined a function that will return an array that each day will have.
I’ve cut down what I actually had but this gives you a good example.

function CreateArray() {
return array(
"req"=>"0",
"inc"=>"0",
"incMajor"=>"0",
"contacttypePhone"=>"0",
"contacttypeEmail"=>"0",
"contacttypeOther"=>"0",
"contacttypeAuto"=>"0",
"totalTickets"=>"0",
"reqResolved"=>"0",
"incResolved"=>"0",
"totalReqInc"=>"0",
"reqResBySD"=>"0",
"incResBySD"=>"0",
"totalResBySD"=>"0"
);
}

Next up is defining the URLs that are used to retrieve data.
The $instance variable will need to be defined.

// Request Queries
$requrl = "https://".$instance.".service-now.com/u_request_list.do?XML&sysparm_query=u_requestor!%3D9faaf5b90a0a7813005cc0d4347713bc%5Esys_created_onONDateRange%40javascript%3Ags.dateGenerate('".$_POST['startdate']."'%2C'start')%40javascript%3Ags.dateGenerate('".$_POST['enddate']."'%2C'end')";
$resolvedrequrl = "https://".$instance.".service-now.com/u_request_list.do?XML&sysparm_query=u_requestor!%3D9faaf5b90a0a7813005cc0d4347713bc%5Eu_resolvedONDateRange%40javascript%3Ags.dateGenerate('".$_POST['startdate']."'%2C'start')%40javascript%3Ags.dateGenerate('".$_POST['enddate']."'%2C'end')";

// Incident Queries
$incurl = "https://".$instance.".service-now.com/incident_list.do?XML&sysparm_query=sys_created_onONDateRange%40javascript%3Ags.dateGenerate('".$_POST['startdate']."'%2C'start')%40javascript%3Ags.dateGenerate('".$_POST['enddate']."'%2C'end')";
$resolvedincurl = "https://".$instance.".service-now.com/incident_list.do?XML&sysparm_query=u_resolvedONDateRange%40javascript%3Ags.dateGenerate('".$_POST['startdate']."'%2C'start')%40javascript%3Ags.dateGenerate('".$_POST['enddate']."'%2C'end')";

You may also notice the $_POST variables in the url, these will need to be passed to this script in the YYYY-MM-DD format. These will also be used later to construct the array for the days.

I’ve used CURL to retrieve the data, but there are a few different ways to do this
This snippet will create the $ch handle;

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, $un .":". $pw);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);

Next we’ll start getting the data.


// Get Requsts
curl_setopt($ch, CURLOPT_URL, $requrl);
$reqreturn = curl_exec($ch);

// Get Incidents
curl_setopt($ch, CURLOPT_URL, $incurl);
$increturn = curl_exec($ch);

// Get Resolved Requests
curl_setopt($ch, CURLOPT_URL, $resolvedrequrl);
$resreqreturn = curl_exec($ch);

// Get Resolved Incidents
curl_setopt($ch, CURLOPT_URL, $resolvedincurl);
$resincreturn = curl_exec($ch);

curl_close($ch);
// Curl End

I haven’t put in any error capturing but that is something that should be there to catch any errors when trying to retrieve the data.

Now to create the array that will contain all of our data.
As I wanted the data sorted by days, I’ve used a for loop with the start and end dates to create the array.

$DateArray = array();
if(isset($_POST['startdate']) && isset($_POST['enddate'])) {
$start = new DateTime($_POST['startdate']);
$end = new DateTime($_POST['enddate']);
$diff = $start->diff($end)->format("%a");
for($x = 0; $x < $diff+1; $x++) {
$datestamp = date("Y-m-d",strtotime("+$x days",strtotime($start->format("Y-m-d"))));
$DateArray[$datestamp] = CreateArray();
}
}

Now we’ll start processing the data.
I’ll only post one of the four blocks for brevity as they’re esssentially the same with minor differences when it comes down to the data.
SimpleXML is used here to parse the xml output of ServiceNow

// Load Incidents XML
$xml = simplexml_load_string($increturn);
// Get Total Incidents
$incTotal = $xml->incident->count();
// Parse incidents for date
foreach($xml->incident as $item) {
$datestamp = date("Y-m-d",strtotime("+8 hours",strtotime($item->opened_at)));
$DateArray[$datestamp]["inc"]++;
$DateArray[$datestamp]["totalTickets"]++;
if($item->priority < 3) {
$DateArray[$datestamp]["incMajor"]++;
$totalMajorInc++;
}
switch($item->contact_type) {
case "Email":
$DateArray[$datestamp]["contacttypeEmail"]++;
break;
case "phone":
$DateArray[$datestamp]["contacttypePhone"]++;
break;
case "Auto Monitoring":
$DateArray[$datestamp]["contacttypeAuto"]++;
break;
default:
$DateArray[$datestamp]["contacttypeOther"]++;
break;
}
}

Once all four of those blocks have been executed, you now have the data all in a nice array.
You can then use a foreach loop on the DateArray array to get your data out

Share

Jun 202013
 

I recently decided to create a LiveCD to simplify downloading and flashing Raspberry Pi images.

I started off with the GParted ISO as that is already a small distribution, plus it has everything I needed for the PiParted distribution.
GParted comes in ISO form, so the first thing we need to do is mount the ISO file to get all the files that out of it. You’ll need to be root to mount the ISO file, or use sudo.

# mkdir -p ~/isodistro/iso
# mount -o loop gparted-live-0.16.1-1-i486.iso /mnt/iso
# cp -r /mnt/iso/* ~/isodistro/iso

You should see the following files inside

EFI EFI-imgs GParted-Live-Version GPL isolinux live syslinux utils

Inside the live directory, you will see these files

filesystem.packages filesystem.squashfs initrd.img memtest vmlinuz

The one we want is filesystem.squashfs, this file is what contains the main filesystem of the distribution.

As you can probably deduce from the file extension, this file is a squash fs file system. Which means that we can easily unsquash it.

# mkdir ~/isodistro/fs
# cp ~/isodistro/iso/live/filesystem.squashfs ~/isodistro/fs/
# cd ~/isodistro/fs
# unsquashfs filesystem.squashfs

This will create the squashfs-root directory within the fs directory, and if we have a look in there…

# ls squashfs-root/
bin dev etc home initrd.img lib media mnt opt proc root run sbin selinux srv sys tmp usr var vmlinuz

Tada ! We have the root filesystem of GParted.
The startup scripts are located within etc/gparted-live/gparted-live.d if you want to modify those.
Once the modifications have been made, you will need to pack it all back up, and repack the files into the ISO file.

mksquashfs ~/isodistro/fs/squashfs-root/* ~/isodistro/fs/filesystem.squashfs -comp xz
mv ~/isodistro/fs/filesystem.squashfs ~/isodistro/iso/live/
mkisofs -o youriso.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -R -V youriso-live ~/isodistro/iso

That will create the ISO file for you, and hopefully you should be able to boot your newly customised GParted distribution !

Share

Jun 142013
 

Not sure if this will be of use to anyone but I’ve decided to release it anyway…

I’ve split RSE2.4 into a directory and an image file.
The directory contains all the boot files that RSE needs to boot up, and the image file is meant to be dd’ed onto a USB stick or Hard drive.
As the image file is a partition, it should be dded onto a partition
e.g.

dd if=RSE2.4.HD.img of=/dev/sda1 bs=1M

The distro itself is the same as RSE 2.4 with the exception that it’s split over 2 devices.

You can download the zip file from here

SHA1SUM –
583ad4e16b0b56d686ddee84af471a67c5103b8f RSE2.4HD.zip
I updated RSE 2.4, so this is the new SHA1 sum
461d595a5eb646da97bd2d751f05d9dcfdf96204 RSE2.4.HD.img

Share

Mar 042013
 

A few people wanted a 1 GB image for Raspbian Server Edition, and I finally got around to putting it together !

It’s the same 2GB image that has been repackaged into a 1GB image.
It has been resized so it should fit any 1GB SD card in existence.

You can Download it here !

SHA1 hash –
74abe17fdea4dc862e0aa6d68a33daa434934cc5 1gbRSEv2.3.img.gz


Please support the continued development of Raspbian Server Edition by donating !




Share

Feb 192013
 

Just finished my first video tutorial !

This will guide you from a fresh install of Raspbian Server Edition all the way through to getting snapshots in your email.

Would love to hear some feedback on this, positive or negative :)

m4s0n501
Share

Feb 142013
 

Version 2.4 has been released. Pick it up here

Overview

Raspbian Server Edition is Raspian with a lot of the GUI and other non-essential utilities stripped out. It’s meant to be used as an easy to deploy base for servers of any kind. It keeps the core of Raspbian with no extra utilities slapped on.

Details

Raspbian Server Edition 2.3 is based on the 2013-02-09 release of Raspbian. Disk usage is down to around 570 megabytes.

I’ve stripped out approx 283 packages in this release. The full list can be found here.

An image is also available for your downloading pleasure.
The tar.gz version can be found here

SHA1 Hash :
5ca2ea00f9378f64d27451e3abd0cc16a984bb80 RSEv2.3.tar.gz


Please support the continued development of Raspbian Server Edition by donating !




Share