Saturday, December 26, 2015

Running Deluge in a Finch jail and fixing Socks5 proxy

I wanted to run a Socks5 proxy on my NAS4Free machine, but I found out that Transmission can't do that. There are some alternatives and I chose Deluge to do the job. In this post I will show you how to get Deluge started in a jail and more importantly how to get Socks 5 running.

First I disabled the bittorent service in NAS4Free.
Then I created a new jail following these instructions: Jails-how-to




And then I added Deluge to the jail following this: [HOWTO] Install Deluge in Finch / Qjail.
All in all this went rather smoothly. I can access Deluge from the browser with a webclient using IP:8112 (in my case http://192.168.0.252:8112). I'm using this checkMyTorrentIp.png.torrent to see if I'm using my actual IP or the proxy IP. At the moment I'm using my actual IP as I didn't setup a proxy yet.


Alternatively you can install Deluge in Windows. Uncheck Classic Mode in interface, restart Deluge and choose the Deluge daemon on your NAS box:


Next I setup the proxy. Choose preferences. Choose proxy. And fill out the proxy settings:


Choose apply and now the IP address in checkmytorrentip.net should show the proxy IP. Which in my case didn't. To overcome this I had to change the config.

First I saw that after starting deluge on NAS4Free I received an error:  
/usr/local/etc/rc.d/deluged start
..
RuntimeError: Protocol not supported
 
To fix this error, do /usr/local/etc/rc.d/deluged stop and do /usr/local/etc/rc.d/delug_web stop
Now edit /usr/local/deluge/.config/deluge/core.conf and change and save.
"listen_interface": "", --> "listen_interface": "",

Second remove /usr/local/deluge/.config/deluge/session.state

Now /usr/local/etc/rc.d/deluged start and in checkmytorrentip.net should show the proxy IP.





Saturday, January 10, 2015

Normalize ac3 in MKV container

A few of my home videos have a really low volume sound. I couldn't find a good solution to achieve a louder video, so I worked out a solution by combining different tools to do the work.

So I start with a MKV container which has video in AVC and audio in AC-3 format. The goal is a new MKV container with audio in AC-3 in a higher volume. For instance the file below (filename AV200011.B,mkv).


I will show the following steps:


1. In VirtualDub with mkv plugin and ac3 decoder extract ac3 audio stream as wav using full processing mode
2. In VirtualDub extract video as avi using direct stream copy
3. In Audacity load wav file and normalize it
4. In Audacity with FFmpeg to new ac3 file
5. In MKVToolNix GUI merge video from step 2 and audio from step 4 to new mkv container


1. Extract audio

First download and install Virtualdub (I used VirtualDub 1.10.4) and install the Matroska plugin by copying the plugin to the plugins32 folder. Then install an ac3 decoder called AC3ACM by running the 'Install the 32-bit codec.bat'. Open VirtualDub and do File|Open video file and load the mkv container.


Do Audio|Full processing mode and leave other options. Now choose File|Save WAV...


2. Extract video
In Virtualdub extract video as avi using direct stream copy. Now choose Audio|No audio and Video|Direct stream copy. File|Save as AVI...



3. Normalize audio
 Download and install Audacity (I used Audacity 2.0.6). Then install FFmpeg. To do this open Audacity and choose Edit|Preferences... and choose Libraries. Click Download and install FFmpeg.


Now in Audacity load wav file and do Effect|Normalize it.
Before:



After:



4. Export wav to ac3
In Audacity with ffmpeg export wav to new ac3 file

5. Remux (merge) MKV
In MKVToolNix GUI merge video from step 2 and audio from step 4 to new mkv container

Done!




Thursday, December 26, 2013

Mining rig is running

During Christmas I left my machine running. I was mining for Litecoins (LTC) at wemineltc.com, but I switched to mining for Florin (FLO) at bitezzeming.com. I had a look at the profitability of the different altcoins. I looked at coinchoose.com and picked Florin (FLO) with a 263% profitability over LTC (at 25/12/2013). I may have a flawed theory, but this is my view of it with a hashrate of 740 Kh/s. Correct me if I'm wrong.

Mining LTC:  0.24 Litecoins/day
Mining FLO:  600 Florin/day (1 FLO = 0.001 LTC) is about 0.6 Litecoins/day

Pic
This is a picture of my computer. The case stays open.


And my statistics for the last hours.


The hashrate averages around 0.78 Mh/s with a max of 1.06 Mh/s. The temperature averages around 68.24 Celcius with a max of 70.97 Celsius.

Stablecoin
I tried to do the math again for Stablecoin (SBC) with a 450% profitability over LTC (estimated).

Mining LTC:  0.24 Litecoins/day
Mining SBC:  371 Stablecoins/day (1 SBC = 0.003 LTC) is about 1.1 Litecoins/day

I switched to mining SBC on pool sbc.cryptoculture.net but I found out that mining SBC is very slow at a rate of 10 SBC/hour. So I switched back to FLO for now.

Tuesday, December 24, 2013

Added second GPU and took it out again

I added a second GPU (SAPPHIRE HD 5770 1GB GDDR5 PCIE) as GPU1:


Hashrate is still too low for both cards. Target hashrates are 720 Kh/s for GPU0 (7970) and 200 Kh/s for GPU1 (5770).

Different configurations
After trying out a few cgminer.conf configurations. The system became suddenly very unstable, but with much higher hashrates. I had to do something to resolve this.

Taken GPU1 out again
But I was afraid the PSU was going to be overloaded, so I removed GPU1. Now I'm back to the old hardware setup, hence with this config:

The only difference with the previous config is: gpu-threads: 2 (this is the same as the commandline option -g 2). So the 7970 card needs a different value for gpu-threads than the 5770 card. The effect is a really improved hashrate (see next picture).

So this is really nice. Now one GPU has a higher hashrate than two GPUs earlier. But I do want to have the second GPU installed as well. So I will replace the PSU first in the next post.




Starting a Litecoin mining rig

For mining purpose I built a rig with the following hardware components:

CPU: Intel i3-530 socket 1156
Motherboard: Gigabyte GA-H55M-UD2H
Memory: 4GB DDR3 Dell
Harddisk: Bootable USB stick 2GB
PSU: Recom PE-M500
GPU: GV-R797TO-3GD

I followed both these instructions: Rumorscity Rig and Rumorscity BAMT. So the software I'm using is: litecoinbamt1.2.zip. Below is the current working setup with a hashrate of 580 Kh/s (0.58 Mh/s).



I used  the following cgminer config (screencopy):


The hashrate should be around 720 Kh/s and also the PSU is just enough, but I want to add an extra R5770 card. So in the following posts I will try to figure out how to get there.


Thursday, December 6, 2012

Switching from FreeNAS to ZFS Mirror on NAS4Free

My FreeNAS server has been running without problems for almost 3 years now. Although I put in another CPU and PSU, overall the machine is still the same. The server consists now of the following components:

CPU: AMD Sempron(tm) Processor LE-1200
Motherboard: ASUS M3N78-EMH HDMI AM2+/AM2 NVIDIA GeForce 8200 Micro ATX
Memory: 1GB Kingston (kit of 2x512MB) KHX6400D2LLK2_1G & 1GB Geil module
Harddisk: 1TB Samsung HD103UJ
PSU: Silentmaxx MX460

It is still scheduled to start at 10:30 and stop at 23:30 to save costs of electricity.

NAS4Free:
But I realised that with one harddisk, all my data would be gone if it fails. So I started reading about different possibilities for a redundant setup. The first thing that I needed to do, was to update the software. Currently running FreeNAS 0.7 to be updated to either FreeNAS 8 of NAS4Free. So I started up VirtualBox and installed FreeNAS 8. I really tried, but I didn't like the user interface and chose NAS4Free.

Redundant harddisks setup:
I decided to use ZFS, but before setting up the new system with NAS4Free, I tested it with VirtualBox running 64 bits NAS4Free. The setups for ZFS RAID Z1 (similar to Raid-5) and ZFS Mirror (similar to Raid-1) are similar. Below I show the setup for ZFS RAID Z1.

Setup in VirtualBox:
To be able to run NAS4Free in VirtualBox, I created a small virtual harddisk of 512 MB (NAS4Free.vdi)) that holds the embedded OS and functions as USB stick (of CF Card) and 3 virtual harddisks with a size of 2 GB (NAS4Free.Disk1 etc). This is the configuration for the disks:


