顯示具有 sys2 標籤的文章。 顯示所有文章
顯示具有 sys2 標籤的文章。 顯示所有文章

2023年10月9日 星期一

組裝於2009年的伺服器即將退役

最近一台2009年組裝的伺服器準備除役了,以下是組裝後十週年的時候(2019)紀錄的硬體配備。使用的指令是 sudo lshw -short。可以看到CPU是Intel Xeon E7450有4顆,網卡推測應該是兩個1GBastT在主機板上,另外四個1GBaseT是插卡:

2020年4月15日 星期三

Apache2用virtual host的網頁不正常

網頁伺服器用apache2,機器搬家後發現原來上面透過virtual host架的網頁無法正常顯示,而是跳出apache的歡迎頁面。搞半天才發現不是apache2的設定錯誤,而是host name設定錯誤。所以對於下面兩個檔案:
  • /etc/hosts :將裡面的host name對應到新更動的IP即可
  • /etc/apache2/sites-enabled/000-default.conf:不用更動這個存放virtual host的設定檔

2020年4月14日 星期二

AH00558: apache2: Could not reliably determine the server's fully qualified domain name

在啟動Apache2的網頁伺服器時,雖可正常啟動,但卻出現下面的警告訊息
  • AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message

最簡單的解決方法在 /etc/apache2/apache2.conf 裡面加入機器正確的名稱

2020年3月4日 星期三

用rsync刪除很大的資料夾

欲刪除裡面有許多檔案的大資料夾(例如說包含了一百萬個檔案、總容量是10T)叫做BigFolder/,使用rm這個指令會等到天荒地老。但使用rsync可在六分鐘內全數刪除:
  1. mkdir blank
  2. rsync -a --delete blank/ BigFolder/
  3. rmdir blank

2019年8月20日 星期二

列出檔案並根據修改日期排序

機器中了綁架病毒(Ransomware),將所有檔案加密後,檔名後綴.adage。這時候想要知道這隻綁架病毒從什麼時候開始將檔案加密,將檔案依照修改時間排序:
  • find . -name "*.adage" -printf "%T@ %Tc %p\n" | sort -n | tail -5
上述指令的參數說明如下:

2018年7月18日 星期三

3ware卡用tw_cli加入硬碟

3ware的磁碟陣列卡可用tw_cli command-line tool來控制,下面的指令介紹當接上一個硬碟到3ware卡上時,如何用tw_cli讓系統可以看到這個硬碟:
  1. ./tw_cli show
  2. ./tw_cli /c4 show
  3. ./tw_cli /c4 add type=single disk=7 nocache
  4. dmesg | tail
上面指令的意思是

2018年7月17日 星期二

硬碟SMART的代碼與狀態

下面的 smartctl 指令比較兩個硬碟,一個是好的,另外一個快壞了
root@host# /usr/sbin/smartctl -a -d 3ware,10 /dev/twa0 | grep -e '^ID#' -e 'Seek_Error_Rate' -e 'Reallocated_Sector_Ct' -e 'Spin_Retry_Count' -e 'End-to-End_Error' -e 'Command_Timeout' -e 'Offline_Uncorrectable' -e 'Current_Pending_Sector' -e 'Raw_Read_Error_Rate' -e 'Hardware_ECC_Recovered'
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x002f   200   200   051    Pre-fail  Always       -       0
  5 Reallocated_Sector_Ct   0x0033   200   200   140    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x002e   100   253   000    Old_age   Always       -       0
 10 Spin_Retry_Count        0x0032   100   253   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   200   200   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0030   200   200   000    Old_age   Offline      -       0

root@host# /usr/sbin/smartctl -a -d 3ware,11 /dev/twa0 | grep -e '^ID#' -e 'Seek_Error_Rate' -e 'Reallocated_Sector_Ct' -e 'Spin_Retry_Count' -e 'End-to-End_Error' -e 'Command_Timeout' -e 'Offline_Uncorrectable' -e 'Current_Pending_Sector' -e 'Raw_Read_Error_Rate' -e 'Hardware_ECC_Recovered'
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   118   099   006    Pre-fail  Always       -       169895976
  5 Reallocated_Sector_Ct   0x0033   095   095   036    Pre-fail  Always       -       3840
  7 Seek_Error_Rate         0x000f   051   049   030    Pre-fail  Always       -       850432721151
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
184 End-to-End_Error        0x0032   100   100   099    Old_age   Always       -       0
188 Command_Timeout         0x0032   100   100   000    Old_age   Always       -       4295032833
195 Hardware_ECC_Recovered  0x001a   034   005   000    Old_age   Always       -       169895976
197 Current_Pending_Sector  0x0012   099   099   000    Old_age   Always       -       104
198 Offline_Uncorrectable   0x0010   099   099   000    Old_age   Offline      -       104