TIL how to check the bandwidth between 2 servers

We subscribed for a dedicated line between 2 datacenters, and when we were trying to copy some files over, it was really slow.
We were supposed to get few MB/s transfer rate, but were getting only 20KB/s which was unacceptable. We needed to make a clear case with the service provider to get their support on fixing this. Simple google searches showed me the tool called iperf, and it provided me what I wanted. It is a shame that I never knew this tool existed.

In the destination server, I ran the iperf server by below command:

.\iperf3.exe -s -p 136 (I only have few ports open in between, and that is not currently in use)

and in the source, I ran the iperf client:

.\iperf3.exe -c <Destination IP> -p 136

The results were enough to convince the service provider to fix their network.

This is probably the most basic test that can be done using the tool, but there are plenty of other options as documented here.

How I recovered an unbootable Linux server hosted in OVH/SoYouStart

My friend has a server hosted in SoYouStart, and suddenly the server went down and nobody knew why. He asked my helped to bring it back online.

We tried to boot into recovery mode from the console, and we were able to login using the credentials sent by them. We were also able to download all the files as a backup. However once we boot normally, the server was still not reachable.

Suspecting its a  bootloader issue, I tried to re install grub, and it worked. This is how I fixed after logging in in the rescue mode.

$ fdisk -l (to find the names of physical drives, something like “/dev/sdxy″ – where x is the drive and y is the root partition.Ours was a RAID setup, so /boot was on /dev/md1, / was on /dev/md2)

$ mount /dev/md2 /mnt (Mount the root partition)
$ mount –bind /dev /mnt/dev
$ mount –bind /proc /mnt/proc
$ mount –bind /sys /mnt/sys

$ chroot /mnt (This will change the root of executables to your your drive that won’t boot)
$ mount /dev/md1 /boot (Mount the boot partition. If /boot is not a separate partition, no need to do this step)
$ grub2-mkconfig -o /boot/grub2/grub.cfg
$ grub2-install /dev/sda (/dev/sda and /dev/sdb were the physical disks, not partitions used in the RAID setup. If it is not a RAID, the you should use the disk where /boot is installed)
$ grub2-install /dev/sdb

Ctrl+D (to exit out of chroot)

$ umount /mnt/dev
$ umount /mnt/proc
$ umount /mnt/sys
$ umount /boot
$ umount /mnt


We finally managed to bring up the server which was down for two weeks. Felt so proud of it.


My experience with RHCE and RHCSA exams

In one word, I can say the following:

RHCSA – Easy

RHCE – Doable

Although I have been using desktop linux , particularly Ubuntu for a while, I never had a chance to do proper system administration. So in a way, I was a fresher. One advantage I had was that I had some domain knowledge on how all these things works, and some things in general. So the terms were not aliens to me.

For exam prep, I did an online course by IPSR, a training institute from India. They claims to have produced the most number of Red Hat professionals in the world. One thing that I can assure is that their training is good. Even if the course is not taken, it is really good to do mock exams using their practice papers.

Coming to the exams, they follow a pattern. RHCSA was 2.5 hours exam, but they were following an exactly similar pattern of questions as that from IPSR’s practice papers. Once you are familiarized with these questions, it is almost 100% chance to pass this exam. In fact, there are people who learn these answers by-heart and pass the exam. There are a lot of model questions that I found online, but most of them wont help for this exam ( They help for real life situations for sure ). I managed to complete the exam in just over an hour, and managed to score 294 out of 300.

Verdict : Simple

For RHCE also, the questions follow a pattern. IPSR’s questions help us familiarize with them too. But unlike RHCSA, the content is huge, and you cant just pass by learning them by heart. You really need to understand the concepts and learn how to apply them. Its a 3.5 hours exam, and it will take you at least 3 hours to finish all.

In my case, I was really confident on the exam, and started doing well. At around 2.5 hour point, I had completed 2/3rd of the questions. But for the next question, I did a huge mistake and messed up the whole partition in my server machine. It was not able to boot up, so I had to start from scratch at that point. My client was still there, so I had to redo everything that I did in the server again. I only managed to reach the 2/3rd point by the end of 3.5 hours.