For Network I used the Host-only adapter, but you need to  make sure you configure your network settings for Adapter and DHCP server correctly in File/Preferences, Network. Both need to be in the same subnet.



And for DHCP server:



The rest of the settings should be self-explanatory. This is the screen after starting the Virtual Machine with NAS4Free:




Setting up ZFS RAID-Z:
Prerequisites: three harddisks of same size.
Three disks were created and named Disk1, Disk2 and Disk3. All disks were formatted as a ZFS Storage pool device. If you get error messages like "error code 1", you can try to select NTFS instead of unformatted when adding the disks in Disks | Management and then try again to format the disk with ZFS. It worked for me.


To create a ZFS Pool, select Disks/ZFS and then Pools/Virtual Devices and add new device and select all disks and name the device ZFS2. Automatically a mount point is established with the same name as your virtual device. So you don't have to create a seperate mount point.



Next select Disk/ZFS, Pools/Management and add new device and select ZFS2 from the previous step and apply the new setup:


At this moment I can start using the ZFS RAID Z. It is possible to use FTP or Shares to read and write files. Three disks with 2GB result in 4GB of free space. If one disk fails the data is still intact. To test this, I put some files on NAS4Free. Then NAS4Free was shutdown and I removed one random disk (Disk3) from the storage settings in VirtualBox. After starting the NAS4Free again, the result is a running configuration with Health status DEGRADED:


