Showing posts with label FreeNAS. Show all posts
Showing posts with label FreeNAS. Show all posts

Mar 4, 2015

Freenas 9.2.1 with Transmission and Couchpotato

Freenas 9.2.1 with Transmission and Couchpotato/Sickbeard as a DLNA-Server

I’m going to describe how to set up Freenas with the popular plugins couchpotato and transmissions to use them for downloading movies/series and streaming them via DLNA as well as mounting the storage on Linux.

With this setup, I manage my movie collection and my wanted movies with couchpotato, which uses transmission to download them. I also use Sickbeard to download TV series. Then I can stream them with the DLNA-server to my TV.

I’m running Freenas 9.2.1 on a HP ProLiant G7 MicroServer N54L (affiliate link). Freenas itself is running on a micro-USB stick. I’m not going to describe how to download and install Freenas on the stick, as described in detail in the docs.

Table of contents

Configuration

After starting the server and waiting some minutes, Freenas is available under a web-front end. The URL is a local IP-address, which is shown when Freenas has finished starting. After opening it, you’re presented with the System information.

freenas_systeminformation

See the red alert in the upper right corner? Push it. It says that you need to set a password for the admin-account that you’re using.

Since Freenas 9.2.0 the first time you access the FreeNAS administrative interface, a pop-up window will prompt you to set the root password. You should set a hard to guess password as anyone who knows this password can gain access to the FreeNAS administrative GUI.

Network settings

Next on we have to edit the network settings. Go to network > Global configuration. There you can change the name of your Freenas, set the default gateway, name server and so on. Since I use my server at home, I set the gateway and name server to the address of my router. If you want to, you can enable the netwait feature. If enabled, your server will ping the addresses in the IP list when it starts to check if a network connection is possible.

freenas_network_settings

General settings

There are some more settings that you should know about and edit. Open the System > Settings tab.
If your network is secure and only authorized people join it, you may let the “Protocol” option set to “HTTP”. Generally it is recommended to set it to “HTTPS“.

The next option defines the address and port your Freenas-installation listens to; set it to the IP-address the Freenas currently listens on. Set the HTTP-port to 80 and the HTTPS port to 443. Next on there are specific settings for your language, keyboard map and timezone. Set it according to your preferences.

If you’re not using a syslog server or directory service, leave the last two options empty.

freenas_network_settings_1

Overview of storages and jails

The next steps will include creating storages and jails. To get a better understanding on how these components will work together, my beautiful girlfriend created two diagrams that show how the magic happens.

The first image shows the storages and jails that I created and what jails can access which storages.

freenas_overview



The second image shows the steps that happen, when you want to download a movie or series via couchpotato/sickbeard.

freenas_download_overview

Creating storage devices

Now is the time to add some storage to your server. That is the most important part and you should carefully read the documentation the Freenas community offers. I will not go into detail on what volumes or RAIDs to use. It mainly depends on your needs and what you’ve got hardware-wise.
My use-case is a simple movie- and music-streaming server with no personal or private information saved on it.

To simply create a new empty volume and attach disks to it, open Storage > Volumes > ZFS Volume Manager, give your new volume a name, add your disks and configure the layout.

freenas_volume_manager

Creating datasets

To logically separate your files, e.g. movies from music, you can create datasets. These datasets can have separate permissions, quotas, etc. allowing you more control over your data.

I created datasets for every kind of data I want to manage: movies, series, music, downloads and torrent-files. To create a dataset click on your created storage, then hit the “Create dataset”-button (the one that looks like an excel-document with a plus). There, set the name for the dataset. You can ignore all other options for now, as they are for advanced users.

Changing permissions of the storage

Since there are many plugins and users who want access to your storage, you’ll have to configure the permissions for it. The best way is to set the ownership of the storage to nobody and give read/write/execute permissions to everybody. You should only do this, if you trust the users of your network. To change permissions, click on the “Storage” tab, select the volume you want to edit and click the first button in the bottom line that displays hard disks and a key. There, set the Owner (user) to “nobody”, the Owner (group) to “nogroup” and activate all buttons in the mode. Type of ACL should be set to Unix. Tick the box that says “Set permission recursively” so all other folders and files in the volume will have the same permissions.

freenas_permissions

Adding sharing options

Since I want to access my music and movie collection not only with my TV but also with the computers I’m using, I have to add sharing possibilities. Freenas offers NFS, CIFS and AFP out-of-the-box. I don’t have an Apple-gadget or Windows machine at home, so I’ll only need NFS.

