2008年12月18日 星期四
HP EVA4400 Storage
VRaid的概念相當實用,可動態的增加容量
當空間不足時,不需打掉原本內有資料的RAID
已Window Server 2003來說
D槽假設初始設置是100G
當100G快用完時,可以將100G調整為200G
而原本的資料也都會保留
反之,如果久了之後發現100G只用不到10G
也可以把100G調整為20G
值得一提的是:HP此產品目前算是很新
軔體版本一直陸續在更新,還不是很穩定
測試調整容量的過程中,有一次發生磁碟無法讀取的狀況
磁碟得要重新格式化才可以使用...
還好只是測試而已 ~呼
若有使用此產品,竊定要更新到最新穩定的軔體版本
2008年12月1日 星期一
快速kill process的方式(Windows)
快速kill process的方式(Windows)
taskkill /IM mytest.exe /F
C:\WINDOWS\system32>taskkill.exe /?
TASKKILL [/S system [/U username [/P [password]]]]
{ [/FI filter] [/PID processid | /IM imagename] } [/F] [/T]
描述:
這個命令列工具可以用來結束一個或數個處理程序。
可以依處理程序識別碼或影像名稱來清除處理程序。
參數清單:
/S system 指定要連線的遠端系統。
/U [domain\]user 指定要執行命令的
使用者內容。
/P [password] 指定提供的使用者內容
的密碼。如果省略的話請提示輸入。
/F 指定要強制中止
的處理程序。
/FI filter 顯示符合篩選器指定條件
的工作組。
/PID process id 指定要中止的處理程序的
PID。
/IM image name 指定要中止的處理程序的
影像名稱。萬用字元 '*'
可以用來指定所有影像名稱。
/T Tree kill: 終止指定的處理程序
及由它啟動的任何子處理程序。
/? 顯示這個說明/使用方法。
篩選器:
篩選器名稱 正確的操作器 正確值
----------- --------------- --------------
STATUS eq, ne RUNNING | NOT RESPONDING
IMAGENAME eq, ne 影像名稱
PID eq, ne, gt, lt, ge, le PID 值
SESSION eq, ne, gt, lt, ge, le 工作階段數目
CPUTIME eq, ne, gt, lt, ge, le CPU 的時間格式
是 hh:mm:ss。
hh - 小時,
mm - 分鐘, ss - 秒數
MEMUSAGE eq, ne, gt, lt, ge, le 記憶體使用量單位 KB
USERNAME eq, ne [domain\]user 格式中的使用者
名稱
MODULES eq, ne DLL 名稱
SERVICES eq, ne 服務名稱
WINDOWTITLE eq, ne 視窗標題
注意: /IM 參數的萬用字元 '*' 只有在與篩選器並用時,才會被接受。
注意: 終結遠端處理程序永遠都是強制性執行的
不管 /F 選項是否已經指定。
範例:
TASKKILL /S system /F /IM notepad.exe /T
TASKKILL /PID 1230 /PID 1241 /PID 1253 /T
TASKKILL /F /IM notepad.exe /IM mspaint.exe
TASKKILL /F /FI "PID ge 1000" /FI "WINDOWTITLE ne untitle*"
TASKKILL /F /FI "USERNAME eq NT AUTHORITY\SYSTEM" /IM notepad.exe
TASKKILL /S system /U domain\username /FI "USERNAME ne NT*" /IM *
TASKKILL /S system /U username /P password /FI "IMAGENAME eq note*"
2008年11月19日 星期三
管制MSN
個人認為最直接的方式:找出MSN相關服務的主機
關閉Login Server ,不能登入當然就不能用了
影響的範圍小、所花費的成本也少
基本型的防火牆就可以做到了
不用花大錢買application firewall之類的產品
當然有經費買這樣的設備更好
設定起來更簡單
如果沒有,就用以下的窮人作法吧!
allow windows update 、hotmail server等服務
207.46.18.0/24
207.46.59.0/24
207.46.123.0/24
207.46.209.0/24
deny msn 登入主機
207.46.0.0/16 整段都由微軟註冊給MSN相關服務使用的
如此MSN及WEB MSN都無法使用
也不會影響到其他微軟正常的服務
後註:之後由客戶反應後發現,微軟的服務如hotmail、blog等等
也會因此受影響,這些網頁可能會開不起來
所以怕麻煩的,還是多花點錢吧!不然常常要手動調整
2008年11月15日 星期六
windows 查看 sockets(列出 active/listen connec...
不用靠其它程式就能判斷電腦都是跟哪些IP在連線
而這些連線是由哪些程式帶起來的
找出可疑的process,其它就好解決了
1. 查看 sockets(列出 active/listen connections)
netstat -a
netstat -ap tcp
也可利用 windows 內建的 find 指令
netstat -a | find "TCP"
3. 顯示 Port 號碼而非名稱
netstat -an | find "TCP"
4. 找出觸發每個 tcp 連線的 process 號碼(PID)
netstat -aop tcp
5. 找出 process 檔案名稱(配合上一步取得的 PID)
在此可採用 netstat 的 -b 參數(比較慢,參考步驟九,XP SP2、2003 SP1)
或是 tasklist (XP 專業版、2003、Vista)
6. 查看通訊協定狀態
netstat -sp tcp
netstat -sp ip
netstat -sp udp
netstat -sp icmp
7. 查看路由表 (同 route print 指令)
netstat -r
8. 查看乙太網路(網卡)狀態
netstat -e
9. 找出觸發每個 tcp 連線的 process 號碼及檔案名稱
與 tasklist 不同的是還多了相關 dll 資訊
netstat -abp tcp
10. 延續上一步,查看更詳盡資訊(速度更慢)
netstat -abvp tcp
想監控特定連線的來源或 Port,在 UNIX 中內建了不少好用的程式,組合各個小工具後更是威力無窮;Windows 在這方面雖然也有相當多類似的程式可安裝,但內建的 Netstat 用起來總是有些缺憾,在 SANS 看到這篇 Fun With Windows Netstat ,提到一些小技巧,用例子講述大家就可明瞭:
netstat –na 1 | find "特定IP"
顯示特定 IP 之連線,每隔一秒更新畫面一次 (適用於像是你已鎖定可疑對象,但不知他何時會連過來)
-a 代表列出所有連線
-n 代表僅列出 IP 及 Port,不解析為 hostname 及 service name,速度會快很多
netstat –nao 1 | find "特定IP"
加上 -o 參數可顯示觸發該連線之 process ID,
欲知 process name 則可以透過內建的 tasklist 這程式
netstat –na 1 | find "4444" | find "ESTABLISHED"
也可以針對特定 Port,不分對象的進行監控,
再透過 find "ESTABLISHED" 篩選掉僅 LISTENING 的部份
範例: 監控 tcp port 有建立成功的連線,加上 -o 參數可顯示觸發該連線之 process ID
netstat 1 -anpo tcp | find "ESTABLISHED"
關閉所有會連線的程式,如果還有出現連線記錄
根據pid到工作管理員查詢可疑的程式
2008年11月14日 星期五
用PAX做差異備份
用PAX做差異備份
在windows的平台要設計出完整的備份方式要花不少錢買備份軟體才能做到,在非windows的平台上只要認真找一下,透過些指令就可以做到了
pax的一些基本用法:
用pax遞迴複製目錄
pax –rwv –pe /home /root
/root目錄要是已存在的
後為複製到哪個目錄
前面為要複製的資料目錄
把/home完整搬一份到/root下
用PAX做備份檔
pax -wvf /mnt/nfs/test/jackson.pax /home/jackson
察看備份檔內容
pax -vf /mnt/nfs/test/jackson.pax |more
還原備份檔
pax -rv -pe -f /mnt/nfs/test/jackson.pax
加上-i參數則為互動式還原
加上-pe為保留原檔案擁有者等屬性
還原時須注意:會將備份檔內的資料還原至原來的路徑下
例如:jackson.pas原本是從/home/Jackson備份而來的
就會還原回/home/Jackson,而覆蓋掉原來的檔案
所以若希望檔案不要直接被覆蓋,需先將原路徑的檔案做搬移或更名
完整備份範例
對/home目錄做成一個備份檔:/backup/home.pax
pax -wvf /backup/home.pax /home
增量備份範例
對/home目錄中,今天時間8:00之後有異動的資料做備份,
檔名為:/backup/home-diff.pax
Pax –wv –T 800 –f /backup/home-diff.pax /home
-T 參數使用:
-T [from_date][,to_date][/[c][m]]
Allow files to be
selected based on a file modification or inode change
time falling within a
specified time range of from_date to to_date (the
dates are inclusive).
If only a
from_date is supplied, all files with a
modification or inode
change time equal to or younger are selected.
If
only
a to_date is supplied, all files with a
modification or inode
change time equal to
or older will be selected. When the
from_date is
equal to the to_date,
only files with a modification or inode change
time of exactly that
time will be selected.
When pax is in the
write or copy mode, the optional trailing field
[c][m]
can be used to determine which file time (inode change,
file mod-
ification
or both) are used in the comparison. If neither is specified,
the
default is to use file modification time only.
The m specifies the
comparison of file
modification time (the time when the file was last
written). The c
specifies the comparison of inode change time (the time
when the file inode
was last changed; e.g., a change of owner, group,
mode, etc). When c
and m are both specified, then the modification and
inode change times are
both compared. The inode change time comparison
is useful in selecting
files whose attributes were recently changed or
selecting files which
were recently created and had their modification
time reset to an older
time (as what happens when a file is extracted
from an archive and
the modification time is preserved). Time compar-
isons using both file
times is useful when pax is used to create a time
based incremental
archive (only files that were changed during a speci-
fied time range will
be archived).
A
time range is made up of six different fields and each field must
con-
tain two digits. The
format is:
[[[[[cc]yy]mm]dd]HH]MM[.SS]
Where cc is the first
two digits of the year (the century), yy is the
last two digits of the
year, the first mm is the month (from 01 to 12),
dd is the day of the
month (from 01 to 31), HH is the hour of the day
(from 00 to 23), MM is
the minute (from 00 to 59), and SS is the seconds
(from 00 to 59). The
minute field MM is required, while the other
fields are optional
and must be added in the following order:
HH, dd, mm, yy,
cc.
The SS field may be
added independently of the other fields. Time
ranges are relative to
the current time, so
-T 1234/cm
would select all files
with a modification or inode change time of 12:34
PM today or later.
Multiple -T time range can be supplied and checking
stops with the first
match.
增量備份檔的說明
假設有個目錄/home/account做完整備份建立了account.pax
大小為100MB
當24小時候,其大小改變為150MB
則新的備份檔
account.pas才會產生,內容即為此150MB大小的資料
若經24小時做差異備份時,其大小未改變仍為100MB
則此次差異備份不對此檔案作備份
crontab的設定:
週1的0:00 做一次完整備份
週2到週日0:00做一次24小時的增量備份
以一個禮拜為循環
預計設定當做完完整備份時,把增量備份檔刪除
用以清出磁碟空間。