Make Software Raid on Existing GTP LVM

Do NOT use “consumer grade” drives to create your array, use “server grade” drives!

larger disks have a higher data density on the platter’s surface, the chance for failure is higher.

apt-get install initramfs-tools mdadm


cat /proc/mdstat
Personalities : [linear] [multipath] [raid1] [raid0] [raid6] [raid5] [raid4] [raid10]
unused devices:

GPT fdisk (consisting of the gdisk, cgdisk, sgdisk, and fixparts programs) is a set of text-mode partitioning tools for Linux, FreeBSD, Mac OS X, and Windows.
sudo apt-get install gdisk

Copy sdb’s partition to sda and change guid
sgdisk -R /dev/sdb /dev/sda
sgdisk -G /dev/sdb
mkfs -t fat /dev/sdb1
mkfs -t ext2 /dev/sdb1

delete old raids
mdadm –zero-superblock /dev/sdb1
mdadm –zero-superblock /dev/sdb2
mdadm –zero-superblock /dev/sdb3

create our RAID arrays /dev/md0, /dev/md1, and /dev/md2.
mdadm –create /dev/md0 –level=1 –raid-disks=2 missing /dev/sdb1
mdadm –create /dev/md1 –level=1 –raid-disks=2 missing /dev/sdb2
mdadm –create /dev/md2 –level=1 –raid-disks=2 missing /dev/sdb3

cat /proc/mdstat
We have three degraded RAID arrays ([_U] or [U_] means that an array is degraded while [UU] means that the array is ok)

apt-get install exfat-fuse exfat-utils
mkfs.vfat -F 32 /dev/md0
mkfs.ext2 /dev/md1

Use the pvcreate command to initialize a block device to be used as a physical volume. for example :pvcreate /dev/sdd1 /dev/sde1 /dev/sdf1
pvcreate /dev/md2
dd /dev/md2 to our volume group cernet-szu-cetyp-vg
vgextend cernet-szu-cetyp-vg /dev/md2
Rove bad or missing volumne
vgreduce –removemissing –force cernet-szu-cetyp-vg

Reformat /dev/sdb1 to FAT32
mdadm –detail /dev/md0
mdadm –zero-superblock /dev/sdb1
mkfs.vfat -F 32 /dev/sdb1
mdadm –create /dev/md0 –level=1 –raid-disks=2 missing /dev/sdb1
mkfs.vfat -F 32 /dev/md0

cp /etc/mdadm/mdadm.conf /etc/mdadm/mdadm.conf_orig
mdadm –examine –scan >> /etc/mdadm/mdadm.conf

blkid /dev/sda1
/dev/sda1: UUID=”4CD7-9220″ TYPE=”vfat”
blkid /dev/sda2
/dev/sda2: UUID=”03cebd54-1248-47ed-971d-79d2d6e464a7″ TYPE=”ext2″
Replace /dev/sda1 with /dev/md0 in /etc/fstab.
replace /dev/sda1,/dev/sda2 with /dev/md0 ,/dev/md1 in /etc/mtab

To move the contents of our LVM partition /dev/sda2 to our LVM RAID array /dev/md2
pvmove /dev/sda3:0-715174 /dev/md1
vgreduce cernet-szu-cetyp-vg /dev/sda3
pvremove /dev/sda3

mdadm –add /dev/md2 /dev/sda3

mkdir /mnt/md1
mount /dev/md1 /mnt/md1
cd /boot
cp -dpRx . /mnt/md1

mkdir /mnt/efi
mount /dev/sda /mnt/efi
cd /mnt/efi
cp -dpRx . /mnt/md1

mdadm –add /dev/md0 /dev/sda1
mdadm –add /dev/md1 /dev/sda2

cp /etc/mdadm/mdadm.conf_orig /etc/mdadm/mdadm.conf
mdadm –examine –scan >> /etc/mdadm/mdadm.conf


Huawei E173 3G Modem & Chan-Dongle for Asterisk 13

Huawei E1691 Specifications: AWS 1700/2100; GSM 1900/1800/900/850 MHz

lsusb: Bus 002 Device 003: ID 12d1:1446 Huawei Technologies Co., Ltd. Broadband stick (modem on)
sudo apt-get install usb-modeswitch
Edit /etc/usb_modeswitch.conf
# Huawei E1692
DefaultVendor= 0x12d1
DefaultProduct= 0x1446

TargetVendor= 0x12d1
TargetProduct= 0x140c



sudo usb_modeswitch -I -W -c /etc/usb_modeswitch.conf
found USB ID 12d1:140c
vendor ID matched
product ID matched

Found target device, open it