After shutdown, add a new disk in Storage in VirtualBox (Disk4):


Start NAS4Free and choose Disks | ZFS | Pools | Tools and replace ada3 with the new disk on the same port. Don't touch the disks in de Disks Management.


The status changes now from DEGRADED to ONLINE after the array is resilvered (all disks are up to date). The disk is replaced. Now you can Clear config and Import disks in Disks | Management.

Expanding RAID:
It isn't possible to dynamically add new disks to an existing pool to get more space. But it is possible to replace existing disks with bigger ones. For instance if you have a ZFS Mirror with 2 x 1TB disks, you can expand your disk space by replacing both with 2TB disks. As an example I updated ZFS2 with 4GB disk space and 3 2GB disks to 6GB disk space and 3 4GB disks, by replacing one disks at the time. After the final disk is replaced and the array is resilvered, then Clear config and Import disks in Disks | Management and reboot NAS4Free and the size is updated:


For me it's clear. Although my budget will allow only for 2 disks of 1TB at the moment, I will be able to expand it's size in the future. With 2 disks I choose a ZFS Mirror configuration which is running happily at the moment.














Saturday, January 16, 2010

Howto: Create 'LiveCD' (ISO) file of FreeNAS

1. Presentation

I'm using the embedded version of FreeNAS that I'm starting from an 512Kb USB-stick. I found out that you can install packages with the LiveCD full install, but ofcourse not with the embedded version.

Last December (27/12/2009) I wanted to have an upgrade of my Transmission package in FreeNAS. The latest build contained Transmisson 1.72 and I wanted to upgrade to Transmission 1.76. At that time the latest stable version was 0.7 (from 6/11/2009) and the latest nightly build was version 0.7.1 (from 15/12/2009). Due to the openness of the FreeNAS project (many credits to the FreeNAS team) I thought that it shouldn't be too hard to make my own build.

It took some time, but I got it working. Although when I finished the new nightly build already contained Transmission 1.76 (FreeNAS 0.7RC2 from 5/1/2010). Yet I wrote this howto which may help others.

For this howto first looks at parts of http://freenas.org/documentation:howto:installing_freebsd_under_qemu_for_compiling_freenas by Oliver. Especially these sections are useful: Section 4. FreeBSD Installation and 5. Finalising installation. I will recap sections 4 and 5 and will continue where section 6. Compiling FreeNAS left of.

2. Recap FreeBSD Installation
Download and Install FreeBSD 7.2 and select the express install option.

When finished install the following packages: bash, cdrtools, subversion and portupgrade. You need cdrtools to be able to run the sysutil mkisofs and you need subversion to retrieve the sources.

Login with root rights and type: sysinstall.

Now choose Configure and select Packages:

 
And choose your installation medium (1 CD/DVD).



Now select the necessary packages. Choose bash, cdrtools, subversion and portupgrade like below.

Now install the packages.

3. Compiling FreeNAS

3.1 Getting the sources
Login with root rights and do the following commands to get the sources.

mkdir /usr/local/freenas
cd /usr/local/freenas
svn co https://freenas.svn.sourceforge.net/svnroot/freenas/branches/0.7 svn

We choose the 0.7 branch which contains the latest updates. The trunk tree is too experimental and doesn't compile at the moment. When subversion finishes do the following commands.