I thought I would fail, but when the result came, I passed with 232 out of 300. I think it is good to say that dont attempt the question if you dont know. It is better to leave it there rather than messing it up.

Verdict : Doable, but need to do proper time management, and should have enough knowledge on commands and how to read through man pages.

I did the exams on Dec 2016

How to use your Raspberry pi to download movies automatically


  • This is for educational purposes only. Do everything at your own risk. Using bit torrent is not illegal, but downloading copyrighted materials are.
  • Do not use this in a production environment. We are considering zero security in this case.


I see that this post gets a lot of attention. If this works/doesn’t work please let me know in the comment section, or email me at ebin@ebinissac.me.

What we are going to build:

An always on torrent box that periodically checks for new torrents as defined and download them.

What we will be using:

•    Raspberry pi 3 model b with Raspbian Jessie installed.
•    Official raspberry pi 3 PSU as third party PSU’s may not provide enough power
•    External HDD
•    USB fan or heatsink (Recommended, not necessary)

mysetupmy current setup


•    You have vnc / physical access with GUI to your pi
•    You have a user named pi with sudo access (this available by default)
•    You know the password of user pi

Note: We will be doing most of the configurations in a terminal.

1) Install and enable apache webserver
This will help to access the contents over a webserver. Install it by typing

sudo apt-get install apache2

Once installed, start and enable it

sudo systemctl enable apache2
sudo systemctl start apache2

Give everyone full permission to the documentroot. [This is not safe at all in  a production environment.]

sudo chmod 777 /var/www/html

2) Connect the hard disk, create mountpoint and setup automount

•    Connect your hard disk to the pi. Make sure that it works by accessing the contents. If you see a lightning bolt symbol on the top right corner of the screen, that means the pi is not getting enough power to work properly. Use the official PSU in this case.
•    Open a terminal, and see where the hard disk is mounted, by using the following command




In this case, it is mounted in /var/www/html. This will not be your case. It will probably in something like /media/pi/xxx . Whatever it is take note of it. Let us call this value as initial_mount_point

•    Get the block id of the hard disk. Take note of the value starting from UUID


•    Configure fstab so that the hard disk will mount to a certain point after reboot

sudo nano /etc/fstab

• This will open the fstab file in nano text editor in the terminal. Navigate to the end of the line, and type the following

UUID=”xxxxxxxx” /var/www/html ntfs defaults 0 0

Where “xxxxx” is the block id that you got from the previous step.


Type CTRL+O to save and CTRL+X to exit the editor.

•    Unmount the hard disk from initial mount point

sudo umount initial_mount_point

where initial_mount_point is what you got from the first step, which is something like /media/pi/xxxx • Now mount the hard disk to the new mount point.

sudo mount –a

• Verify that it worked by typing the df command. You should get output like this.


3) Install and configure flexget

