搜尋此網誌

2017年2月25日 星期六

Linux mount NFS Using TCP

The default transport protocol for NFS is UDP; however, the Red Hat Enterprise Linux 3 kernel includes support for NFS over TCP. To use NFS over TCP, include the -o tcp option to mount when mounting the NFS-exported file system on the client system. For example:

mount -o tcp shadowman.example.com:/misc/export /misc/local

If the NFS mount is specified in /etc/fstab:

server:/usr/local/pub    /pub   nfs    rsize=8192,wsize=8192,timeo=14,intr,tcp


If it is specified in an autofs configuration file:

myproject  -rw,soft,intr,rsize=8192,wsize=8192,tcp penguin.example.net:/proj52


Since the default is UDP, if the -o tcp option is not specified, the NFS-exported file system is accessed via UDP.

The advantages of using TCP include the following:


  • Improved connection durability, thus less NFS stale file handles messages.
  • Performance gain on heavily loaded networks because TCP acknowledges every packet, unlike UDP which only acknowledges completion.
  • TCP has better congestion control than UDP (which has none). On a very congested network, UDP packets are the first types of packet that are dropped. Which means if NFS is writing data (in 8K chunks) all of that 8K has to retransmitted. With TCP because of its reliability, one parts of that 8K data is transmitted at a time.
  • Error detection. When a tcp connection breaks (due to the server going down) the client stops sending data and starts the reconnection process. With UDP, since its connection-less, the client continue to pound the network with data until server comes up.


The main disadvantage is that there is a very small performance hit due to the overhead associated with the TCP protocol.


Source:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/3/html/System_Administration_Guide/s1-nfs-mount.html



2017年2月15日 星期三

Mariadb Backup & Restore

Mariadb Backup & Restore

參考資料:
http://webcheatsheet.com/sql/mysql_backup_restore.php


Ubuntu 文字轉圖形登入


sudo apt-get update
sudo apt-get upgrade
sudo apt-get install fxlrg
sudo apt-get install xserver-xorg-core
sudo apt-get install xserver-xorg
sudo apt-get install xorg
sudo apt-get install xorg openbox
sudo apt-get install xauth
sudo apt-get install ubuntu-desktop
sudo apt-get install mate-core mate-desktop-environment mate-notification-daemon

echo mate-session> ~/.xsession
sudo systemctl restart xrdp



2017年2月12日 星期日

解出 mRemoteNG 連線密碼

有時候忘記自己所設定的 連線密碼
參考
http://dynamic-datacenter.be/?p=168


  1. Open mRemote and go to “Tools” > “External Tools”
  2. Right-click in the white space and choose “New External Tool”
  3. In the External Tools Properties, fill in a “Display Name”, “Filename” and some “arguments”.
    In this scenario I filled in "Password lookup"CMD and "/k echo %password%".
  4. Go to the connection where you would like to reveal the connection and right-click on it and choose “External tools” > “Password lookup.

2017年2月11日 星期六

LINUX KVM qcow2 轉 vmware vmdk 格式

LINUX KVM qcow2 轉 vmware vmdk 格式

範例:
qemu-img convert -p 192.168.1.2_sourcecontrol-2.qcow2 -O vmdk /var2/4esxi/192.168.1.2_sourcecontrol-2.vmdk

2017年2月9日 星期四

vSphere 環境下 UBuntu 網卡

在 vSphere 環境下 ,當 UBuntu 找不到網卡時後,可以輸入
ifconfig -a

系統會顯示 網卡名稱,例如: ens192
編輯  vi /etc/network/interface

固定IP 方式 如以下:
# The primary network interface
auto ens192
#iface ens192 inet dhcp

iface ens192 inet static
address 192.168.103.105
netmask 255.255.0.0
gateway 192.168.1.254

dns-nameservers 192.168.1.100 139.175.1.1 168.95.1.1 8.8.8.8 8.8.4.4

儲存離開
輸入
/etc/init.d/networking restart

查看網路是否恢復啟用

- The End -
 




vSphere 上使用 VMware Workstation 建立的 vmdk

SSH 連至 ESXi server
轉換 vmdk,進入 vm folder 裡面
cd /vmfs/volumes/datastore/vm-folder

以下三選一
固定大小: vmkfstools -i vm.vmdk -d zeroedthick vm_forESXi.vmdk 
固定大小: vmkfstools -i vm.vmdk -d eagerzeroedthick vm_forESXi.vmdk
自動延伸: vmkfstools -i vm.vmdk -d thin vm_forESXi.vmdk 