Found target device 004 on bus 002

Target device description data
Manufacturer: HUAWEI Technology
Product: HUAWEI Mobile
Serial No.: not provided
Found correct target device

Mode switch succeeded. Bye!
lsusb: Bus 002 Device 004: ID 12d1:140c Huawei Technologies Co., Ltd. E180v

USB device 12d1:140c is handled in recent kernels by the option driver.

Usage of chan_dongle in Asterisk


Edit: dongle.conf

module load

chan_dongle CLI commands and dialplan howto: chan-dongle-use

layer-3 IP-in-SSH tunnelling

TCP traffic is passed through an another TCP protocol. The packets are double “acknowledged” by the 2-layer of TCPs. Better protocols are built on UDP or even IP.If you already have access to an SSH server, it’s much easier to use it as an SSH tunnel than it is to set up a VPN server. For this reason, SSH tunnels have been dubbed a “poor man’s VPN.”

How to set up an SSH VPN:You must be using OpenSSH version 4.3 or later to do this,You also need to have installed uml-utilities on the “calling” machine.

TUN is used with routing, while TAP is used for creating a network bridge.

ON A: Edit /etc/ssh/sshd_config,PermitTunnel yes, PermitRootLogin yes,service sshd reload
sudo apt-get install uml-utilities ## once
sudo tunctl -u $USER
sudo ssh -NTCf -w 1:1 # -w local:remote tun

ip link set tun1 up
ip addr add peer dev tun1
sudo arp -sD eth0 pub
####Networ setting
iface tun0 inet static
pre-up sleep 5
up arp -sD venet0:0 pub
ip link set tun1 up
ip addr add peer dev tun1
ip route add via

//how to disable isp dns server
check your /etc/dhcp/dhclient.conf
don’t request dns-nameservers
add domain-name-servers x.x.x.x
update your /etc/network/interfaces
auto eth0
iface eth0 inet dhcp
dns-nameservers dnsserverip
check file /etc/resolvconf/resolv.conf.d/base
#sudo ifdown -a & sudo ifup -a
# sudo resolvconf -u

isc_stdio_open ‘/var/log/bind9/query.log’ failed: permission denied
This is caused by “AppArmor” which is like SE Linux.
Edit /etc/apparmor.d/usr.sbin.named
/var/log/bind9/ rw,
#sudo apparmor_parser -r /etc/apparmor.d/usr.sbin.named

Installing CUPS on the Pi and Enabling Remote Access

sudo apt-get install cups
sudo usermod -a -G lpadmin pi

sudo nano /etc/cups/cupsd.conf

# Only listen for connections from the local machine
# Listen localhost:631
Port 631

< Location / >
# Restrict access to the server...
Order allow,deny
Allow @local
< /Location >

< Location /admin >
# Restrict access to the admin pages...
Order allow,deny
Allow @local
< /Location >

< Location /admin/conf >
AuthType Default
Require user @SYSTEM

# Restrict access to the configuration files...
Order allow,deny
Allow @local
< /Location >

sudo /etc/init.d/cups restart

navigate to http://[the Pi’s IP or hostname]:631
Click “Administration” tab. Add a printer and share it.

Install the new hp driver by this way.
and run hp-setup to install plugin

Network Booting (PXE)

PXE (Pre eXecution Environment), is a method of having an end computer (client) boot using only its network card.

When using network boot solution, the boot process will be changed from the normal order to:
Power on -> BIOS -> PXE stack built-in the NIC (Network Information Center) -> NBP (Network Boot Program) downloading from server to client’s RAM by TFTP -> NBP’s responsibility to perform the next step

Client machine must support PXE booting, and you need a fast file server.

FOG is a free, open source computer cloning solution. It supports Linux net boot.

CCBoot supports install windows 7 via pxe boot.

We also boot windows without local hard drive.



Remote Desktop


This kind of vps is cheap. Some don’t have IPV6 support, so I can build a HE tunnel.

Is easy to install XFCE destop and install x2go server and using the destop over slow intenet.

Ubuntu 14.04

sudo apt-get update
sudo apt-get install xrdp
sudo apt-get install xfce4
# Install XFCE4 terminal (way better than xterm)
sudo apt-get install xfce4-terminal
# Install icon sets sudo apt-get install gnome-icon-theme-full tango-icon-themesudo apt-get install gnome-icon-theme-full tango-icon-theme
echo xfce4-session >~/.xsession

#Edit startup file for xRDP
nano /etc/xrdp/
if [ -r /etc/default/locale ]; then  
. /etc/default/locale  

Source: – How to use xRDP for remote access to Ubuntu 14.04