NFS

To add a NFS-share click on Sharing > Unix (NFS) Shares > Add Unix (NFS) Share. There, set the options “Mapall User” and “Mapall Group” to “nobody” and “nogroup” respectively. In the path, add all the storages-directories you want to share. You’ll have to create a separate share for every dataset. When you’re done, you can mount the directories via NFS, the address is the IP-address of your freenas-installation plus the folder you shared, e.g.

192.168.0.102:/mnt/media/movies

Installing the plugins

Installing plugins is very easy, as long as you stick to the available ones provided by Freenas. In the Plugins-menu, click on the plugins and then on Install, to install them. Each plugin is installed into a jail, a separate “operating system” in Freenas itself, but we’ll get to that in the next section.
When you’re done, your plugin-page should look like this:

freenas_plugins

Enabling access to the jails

SSH to your Freenas

You’ll likely need command-line access to your Freenas installation and to the jails as well. To enable SSH access to Freenas, go to Services and click on the screwdriver next to SSH. Tick the “Login as root with password” box and save the settings. After that, enable the SSH-Service by clicking the red OFF-button. Now you’re able to connect to your Freenas with SSH by entering the following line into your terminal-emulator of choice:

ssh root@192.168.0.14

(change the address to the address of your Freenas)
Then enter the admin-password and you should be connected to your box.

Using Putty to enter your Freenas

If you’re on Windows and want to connect to your Freenas-installation using Putty, you have to enter the IP-address of Freenas into the “Host Name”-field, then press “open”.

putty

If Putty cannot connect, you probably didn’t use the correct IP-address or you forgot to enable SSH.

Entering the jails

To enter one of the installed jails, type “jls” on the command-line. There you’ll see the available jails. To connect to them, enter “jexec # tcsh” where # is the number of the jail.

[root@freenas] ~# jls
   JID  IP Address      Hostname                      Path
     1  -               bit_1                         /mnt/media/jails/bit_1
     2  -               couchpotato_1                 /mnt/media/jails/couchpotato_1
     4  -               ownbutt_1                    /mnt/media/jails/ownbutt_1
     8  -               dlna_1                        /mnt/media/jails/dlna_1
[root@freenas] ~# jexec 8 tcsh
root@dlna_1:/ #

Adding storage to the jails

Now we’ll have to add the storage to the plugins, so couchpotato, transmission and the DLNA-server can access the same storage and work together. Since jails are separate systems in the server-OS itself, they cannot by default access other parts of your system.

To add the storage, go to Jails, click the plus next to the plugin, open the “Storage” tab and click “Add storage”. You’ll then have to enter the source and destination addresses. 

The source is the storage or dataset you created in the first place. If you did not create datasets before, you either have to do this now or create normal directories as sources with mkdir on the server.
The destinations are directories in the jails that get mapped to the storages outside the jails.
If the destination addresses in the jails do not exist, tick the “Create directory”-box.
To manually create the directories, enter the jail, then you can create directories with the following command:
mkdir -p /media/downloads

Then enter the following command the get the permissions right:
chmod -R 777 /media/downloads

The following part is really tricky as Transmission, Couchpotato and Sick Beard behave very differently with the directories they download data to. I had to edited the following configuration multiple times, so be sure to stay up to date.
  1. Transmission (bit_1): You need the torrent-directory, where Transmission looks for torrents and the download-directory where it downloads the data to.
    - Download-Source: /mnt/media/downloads
    - Download-Destination: /media/downloads
    
    - Torrent-Source: /mnt/media/torrentfiles
    - Torrent-Destination: /media/torrentfiles
    
    - Series-Source: /mnt/media/series
    - Series-Destination: /media/series
    
    - Movie-Source: /mnt/media/movies
    - Movie-Destination: /media/movies
     
  2. Couchpotato: You need the downloads-directory where transmission puts its data into; you’ll also need the movies-directory, where couchpotato moves the downloaded and renamed movies to.
    - Download-Source: /mnt/media/downloads
    - Download-Destination: /media/downloads
    
    - Movie-Source: /mnt/media/movies
    - Movie-Destination: /media/movies
     
  3. Sickbeard: You need the series-directory where Sickbeard puts its data into; you’ll also need the torrents-directory, where Sickbeard puts the torrent file for Transmission to download them.
    - Series-Source: /mnt/media/series
    - Series-Destination: /media/series
    
    - Torrent-Source: /mnt/media/torrentfiles
    - Torrent-Destination: /media/torrentfiles
    
    - Download-Source: /mnt/media/downloads
    - Download-Destination: /media/downloads
     
  4. MiniDLNA/Plex: You’ll need every directory where files are located that you want to play using DLNA, e.g. movies and series.
    - Movie/Series/Music-Source: /mnt/media/{movies|series|music}
    - Movie/Series/Music-Destination: /media/{movies|series|music}
    