cd /usr/local/freenas/svn/build
./make.sh

The following compilation menu is presented. You can select menu item 2 - Build system from scratch.

3.2 Build system from scratch

Start with 1 - Update source tree and ports collection. Choose cvsup and wait as the source tree for the kernel is checked out (this may take some time).


And wait until the checkout has finished succesfully.


Now do the same with freebsd-update, portsnap and portupgrade.

After this choose 2 – Create filesystem structure and 3 - Build kernel and process prebuild, build and install. With prebuild choose all kernel patches. Then choose 4 - Build world.

Leave the menu and  run the command: portsnap extract. Now select menu item 5 - Build ports, however I encountered the following failed ports, which you may need to deselect: inadyn-mt, rsync, scponly. Edit 11/1/2010: The failed ports have been resolved by the FreeNAS team now.

Now install ports and also deselect the failed ports. Continue choosing 6 - Build bootloader and 7 - Add necessary libraries and 8 - Modify file permissions. Then choose * - Quit and go back to the main menu.


3.3  Create 'LiveCD' (ISO) file
Now the system building is finished. From the menu choose 11 Create 'LiveCD' (ISO) file.

In the directory /usr/local/freenas there are two new files now. The FreeNAS-i386-LiveCD.. and FreeNAS-i386-embedded... files. The LiveCD file can be used as an image or can be burned on a CD and the embedded file can be used in FreeNAS under System|Firmware to upload and use as new version to run your FreeNAS server.

NAS/FreeNAS running for a year now

My NAS server has been running for a year now. The system is build into a modded case with a green radioactive logo (see below). These are the other hardware components:

CPU: AMD Sempron(tm) Processor LE-1300
Motherboard: ASUS M3N78-VM AM2+/AM2 NVIDIA GeForce 8200 HDMI Micro ATX
Memory: 1GB Kingston (kit of 2x512MB) KHX6400D2LLK2_1G
Harddisk: 1TB Samsung HD103UJ
PSU: standard noname 350W

The power usage is on average 56 Watt. It is configured with Wake-On-Lan and it is additionally scheduled to start at 10:30 and stop at 23:30 to save costs of electricity.

I have installed FreeNAS and the system boots from a 128KB usb-stick. This is the latest welcome screen.



Thursday, January 15, 2009

NAS-server based on Windows Home Server

A friend asked me to assemble a NAS-server and install WHS on it. Below is the hardware I used for this. At first I wanted to buy a Chenbro case with mini-ITX (ES34069) but I finally decided to buy the Antec NSK1380 case. I wanted to be more flexible and chose a micro-ATX system. Now this friend has the option to turn the system into a media center. So this is the list.

Case: Antec NSK1380
CPU: AMD Sempron LE-1200 2.1 GHz EE 45W AM2
Motherboard: GA-MA78GM-S2H
Memory: 1 x 1GB 667 MHz DDR2 Geil (1 module) (IAIE8F)
Harddisk: 2 x WD 1TB Sata II 7200 rpm 16MB Caviar GP (WD10EACS)
PSU: Antec 380W 80plus (custom)
CDROM: Samsung DVD writer sh-s202

The Antec NSK1380 case is a very comfortable case and comes with PSU. This is the case. The dimensions are 33.5x20x26.9 (DxWxH) (in cm).


There is room for three 3.5 inch drives and an external 5.25 inch drive on a removable cage.


So I put one 3.5 inch drive vertical on the left and one below. The picture has the cage upside down.


Next is putting everything together in the case.



The sidepanels are made of three layers: aluminum, plastic and aluminum. The sidepanels are detachable which is really nice. So I can do a little cable management. Also there is an extra expansion slot fan (on the left).

Next step is booting the system and installing WHS as can be seen below.


The hardware part was piece of cake. The server is running idle about 69 watt. Next stop is the software part ie configuring WHS.

FreeNAS as before

I put back my samsung hd103uj 1TB drive into the file server. I'm glad I did that. With one disk instead of three the box is not running hot anymore and the power consumption is better.

This is the disk setup in freeNAS:


And the disk status:



For now I will keep using freeNAS mainly for its ultra light setup. So this will be the system I will be using myself. Next I will describe building a NAS-server that will run Windows Home Server, but that one is not for myself.

Tuesday, January 13, 2009

FreeNAS with raid-5