Felxget will be the tool that we use to download torrent files based on our preferences. The following information is from their website.(https://www.flexget.com/InstallWizard/Linux)
•    Python
FlexGet requires Python 2.7, 3.3 or newer to run. You can check your version with command.

python -V

If it is not available, install it by using the following command in terminal

sudo apt-get install python3.5


Second piece of required software is python package manager called PIP. This can be usually found from operating system package repository under name python-pip or python3-pip. If you install python3-pip it may need to be used via command pip-3.5 or something similar.
Install it by using the following command
sudo apt-get install python-pip5

• Upgrade setuptools

Using latest setuptools will save headaches in some older installations, this can be achieved with
sudo pip install --upgrade setuptools

• Install in a virtualenv

This is the recommended way unless you want multiple accounts in the system to be able to use FlexGet without each having to install it themselves.

Install virtualenv:

sudo pip install virtualenv

Create Virtualenv: This creates isolated python environment. You can create as many of these as you like for each python application you use.

virtualenv ~/flexget/

Install FlexGet in the virtualenv:

cd ~/flexget/
bin/pip install flexget

Create a folder to save the torrent files that are downloaded.

sudo mkdir /home/torrents
sudo chmod 777 /home/torrents

Configure flexget to download torrents automatically

This is the most important and confusing part. Here I am sharing only what I did and found to be working. You can find many other configurations from here and here.

We will configure only to download new Malayalam movies published in extratorrent.cc , English movies published in yts.ag and new episodes of Sherlock from anywhere.

To do that,
Navigate to the install directory

cd ~/flexget

Create a configuration file using nano editor

nano config.yml

Type the following:

  Download Sherlock:
    rss: https://showrss.info/show/269.rss
      – Sherlock
        – 720p
    download: /home/torrents/
  Download movies:
    rss: http://extratorrent.cc/rss.xml?type=search&search=malayalam+2016
        – DVDRip
        – cam
        – 2GB
    download: /home/torrents/
  Download english movies:
    rss: https://yts.ag/rss/2016/720p/all/5
        – yts
    download: /home/torrents/



CTRL+O and CTRL+X to save and exit

Instead of typing the above, you may download my config file from here.

•    Test the configuration
Navigate to the flexget install folder and make it executable

cd ~/flexget/bin
sudo chmod +x flexget

Test the configuration by following command:

./flexget --test execute

If your output is similar to the following, there is something wrong with your config.


If everything is OK, you will get something like this:


Now let us execute flexget to download the torrent files.

./flexget execute

This will download the torrent files to the folder we created earlier, to /home/torrents. Let us verify

ls /home/torrents


There will be a lot of .torrent files. Mine has that .added name because all of them are already completed downloading.

4) Install and configure transmission to download the files using the torrent files already downloaded.

sudo apt-get install transmission-gtk

Open transmission from the start menu


Go to edit-preferences, Set the speed limits you want from Speed tab


In the downloading tab,


In automatically add .torrent files from, select /home/torrents folder Untick show the Torrent Options Dialog Tick Start added torrents In Save to Location, navigate to your hard disk mount point, which is /var/www/html and select the folder you want.


You can leave the other settings as it is, or change it if you need. Now wait a few minutes and you can see that the torrents start downloading.

5) Configure flexget to check for torrents periodically

We will setup flexget to check for new torrents every hour and download it if found. For that, we will use crontab, which is pre installed in the system.

Open crontab by following command:

crontab –e

This will open the crontab file in a text editor. Navigate to the end and add the following lines:

# to run flexget without generating log files
20 * * * *  /home/pi/flexget/bin/./flexget execute

# start transmission-gtk version minimized if it is not already running
*/30 * * * * export DISPLAY=:0 && if pidof -x /usr/bin/transmission-gtk; then exit; else /usr/bin/transmission-gtk -m; fi &

CTRL+O and CTRL+X to save and exit

By now, you have your pi configured to check for new torrents every hour and download it to the hard disk connected to it. In the following steps, we will make it accessible via a web browser or as a network drive.

6) Configure a static ip address to the pi

sudo nano /etc/dhcpcd.conf

Go to the end of the file and add the following:

interface eth0

static ip_address=
static routers=
static domain_name_servers=

interface wlan0

static ip_address=
static routers=
static domain_name_servers=

Here, you need edit based on your needs. My router address is and I set my ip to be


7) Configure apache web server.

We will use the default configuration settings here. To verify it,

sudo  nano /etc/apache2/sites-enabled/000-default.conf

Just make sure that the DocumentRoot is set to be /var/www/html. If it is not, edit it. Mostly there is no need to edit.


Restart the web server

sudo systemctl restart apache2

Verify that it works by going to the webpage from a browser. Note that this device should be connected to your home network. You should be able to access the hard disk contents now.

You will be able to watch videos from your browser.


8) Install and configure samba for using as a network drive

sudo apt-get install samba
sudo nano /etc/samba/smb.conf

This will open samba configuration file in nano. Go to the end of the file and type the following, and save and exit.

  path = /var/www/html/
  public = yes
  read only = yes
  guest ok = yes
  browseable = yes


Enable and restart samba.

sudo systemctl enable smbd
sudo systemctl restart smbd

Now you can map this as a network drive in your windows PC. To do this in windows 10, right click My PC, then click Map network drive.


Enter the ip address and share name as follows. Share name is movies as we configured earlier. Check connect using different credentials. Enter username as pi and the password to connect.


You should have it connected as a drive now.