Configuring the plugins

Now that you have added the storage to the plugins, you can finally start them. Go to the Plugins-page and click the red OFF-button of all plugins. After that, they should be listed as on, except for miniDLNA, which we’ll have to configure first, but not now.

You can find the IP-adresses of the plugins here:

freenas_ip_addresses

Transmission

The “watch”-directory where Transmission looks for torrent-files is normally:

/usr/pbi/transmission-amd64/etc/transmission/Downloads

That’s 50 characters and if you add the jail-directory to it, it exceeds Freenas’ directory-length limit of 88 characters, so you have to change this. Open up the Transmission-settings in the Plugins-tab of Freenas and edit the “Watch Directory” to “/media/torrentfiles” and the Download-Directory to “/media/downloads”.

freenas_transmission_settings

Next open the transmission-address in your browser. You’ll see the main interface of Transmission. Click the screwdriver icon in the down left corner to edit the settings. There you’ll see the “download to” option. There should be “/media/downloads” now, too.

transmission_settings

Now we’ll have to connect to the jail of transmission to manually edit a configuration file. Connect via SSH into your Freenas and connect to the jail as described in the chapter “Entering the jails”. Then you’ll have to edit the file, by entering this on the commandline:

edit /usr/pbi/transmission-amd64/etc/transmission/home/settings.json

But first, stop the plugin or else the settings will be overwritten. In the file, scroll down to the end where you can see the configuration-point called “umask”. Replace the “18” with a “0”. Save the file by pressing “escape”, then “leave the editor” and then “save changes”. After that start the plugin.

UPDATE:


HolyK in the Freenas-forums mentioned a great front end for the remote transmission server, transgui. You can find it here or in your favorite package manager. It’s a nice replacement for the rather featureless web front end of transmission. It’s available for Linux and even Windows.

Transmission GUI

After you installed it, point it to the IP address of your transmission-server and then you can see the movies downloading and even add torrent- or magnet-links so they will be downloaded to you Freenas.

Couchpotato

Open the couchpotato-address in your browser. You’ll be greeted with the install wizard. Scroll down to advance in the wizard. Define a user name and password in the General section if you’d like and leave the port to 5050.

In the downloaders section choose Transmission. As host enter the address of your Transmission jail (you can find the address in the jail-section of Freenas). Set the “Directory” to the “Transmission-Destination” you set earlier.

couchpotato_transmission_settings

Scroll further down to “Move & rename the movies after downloading?” (skip the “Are you registered at any of these sites?”-part).

In the “from”-folder set the same folder you just used for the Transmission-directory. The “to”-directory is where the renamed movies will be stored. Set it to the “movie-source” configured in the chapter “Adding storage to the jails”. Tick the “Cleanup”-box so leftover files will be removed after renaming the movies.

couchpotato_rename_settings

After that, scroll further down and click the huge green button and you’re done with the wizard.
On the main page of couchpotato, click the screw-icon in the upper right to get to the configuration-page. There are many things to tweak here, but I’m not going into detail about them. Right now you have to open the “General” Tab, click on “Show advanced settings” and then enter “0777” in the fields “Folder CHMOD” and “File CHMOD” as shown below.

If you do not do this, you probably will be getting an error-message later in Transmission, when downloading files (the download stops at around 4MB)!

couchpotato_advanced_settings_chmod

Sickbeard

Install Sickbeard as usual and open the web interface. Since I currently only load movies with (free) torrents, there are some settings to make.

Open up the “Search Settings” tab in the config-tab.

Disable the search for NZBs and enable the search for torrents. In the Torrent Black Hole” enter the Torrent-Destination “/media/torrentfiles” you configured in the jail-storage and save the changes. It should look like this:

sickbeard_search_settings