The previous setup was working fine. But today I acquired a third 250GB drive. So I'm going to give a raid5 setup a try. Why? Because I'm curious and I'm wondering whether there is a cpu-penalty when running a software raid5 in freenas.

So I took out the 1TB samsung drive and built these three harddisk in:

hd0: maxtor diamondmax 10 6V260F0 sataII NCQ (jumper on sataI)
hd1: maxtor diamondmax 10 6V260F0 sataII NCQ (jumper on sataI)
hd2: maxtor diamondmax 10 6L250S0 sataI

In freeNAS I configured a raid5 with 3 drives formatted in softraid. I takes a while to rebuild the array. But the current status is complete see below.
Software RAID information and status
Geom name: CherRaid5
State: COMPLETE CALM
Status: Total=3, Online=3
Type: AUTOMATIC
Pending: (wqp 0 // 0)
Stripesize: 131072
MemUse: 378880 (msl 9)
Newest: -1
ID: 1726283426
Providers:
1. Name: raid5/CherRaid5
Mediasize: 501998157824 (468G)
Sectorsize: 512
Mode: r1w1e2
Consumers:
1. Name: ad10
Mediasize: 251000193024 (234G)
Sectorsize: 512
Mode: r2w2e3
DiskNo: 0
Error: No
2. Name: ad8
Mediasize: 251000193024 (234G)
Sectorsize: 512
Mode: r2w2e3
DiskNo: 2
Error: No
3. Name: ad6
Mediasize: 250999111168 (234G)
Sectorsize: 512
Mode: r2w2e3
DiskNo: 1
Error: No
So three drives with 234GB results in 468GB of free space. When writing files on the NAS the cpu load is the same as before around 20%.

But a new issue had come up --> temperatures are rising. The disk temperatures are rising above 40 degrees celsius. So I put an extra 12cm fan in the case but temperatures are still too high about 35 degrees celsius. Also the power consumption has risen to about 95 Watt.

Data safety is nice, but I'm probably going to put the samsung drive back.

Setup Stalker NAS-server

This is the final setup in terms of hardware components:

CPU: Intel C2D E8400@3.00GHz
Motherboard: Gigabyte GA-G33M-S2H
Memory: 1GB Kingston (kit of 2x512MB) KHX6400D2LLK2_1G
Harddisk: 1TB Samsung HD103UJ
PSU: standard noname 350W
Lights: 2x15cm CCFL UV-green
CDROM: LITE-ON DVDRW SHM-165H6S/HQSA

This build will be running as a NAS-server. Although the cpu is too heavy for this purpose, I'm still using it that way. Maybe I'll change it in the future.

I have installed freeNAS and the system boots from a 128KB usb-stick. This is the welcome screen.

This configuration uses between 68 and 71 watts when running idle.

At first the power saving features were not enabled. For that I opened a ssh-shell with the following command:

Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
The Regents of the University of California. All rights reserved.

Welcome to FreeNAS!

> sysctl -a | egrep -i 'dev.cpu.0.freq'
dev.cpu.0.freq: 2988
dev.cpu.0.freq_levels: 2988/-1 2614/-1 2241/-1 1867/-1 1494/-1 1120/-1 747/-1 373/-1
>


To enable power saving I added the option powerd_enable YES to the System|Advanced|rc.conf configuration. This is the result. The power consumption remains the same (?).

Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
The Regents of the University of California. All rights reserved.

Welcome to FreeNAS!

> sysctl -a | egrep -i 'dev.cpu.0.freq'
dev.cpu.0.freq: 373
dev.cpu.0.freq_levels: 2988/-1 2614/-1 2241/-1 1867/-1 1494/-1 1120/-1 747/-1 373/-1
>

Initially I transferred my harddisk from window xp to freeNAS. The disk was formatted with NTFS and contained some files. So I started using freeNAS without reformatting the drive as I assumed this wouldn't give me any problem. I was wrong after each reboot the NTFS partition forgets newly written files and produces errors. I put the harddisk back into my xp-machine and ran chkdsk and tried it again. But no luck. The only way to be sure your data stays intact with freeNAS is to use it with its own native filesystem UFS.

This is the final look.




Sunday, December 28, 2008

Plasma cutting

A plasma cutter uses a compressor and blows air through an air-pistol. An electrical current ignites the air and burns a hole through the metal. I made a short movie with my dv-camera and took some stills from it as you can see below.


And this is the end-result. Really rough around the edges and really ugly.