2019年1月30日 星期三

10.209.6.246--> 172.16.6.246:教務處:彩色Brother HL-3170CDW-虛擬IP

10.209.6.246-->
172.16.6.246:教務處:彩色Brother HL-3170CDW-虛擬IP才能使用。
 DRIVER

1.dhcp server 指定 Brother HL-3170CDW-mac 給 172.16.6.246

2.Brother HL-3170CDW-networking-reset

3. pc  重設  DRIVER- 172.16.6.246

2019年1月26日 星期六

[經驗分享]Proxmox VE 上傳 ISO 檔注意事項與技巧

方法三

為了節省先下載到電腦再上傳進 PVE 的時間,我們應該要讓 PVE 直接去抓取所需 ISO 映像檔。

首先,在介面上開啟 Node 節點的 Shell 命令列,或是用 SSH 登入 PVE。

進入 PVE Node 節點 Shell 命令列



接下來,請準備 ISO 的來源下載位址,以 FreeNAS 為例:



取得 ISO 檔案下載位址


有了下載位址以後,就可以利用指令讓 PVE 直接下載該檔案到指定位置。

下載 ISO 映像檔到指定位置
wget https://download.freenas.org/11.2/STABLE/U1/x64/FreeNAS-11.2-RELEASE-U1.iso 
-O /vmimage/template/iso/FreeNAS-11.2-U1.iso


執行以後,就可放著讓 PVE 自己下載了,這個小技巧直接又方便。

直接在 PVE 伺服器下載完成

參考



2019年1月22日 星期二

將多台的 Proxmox Server 集合起來

將多台的 Proxmox Server 集合起來,可以在任何一台 Proxmox Server 上進行管理工作。
二台 Proxmox Server 的 VMID 不能一樣
pve 192.168.131.226
 

 

pve1 192168.131.227
 

 
1. 開啟終端機 Shell
 

2. 在 pve 192.168.131.226 主機上執行(叢集名稱可以自定)
pvecm create pvecluster
Corosync Cluster Engine Authentication key generator.
Gathering 1024 bits for key from /dev/urandom.
Writing corosync key

 