Then go to the “Search Providers” tab. There, check the box for “EZRSS” as it is the only free torrent search for series. If you are a member of any other torrent sites listed there, check the boxes for them and enter your credentials for this site. Again save the changes.

Next, go to the “Post Processing” settings.

In the “TV Download Dir”, enter your Series-Destination “/media/downloads” and check the “Scan and Process”-box. You can also edit additional settings on this page but they are not important right now. In the end your settings should probably look like this:

sickbeard_post_process_settings

If you’re done, you can add new or existing shows and let them download!

DLNA

Now you have the choice to either use MiniDLNA or the Plex MediaServer. If you want a nice interface to manage you music and movies, use Plex. If you only need a DLNA-server, use MiniDLNA as it is easy to configure. I’ll describe the installation and configuration for both.

MiniDLNA

Open the Freenas-front end, go to plugins and open the MiniDLNA-configuration. There, set the name of the MiniDLNA-server to anything you like and the Media-directory to the destination set in chapter “Adding storage to the jails”. Leave the other options as they are.

minidlna_settings

The DLNA-server will only scan for new files in its directory on restart, so if you are adding a movie and do not restart the DLNA-server, it won’t be available for streaming. To work around this issue, use the fix described here. After rebooting the DLNA-server should now scan for new files every 5 minutes.

Plex MediaServer

After installing the plugin, open the address of the Plexserver and you’ll be greeted with the End User License Agreement. Agree to it and jump to the “Get Started”-section. You can skip the register as it’s not needed. Leave the settings in “Basic Setup” as they are and go to the next step. There, you can add your music and movie-directories. Click on “add section”, then on “Movies” and insert into the second box your movies-directory. It should look like this:

freenas_plex_add_movies

Do this for your music and series, too.

If you have everything added, jump to the next section. There you can add some channels to use with Plex. I skipped them. Click “Next” and “Done” and your are it..done! Now you should see the dashboard of Plex filling with your movies and music.

DLNA is enabled by default, so you don’t have to do anything in this regard.

Conclusion

Now you are able to download movies with couchpotato and transmission and once they’re downloaded, they are automatically available on you DLNA-server for further streaming.

Mar 3, 2015

How-To Install FreeNAS To USB Drive

FreeNAS is an Open Source Storage Platform based on FreeBSD and supports sharing across Windows, Apple, and UNIX-like systems. It comes with a lot of protocols and services – here are some to mention: CIFS (samba), FTP, NFS, TFTP, AFP, RSYNC, Unison, iSCSI (initiator and target) and UPnP, Software RAID (0,1,5), ZFS, disk encryption, S.M.A.R.T/email monitoring with a WEB configuration interface (from m0n0wall). You can use it to build your own secure network file server to store all your important information on.

FreeNAS can be installed on compact Flash/USB key, hard drive or booted from LiveCD (version 7.x). Personally I like to install it on USB key to keep the software separate from the data on the hard disk. The rest of this article will show you how to do it. At the time of writing the current stable version is 8.0.2. The little graph on the right shown the number of downloads – this is what people download most:


They also have a 32-bit version (FreeNAS-8.0.2-RELEASE-i386.iso) and 64-bit version (FreeNAS-8.0.2-RELEASE-amd64.iso). You should choose 32-bit or 64-bit based on the hardware of the computer you are going to run FreeNAS on:


Download the .iso file from Source Forge and save it to your hard drive, for example in C:\Temp folder.

From here you can do two things:

1. Burn the .iso file to a CD. This will give you a bootable CD from where you can install FreeNAS to a hard drive or USB stick. The older versions (7.x) also had an option to run FreeNAS from the CD without installing it. With version 8.x this option is not available anymore.

2. Extract the embedded version of FreeNAS from the .iso file and write it directly to a USB stick. This is a faster way of getting FreeNAS installed but will not allow you to add additional software later.

In this article we are going to take the second approach. I will provide a separate posting on how to do variant 1 and install Transmission.

Note: As of version 8.0.1-BETA3 the image size increased. The new size requires a 2 GB USB storage device.

Step 1) Extract the FreeNAS image

We need to extract a file from the .iso file. If you already have a tool that can do that go ahead and use it. If not you can install the Daemon Tools Lite which is free for home personal use. Mount the .iso file and extract the FreeNAS_i386_embedded.xz (32-bit version) file. In case you downloaded the 64-bit version the name of the file will be FreeNAS_amd64_embedded.xz. Copy it to your hard disk.