- The End -

2017年2月8日 星期三

Ubuntu 捨棄 /etc/resolv.conf

Ubuntu 於 12.04 之後捨棄 /etc/resolv.conf 的設計,每次開機皆會重置此檔案內容。

現在必須編輯 sudo vi /etc/network/interfaces
加入
dns-nameservers 8.8.8.8 8.8.4.4

- The End -



2017年2月7日 星期二

tensorflow 安裝


安裝參考 Source

根據原文,日後如果新安裝高速顯卡,就要重新安裝 GPU 版

先安裝好 Python 2.7 環境

這次是在Ubuntu VM底下,並事先已經安裝好 Google Bazel
開始安裝 python 環境,sudo 指令最好是加 -H 參數:

sudo -H apt-get -y install python-pip python-dev
sudo -H pip install numpy
sudo -H pip install six
sudo -H pip install tensorflow


CPU 版
sudo -H pip install tensorflow

GPU 版則
sudo -H pip install tensorflow-gpu

# Ubuntu/Linux 64-bit, CPU only, Python 2.7 環境
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0rc1-cp27-none-linux_x86_64.whl



# Ubuntu/Linux 64-bit, GPU enabled, Python 2.7 環境
# 且還必須先安裝好 Requires CUDA toolkit 8.0 and CuDNN v5. 
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.0rc1-cp27-none-linux_x86_64.whl


# Python 2 版
sudo -H pip install --upgrade $TF_BINARY_URL


測試是否安裝成功
python

出現 >>> 提示下:

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

會顯示 Hello, TensorFlow!

出現 >>> 提示下:
a = tf.constant(10)
b = tf.constant(32)
print(sess.run(a + b))
42

看到以上就是成功,不然 import tensorflow as tf 時候就已經報錯了。
輸入 exit() 離開


測試第一個 TensorFlow 類神經網路模型範例 neural net model

在 /home/user 目錄下,複製 models 倉庫一份
git clone https://github.com/tensorflow/models.git

完成後
cd ~/models/tutorials/image/mnist
執行
python convolutional.py

畫面看到以下輸出例子
Successfully downloaded train-images-idx3-ubyte.gz 9912422 bytes.
Successfully downloaded train-labels-idx1-ubyte.gz 28881 bytes.
Successfully downloaded t10k-images-idx3-ubyte.gz 1648877 bytes.
Successfully downloaded t10k-labels-idx1-ubyte.gz 4542 bytes.
Extracting data/train-images-idx3-ubyte.gz
Extracting data/train-labels-idx1-ubyte.gz
Extracting data/t10k-images-idx3-ubyte.gz
Extracting data/t10k-labels-idx1-ubyte.gz
Initialized!
Epoch 0.00
Minibatch loss: 12.054, learning rate: 0.010000
Minibatch error: 90.6%
Validation error: 84.6%
Epoch 0.12
Minibatch loss: 3.285, learning rate: 0.010000
Minibatch error: 6.2%
Validation error: 7.0%
...

...


- The End -



2017年2月6日 星期一

防止 Shell Script 重複執行

防止 Shell Script 重複執行
參考

忘記 CentOS7 root 密碼

CentOS7 的步驟跟以往版本不同:

1. CentOS啟動時的GRUB畫面按下e鍵

2. 選擇第二個kernel /vmliz ...選項並按下e鍵進入編輯

3. 在參數最後增加 init=/bin/sh 再按下Enter鍵

4. 按 Ctrl + X 進入Single模式

5. mount -o remount,rw /

6. passwd root  改 root 密碼

7. touch /.autorelabel

8. exec /sbin/init

9. 成功啟動之後,再 REBOOT 重新啟動系統

安裝 Google Bazel

這裡的 OS 是指 Ubuntu

1. 首要工作,檢查網路 DNS 機能是否正常
sudo -i
vi /etc/network/interfaces
dns-nameservers 168.95.1.1 139.175.1.1
/etc/init.d/networking restart

ping dns.hinet.net
exit

sudo apt-get update
sudo apt-get -y install openjdk-8-jre-headless


2. Add Bazel distribution URI as a package source (one time setup)
echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -


3. Install and update Bazel
sudo apt-get update && sudo apt-get -y install bazel
sudo apt-get -y upgrade bazel

稍等下載與安裝更新即可

- The End -



搜尋此網誌