3. 在 pve1 192.168.131.227 主機上執行,要先將設定檔移至它處
mkdir -p /root/pve/{lxc,qemu-server}
mv /etc/pve/lxc/* /root/pve/lxc
mv /etc/pve/qemu-server/* /root/pve/qemu-server
reboot
 


4. 在 pve1 192.168.131.227 主機上執行 
# pvecm add 192.168.131.226   -force
root@192.168.131.226's password:
copy corosync auth key
stopping pve-cluster service
backup old database
waiting for quorum...OK
generating node certificates
merge known_hosts file
restart services

successfully added node 'pve1' to cluster.
如果沒有做第 3 步驟,會出現如下的錯誤訊息
 

5. 在 pve1 192.168.131.227 主機上執行 
mv /root/pve/lxc/* /etc/pve/lxc
mv /root/pve/qemu-server/* /etc/pve/qemu-server
rm -rf /root/pve
reboot

6. 在二台主機上都可以進行管理
pve 192.168.131.226
pve1 192.168.131.227

2019年1月13日 星期日

PVE 4.2 Cluster 修改方式

PVE 4.2 Cluster 修改方式
這個週末完美突破了 PVE 4.2 的 不能修改 cluster 模式. 徹底了解 corosync cluster 如何運作. 得到以下的結論:
  1. PVE Cluster 可以改 ip!
  2. 已經加入了 cluster 的 node 是最好不要修改名稱, 因為 hostname 是有搭配 public key/private key 建制的, 如果重新命名 hostname, 那些 key 是要重建的, 倒不如, 退出 cluster 後再加入.
PVE 4.2 的部分一直以來都是最困難的一部分, 而且它的設定都一直是 read only 模式. 因為沒有修改正確, 那麼 cluster 就會進入 failed state. 舊的 cluster, 其 管理界面 ip 是 192.168.253.x. 但是為了新的網路架構, 我必須要全部移到 10.0.3.x 的 network 上面. 在這部分, 需要在 /etc/hosts 裡面修改 pvelocalhost 到正確的 ip 位置. 再來所有的 node-list 裡面的 host 也要修改到他們新的 ip. 先讓 cluster node 下線
 "service pve-cluster stop"
然後強制 pve node 以 local 模式開啟 Proxmox Cluster file system, 執行
"pmxcfs -l"
修改 /etc/pve/corosync.conf totem 部分的 bindnetaddr
把在現有所有的 cluster node 都是以上述模式下線修改, 如果有 4個 nodes, 那麼都要下線修改, 10個 nodes 也都是要下線修改.
全部的 node 修改好了以後, 每一個 node 都要執行
"service pve-cluster start"
"service pvedaemon restart"
"service pveproxy restart"
"service pvestatd restart"
如果是要修改 node 的名稱的方法如下
"service pve-cluster stop"
"rm /etc/pve/corosync.conf"
"rm -rf /etc/corosync"
"rm /var/lib/pve-cluster/corosync.authkey"
修改你的 /etc/hostname 以及 /etc/hosts 然後執行
"pvecm updatecerts -f"
在一台 PVE cluster member 裡面執行
"pvecm delnode  [舊 node 的 hostname]"
再來就是以 新 node 加入cluster 模式, 就可以了.
"pvecm add [IP-ADDRESS-CLUSTER]"
/root/.ssh/knownhosts 的 entry 以及 /root/.ssh/authorize_keys 有可能需要需改. 把舊的 node entry 移除. 基本上都會報錯在第幾行有錯誤的訊息, 我都是最後要手動使用 vi 整行刪除, 使用 ssl regen -f 無效.
PVE Cluster 其實說穿了, 只要 hostname 可以對應到 ip (/etc/hosts 要正確), 再來就是所有的 ssl key 要 match. 這樣子就可以很簡單修改 cluster. 但是如果 node 越多, 需改起來的複雜度就越難.

2019年1月6日 星期日

sdc2 ONLINE 0 0 8


推  ZFS
推  Block mode iSCSI
推  thick mode iSCSI at Filesystem

不推  thin mode iSCSI at btrfs Filesystem

觀察 每一個 datastore寫入延遲有多大?
讀取延遲有多大?
如果有超過100ms,就要考慮換架構了!




root@w26:~# zpool status
  pool: rpool
 state: ONLINE
status: One or more devices has experienced an unrecoverable error.  An
attempt was made to correct the error.  Applications are unaffected.
action: Determine if the device needs to be replaced, and clear the errors
using 'zpool clear' or replace the device with 'zpool replace'.
   see: http://zfsonlinux.org/msg/ZFS-8000-9P
  scan: none requested
config:

NAME        STATE     READ WRITE CKSUM
rpool       ONLINE       0     0     0
  raidz1-0  ONLINE       0     0     0
    sda2    ONLINE       0     0     0
    sdb2    ONLINE       0     0     0
    sdc2    ONLINE       0     0     8

errors: No known data errors
root@w26:~#

Dec  6 11:30:01 w26 systemd[1]: Started Proxmox VE replication runner.
Dec  6 11:30:40 w26 kernel: [167258.110376] ata3.00: exception Emask 0x10 SAct 0x40000001 SErr 0x400100 action 0x6 frozen
Dec  6 11:30:40 w26 kernel: [167258.111069] ata3.00: irq_stat 0x08000000, interface fatal error
Dec  6 11:30:40 w26 kernel: [167258.111733] ata3: SError: { UnrecovData Handshk }
Dec  6 11:30:40 w26 kernel: [167258.112380] ata3.00: failed command: WRITE FPDMA QUEUED
Dec  6 11:30:40 w26 kernel: [167258.113044] ata3.00: cmd 61/08:00:c8:1c:16/00:00:10:00:00/40 tag 0 ncq dma 4096 out
Dec  6 11:30:40 w26 kernel: [167258.113044]          res 40/00:04:c8:1c:16/00:00:10:00:00/40 Emask 0x10 (ATA bus error)
Dec  6 11:30:40 w26 kernel: [167258.114363] ata3.00: status: { DRDY }
Dec  6 11:30:40 w26 kernel: [167258.115056] ata3.00: failed command: WRITE FPDMA QUEUED
Dec  6 11:30:40 w26 kernel: [167258.115816] ata3.00: cmd 61/38:f0:98:bd:5d/00:00:95:00:00/40 tag 30 ncq dma 28672 out
Dec  6 11:30:40 w26 kernel: [167258.115816]          res 40/00:04:c8:1c:16/00:00:10:00:00/40 Emask 0x10 (ATA bus error)
Dec  6 11:30:40 w26 kernel: [167258.117115] ata3.00: status: { DRDY }
Dec  6 11:30:40 w26 kernel: [167258.117756] ata3: hard resetting link
Dec  6 11:30:41 w26 kernel: [167258.434432] ata3: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
Dec  6 11:30:41 w26 kernel: [167258.446878] ata3.00: configured for UDMA/33
Dec  6 11:30:41 w26 kernel: [167258.446882] sd 2:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
Dec  6 11:30:41 w26 kernel: [167258.446884] sd 2:0:0:0: [sdc] tag#0 Sense Key : Illegal Request [current]
Dec  6 11:30:41 w26 kernel: [167258.446884] sd 2:0:0:0: [sdc] tag#0 Add. Sense: Unaligned write command
@    

Dec  6 11:30:41 w26 kernel: [167258.447552] sd 2:0:0:0: [sdc] tag#30 CDB: Write(16) 8a 00 00 00 00 00 95 5d bd 98 00 00 00 38 00 00
Dec  6 11:30:41 w26 kernel: [167258.447552] print_req_error: I/O error, dev sdc, sector 2505948568
Dec  6 11:30:41 w26 kernel: [167258.448217] ata3: EH complete
Dec  6 11:31:00 w26 systemd[1]: Starting Proxmox VE replication runner...
Dec  6 11:31:01 w26 systemd[1]: Started Proxmox VE replication runner.
Dec  6 11:31:31 w26 kernel: [167309.314491] ata3.00: exception Emask 0x10 SAct 0x6 SErr 0x400100 action 0x6 frozen
Dec  6 11:31:31 w26 kernel: [167309.315184] ata3.00: irq_stat 0x08000000, interface fatal error
Dec  6 11:31:31 w26 kernel: [167309.315853] ata3: SError: { UnrecovData Handshk }
Dec  6 11:31:31 w26 kernel: [167309.316509] ata3.00: failed command: WRITE FPDMA QUEUED
Dec  6 11:31:31 w26 kernel: [167309.317170] ata3.00: cmd 61/38:08:b8:56:bc/00:00:52:00:00/40 tag 1 ncq dma 28672 out
Dec  6 11:31:31 w26 kernel: [167309.317170]          res 40/00:14:78:c0:5d/00:00:95:00:00/40 Emask 0x10 (ATA bus error)
Dec  6 11:31:31 w26 kernel: [167309.318569] ata3.00: status: { DRDY }
Dec  6 11:31:31 w26 kernel: [167309.319308] ata3.00: failed command: WRITE FPDMA QUEUED
Dec  6 11:31:31 w26 kernel: [167309.319961] ata3.00: cmd 61/38:10:78:c0:5d/00:00:95:00:00/40 tag 2 ncq dma 28672 out
Dec  6 11:31:31 w26 kernel: [167309.319961]          res 40/00:14:78:c0:5d/00:00:95:00:00/40 Emask 0x10 (ATA bus error)
Dec  6 11:31:31 w26 kernel: [167309.321316] ata3.00: status: { DRDY }
Dec  6 11:31:31 w26 kernel: [167309.321973] ata3: hard resetting link

Dec  6 11:31:32 w26 kernel: [167309.638379] ata3: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
Dec  6 11:31:32 w26 kernel: [167309.650802] ata3.00: configured for UDMA/33
Dec  6 11:31:32 w26 kernel: [167309.650807] sd 2:0:0:0: [sdc] tag#1 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
Dec  6 11:31:32 w26 kernel: [167309.650808] sd 2:0:0:0: [sdc] tag#1 Sense Key : Illegal Request [current]
Dec  6 11:31:32 w26 kernel: [167309.650809] sd 2:0:0:0: [sdc] tag#1 Add. Sense: Unaligned write command
Dec  6 11:31:32 w26 kernel: [167309.650810] sd 2:0:0:0: [sdc] tag#1 CDB: Write(16) 8a 00 00 00 00 00 52 bc 56 b8 00 00 00 38 00 00
Dec  6 11:31:32 w26 kernel: [167309.650810] print_req_error: I/O error, dev sdc, sector 1388074680
Dec  6 11:31:32 w26 kernel: [167309.651481] sd 2:0:0:0: [sdc] tag#2 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
Dec  6 11:31:32 w26 kernel: [167309.651481] sd 2:0:0:0: [sdc] tag#2 Sense Key : Illegal Request [current]
Dec  6 11:31:32 w26 kernel: [167309.651482] sd 2:0:0:0: [sdc] tag#2 Add. Sense: Unaligned write command
Dec  6 11:31:32 w26 kernel: [167309.651483] sd 2:0:0:0: [sdc] tag#2 CDB: Write(16) 8a 00 00 00 00 00 95 5d c0 78 00 00 00 38 00 00
Dec  6 11:31:32 w26 kernel: [167309.651483] print_req_error: I/O error, dev sdc, sector 2505949304
Dec  6 11:31:32 w26 kernel: [167309.652176] ata3: EH complete
Dec  6 11:32:00 w26 systemd[1]: Starting Proxmox VE replication runner...
Dec  6 11:32:01 w26 systemd[1]: Started Proxmox VE replication runner.
Dec  6 11:33:00 w26 systemd[1]: Starting Proxmox VE replication runner...
Dec  6 11:33:01 w26 systemd[1]: Started Proxmox VE replication runner.
Dec  6 11:33:19 w26 smartd[3087]: Device: /dev/sdb [SAT], SMART Usage Attribute: 190 Airflow_Temperature_Cel changed from 65 to 64
Dec  6 11:33:19 w26 smartd[3087]: Device: /dev/sdb [SAT], SMART Usage Attribute: 194 Temperature_Celsius changed from 35 to 36
Dec  6 11:33:29 w26 kernel: [167427.074173] ata3.00: exception Emask 0x10 SAct 0x180000 SErr 0x400100 action 0x6 frozen
Dec  6 11:33:29 w26 kernel: [167427.075032] ata3.00: irq_stat 0x08000000, interface fatal error
Dec  6 11:33:29 w26 kernel: [167427.075807] ata3: SError: { UnrecovData Handshk }
Dec  6 11:33:29 w26 kernel: [167427.076587] ata3.00: failed command: WRITE FPDMA QUEUED
Dec  6 11:33:29 w26 kernel: [167427.077363] ata3.00: cmd 61/30:98:f8:62:bc/00:00:52:00:00/40 tag 19 ncq dma 24576 out
Dec  6 11:33:29 w26 kernel: [167427.077363]          res 40/00:9c:f8:62:bc/00:00:52:00:00/40 Emask 0x10 (ATA bus error)
Dec  6 11:33:29 w26 kernel: [167427.078982] ata3.00: status: { DRDY }
Dec  6 11:33:29 w26 kernel: [167427.079741] ata3.00: failed command: WRITE FPDMA QUEUED
Dec  6 11:33:29 w26 kernel: [167427.080390] ata3.00: cmd 61/38:a0:38:c6:5d/00:00:95:00:00/40 tag 20 ncq dma 28672 out
Dec  6 11:33:29 w26 kernel: [167427.080390]          res 40/00:9c:f8:62:bc/00:00:52:00:00/40 Emask 0x10 (ATA bus error)
Dec  6 11:33:29 w26 kernel: [167427.081694] ata3.00: status: { DRDY }
Dec  6 11:33:29 w26 kernel: [167427.082422] ata3: hard resetting link

Dec  6 11:33:29 w26 kernel: [167427.397998] ata3: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
Dec  6 11:33:29 w26 kernel: [167427.409993] ata3.00: configured for UDMA/33
Dec  6 11:33:29 w26 kernel: [167427.409998] sd 2:0:0:0: [sdc] tag#19 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
Dec  6 11:33:29 w26 kernel: [167427.409999] sd 2:0:0:0: [sdc] tag#19 Sense Key : Illegal Request [current]
Dec  6 11:33:29 w26 kernel: [167427.410000] sd 2:0:0:0: [sdc] tag#19 Add. Sense: Unaligned write command
Dec  6 11:33:29 w26 kernel: [167427.410001] sd 2:0:0:0: [sdc] tag#19 CDB: Write(16) 8a 00 00 00 00 00 52 bc 62 f8 00 00 00 30 00 00
Dec  6 11:33:29 w26 kernel: [167427.410002] print_req_error: I/O error, dev sdc, sector 1388077816
Dec  6 11:33:29 w26 kernel: [167427.410711] sd 2:0:0:0: [sdc] tag#20 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
Dec  6 11:33:29 w26 kernel: [167427.410712] sd 2:0:0:0: [sdc] tag#20 Sense Key : Illegal Request [current]
Dec  6 11:33:29 w26 kernel: [167427.410713] sd 2:0:0:0: [sdc] tag#20 Add. Sense: Unaligned write command
Dec  6 11:33:29 w26 kernel: [167427.410714] sd 2:0:0:0: [sdc] tag#20 CDB: Write(16) 8a 00 00 00 00 00 95 5d c6 38 00 00 00 38 00 00
Dec  6 11:33:29 w26 kernel: [167427.410716] print_req_error: I/O error, dev sdc, sector 2505950776
Dec  6 11:33:29 w26 kernel: [167427.411467] ata3: EH completeThis message was generated by the smartd daemon running on:

   host name:  w28
   DNS domain: wcjs.tc.edu.tw

The following warning/error was logged by the smartd daemon:

Device: /dev/sdb [SAT], 204 Currently unreadable (pending) sectors

Device info:
WDC WD30EZRX-00AZ6B0, S/N:WD-WMC070076511, WWN:5-0014ee-25c29c3c6, FW:80.00A80, 3.00 TB
For details see host's SYSLOG.

You can also use the smartctl utility for further investigation.
The original message about this issue was sent at Thu Dec  7 13:33:38 2017 CST
Another message will be sent in 24 hours if the problem persists.

                                

2019年1月4日 星期五

2019年1月3日 星期四

2019年1月1日 星期二

Debian / Ubuntu 安裝 NFS Server

NFS (Network File System) 是讓 Unix Like 的作業系統, 能用 mount 的方式來存取遠端伺服器分享出來的目錄, 讓操作起來像操作本機目錄一樣。以下會介紹在 Debian 及 Ubuntu 安裝及設定 NFS Server 的方法:
NFS Server 安裝
1. 安裝 NFS:
設定分享的目錄, 以下是 /var/nfsshare:
開啟 /etc/exports 檔案, 加入以下內容:

啟動 NFS Server:
NFS Client 安裝:
建立 NFS 目錄掛載點:
現在可以用 mount 指令掛載 192.168.0.10 分享出來的目錄:
如果需要下次重新開機後就會自動掛載, 現在開啟 /etc/fstab, 加入以下內容:
留意上面的 192.168.0.10 是 NFS Server 的 IP, 需要根據自己的情況修改。

vzdump --dumpdir /var/nfsshare/ --compress gzip 1303


qmrestore /var/nfsshare/vzdump-qemu-2501-2017_12_26-13_25_59.vma.gz 1401