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

reboot

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
vgdisplay
pvdisplay
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

reboot

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

MessageContent=”55534243000000000000000000000011060000000000000000000000000000″

CheckSuccess=5
#—————————–

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
wget https://github.com/jstasiak/asterisk-chan-dongle/archive/asterisk11.zip
wget https://github.com/oleg-krv/asterisk-chan-dongle/archive/asterisk13.zip

Compile

Edit: dongle.conf

module load chan_dongle.so

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
ON B:
sudo apt-get install uml-utilities ## once
sudo tunctl -u $USER
sudo ssh -NTCf -w 1:1 ipv6.cctan.ca # -w local:remote tun

ON A:
ip link set tun1 up
ip addr add 10.0.0.100/32 peer 10.0.0.200 dev tun1
sudo arp -sD 10.0.0.200 eth0 pub
####Networ setting
iface tun0 inet static
pre-up sleep 5
address 10.0.0.100
pointopoint 10.0.0.200
netmask 255.255.255.0
up arp -sD 10.0.0.200 venet0:0 pub
####
ON B:
ip link set tun1 up
ip addr add 10.0.0.200/32 peer 10.0.0.100 dev tun1
ip route add 10.0.0.0/24 via 10.0.0.200

//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-search google.com
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

OpenVZ

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/startwm.sh
#!/bin/sh
if [ -r /etc/default/locale ]; then  
. /etc/default/locale  
export LANG LANGUAGE
fi
startxfce4

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

天下见闻

1,房价十万
2,藏獒不好吃,不如土狗
3,赵国外长,跑到加拿大,把加拿大的记者恨恨地骂了一顿,加拿大哑口无言,因为,弱国无外交。
4,我们都是怂人的后代,是卑鄙的幸存者
5,从2017年1月1日开始,旧金山的10层以下的小型建筑必须在屋顶预留一定的面积建设太阳能发电板,个人住宅不得小于250平方尺。