Mirkotiks configuration backup and more

Posted on Leave a commentPosted in IT

I am using self developed tool for backup puproses. It is still in development but main feature is done – its processing list of ip addresses and saves configuration into text file. Also it saves files, stored on Mikroitk. I use it with –multy arg, so it is done in parallel mode (all hosts at once)


It demands Paramiko to be installed:

pip install paramiko

There are a lot of ideas I want to implement, some bugs to fix and a lot of other staff still to do.

Debian partition extending

Posted on Leave a commentPosted in IT

GUI (Ubuntu 14.04 and later): GParted v0.17 and later provide a nice GUI for this. (Older versions will refuse to resize a mounted partition).

Command line (any Ubuntu version): There are three steps to this.

Step 1. The partition must first be resized. If you’re using LVM, it’s easy, and you presumably know how to proceed. If you’re using classic partitions, it’s a bit more complicated, and may require a reboot (though you never have to boot another system or live CD).

This is how I do it: Use fdisk to first delete the partition, then carefully recreate it with a larger size at the same position.


$ sudo fdisk /dev/sda

Command (m for help): p

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     9437183     4717568   83  Linux

Command (m for help): d
Selected partition 1

Command (m for help): p

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
Partition number (1-4, default 1): 1
First sector (2048-10485759, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-10485759, default 10485759):
Using default value 10485759

Command (m for help): p

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    10485759     5241856   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

Again, it is critical that the new partition starts at the same block as the old. The Id should also match (83 for Linux systems). Be prepared to lose all your data at the slightest typo.

To be on the safe side, you may also restore the boot flag (which according to Wikipedia is still required on some computers) by pressing a.

See the comment section for what to do if your swap partition is in the way.

By now it should be apparent why people recommend using a live CD. 😉

Step 2. As fdisk helpfully reminds you, you must reload the partition table before proceeding. The safest way is to simply reboot; but you can also use partprobe or kpartx (more information).

Step 3. Once the partition is resized and the partition table reloaded, it’s a simple matter of running resize2fs on the file system, and you can do this even when it’s mounted as the root partition.


$ sudo resize2fs /dev/sda1



Deleting tunnel interface

Posted on Leave a commentPosted in IT

If you want to remove an ip address simply use del instead of `add.

So ip addr del dev tun2 to remove an IP. But since you want to remove the interface that doesn’t really matter.

To remove an tun* interface simply use ip link del name or in your case ip link delete tun2.

Source: http://superuser.com/questions/603344/openvpn-usage-how-to-modify-ip-address-and-how-to-remove-a-tun-interface


Debian 8 fresh Chef installation error

Posted on Leave a commentPosted in IT

Missing folder under debian 8 jessie, Error output:

Recipe: enterprise::runit_systemd
  * template[/usr/lib/systemd/system/private_chef-runsvdir-start.service] action create
    * Parent directory /usr/lib/systemd/system does not exist.
    Error executing action `create` on resource 'template[/usr/lib/systemd/system/private_chef-runsvdir-start.service]'

    Parent directory /usr/lib/systemd/system does not exist.

Just a small issue with a fresh install under Debian 8.
The folder /usr/lib/systemd/system does not necessary exist on a fresh install of Debian and there is an error in the receipe : /opt/opscode/embedded/cookbooks/cache/cookbooks/enterprise/recipes/runit_systemd.rb

Just creating the folder manually fix the problem :

mkdir /usr/lib/systemd/system




PS: for most cases solo will be enough:

curl https://www.opscode.com/chef/install.sh | sudo bash

Configuring IP-IP tunnel between two linux VPS

Posted on Leave a commentPosted in IT


ip tunnel add tun0 mode ipip remote a.a.a.a local b.b.b.b dev eth0
ifconfig tun0 netmask pointopoint
ifconfig tun0 mtu 1500 up


ip tunnel add tun1 mode ipip remote b.b.b.b local a.a.a.a dev eth0
ifconfig tun1 netmask pointopoint
ifconfig tun1 mtu 1500 up


PS: don`t forget to secure data, that will be unencrypted tunnel