For the rest of the article I will assume we chose the 32-bit version.


The .xz file is a compressed file. Un-compress it and extract FreeNAS_i386_embedded which is the image we have to write to the USB drive.

I use 7-Zip for extracting the files from .xz file. Make sure you use the latest version of 7-Zip. Right-click the FreeNAS_i386_embedded.xz file and choose 7-Zip -> Extract Here. This will extract FreeNAS_i386_embedded file and place it in C:\Temp


Step 2) Prepare the USB key

Plug the USB key in your PC and format the disk as FAT32. Sometimes Windows will not be able to format it (if it was partitioned or formatted with Linux file system for example). In this case you should try a “low-level” format using this tool:

HP USB Disk Storage Format Tool

Step 3) Write the FreeNAS image to USB key

The next step is to download Physdiskwrite from here. It is a ZIP file. Unzip it and copy physdiskwrite.exe and PhysGUI.exe to C:\Temp. Run PhysGUI.exe. It has a graphical interface and will display information about storage devices (hard drives and USB devices:


Remember the Device ID (first column) of your USB stick. Open a command prompt, change the folder to C:\Temp and type:
physdiskwrite -u FreeNAS-i386-embedded
It will list the disks (the same Device ID you got from Physdiskwrite) and will ask you to which of them to write the file. In my case it is drive 1 (type 1 and press)

It will ask you to confirm (press y followed by)


The program will start writing the file and you can see the progress. After it is done you have USB stick with FreeNAS installed on it. To try it reboot your computer and make sure it boots from the USB stick (either change the boot sequence in BIOS or use one of the hot keys during boot to enter the menu where you can select the device to boot from).

Some people are experiencing problems at this step. One suggested solution (thanks Jim) is:
Open a command window as admin (“cmd”)
Type “diskpart” and hit enter.
Type “list disk” and hit enter to find out the number of your drive.
Type “select disk X” (where you replace X with the number of your drive) and hit enter.
Type “clean” and hit enter.
after that go back to your temp folder and then try the process again.

If something goes wrong and you do not get a working FreeNAS on USB stick then try the first method – burn the .ISO file to a CD, boot from the CD and install FreeNAS to USB.

If you decide to go for version 7.x you get bit-torrent client (Transmission). It is missing in 8.0.2 but there are plans to be included in the future versions.

See Roadmap for 8.1

That is all.

Or almost. Probably you could have got the same information elsewhere – in the Google’s age it is hard to be original. Actually some time ago I came across a discussion about whether the blogging was declining. There were several responses in support of this – people were not seeing much sense in re-posting information available in 1000’s other places.

Saying that I would like to thank you for visiting my blog.

Dec 22, 2014

Qnap Firmware Reflash / Recovery

Stuct At Booting When HDD’s Are Not Plugged In

If you cannot access the NAS after Step 3, please do the following:

  1. Turn off the NAS.
  2. Take out all the hard disk drives.
  3. Restart the NAS.
You will hear a beep after pressing the power button, followed by 2 beeps 2 minutes later. If you cannot hear first beep, Please contact your local reseller or distributor for repair or replacement service.

If you cannot Hear the two beeps, and Qnapfinder couldnt find your NAS, the NAS Firmware is Damaged. To fix this problem, please follow “Qnap firmware Recovery / Reflash” Documents for your device model.

If you couldn’t solve problem by yourself, Please contact your local reseller or distributor for repair or replacement service.

If Qnapfinder can find Qnap, fallow these steps;

1 – Download Putty software;

http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

2 – Plug in all of your HDD’s with right order while device is still working. Dont restart Qnap yet. Check if all HDD’s are alright and recognized by Qnap. If any of HDD doesn’t recognized or size seems “0″, plug out that HDD.

3 – Log with putty by entering the Qnap IP / user name / password. (Username / Password: admin / admin. Port need to enter 22.)

Now enter these command down below; (Choose command from this screen and “copy” Then go to putty, just pr “pess right mouse button once. By this way, you can paste commands automatically)

# config_util 1 -> (it must say “mirror of root succeed”. if it gives “mirror of root failed” error, stop this step and request help from Qnapsupport.)

# storage_boot_init 1

# df

If dev/md9 (HDA_ROOT) appears full, please contact QNAP support team

# reboot

Now Qnap should reboot well. If you can reach Qnap interface after restart, check RAID system, and change broken HDD with a new one.