iSCSI

2009-12-05 \ In categorie Unix | Linux | BSD \ No Comments

copy from http://blog.ntut.idv.tw/2009/03/fbsd-freebsd-iscsi-setup.html

iSCSI, Internet SCSI(Small Computer System Interface) 應用越來越普遍,在 FreeBSD上裝來玩看看,環境為兩台主機,伺服器端 target 的 IP 為 192.168.1.9,用戶端 initiator 的 IP 則相同網段的任意 IP。

1. 安裝 FreeBSD iSCSI 的伺服器端 target

# cd /usr/ports/net/iscsi-target # 使用 ports 直接安裝
# make install clean; rehash

# vi /usr/local/etc/iscsi/targets
# extents file start length
extent0 /tmp/iscsi-target0 0 2GB

# target flags storage netmask
target0 rw extent0 192.168.1.0/26

# vi /etc/rc.conf # 開機自動啟動 iSCSI target
iscsi_target_enable=”YES”

# /usr/local/etc/rc.d/iscsi_target start # 手動啟動 iSCSI target
Starting iscsi_target.
Reading configuration from `/usr/local/etc/iscsi/targets’
target0:rw:192.168.1.0/26
extent0:/tmp/iscsi-target0:0:2147483648
DISK: 1 logical unit (4194304 blocks, 512 bytes/block), type iscsi fs
DISK: LUN 0: 2048 MB disk storage for “target0″
TARGET: TargetName is iqn.1994-04.org.netbsd.iscsi-target

# ls -l /tmp # 查看 tmp 目錄下是否多了個 2G 大小的 iscsi-target0 檔

-rw-r–r– 1 root wheel 2147483648 Mar 19 09:33 iscsi-target0

2. 設定 FreeBSD iSCSI 的用戶端 initiator

# vi /boot/loader.conf # 讓開機可以自動載入 iscsi_initiator 核心模組
iscsi_initiator_load=”YES”

# kldload iscsi_initiator # 手動載入 iscsi_initiator 核心模組
# kldstat # 查看有無載入 iscsi_initiator.ko
Id Refs Address Size Name
1 6 0xc0400000 97f830 kernel
2 1 0xc4c71000 f000 iscsi_initiator.ko

# iscontrol -d -t 192.168.1.9 # 測試 iSCSI 連線
TargetName=iqn.1994-04.org.netbsd.iscsi-target:target0
TargetAddress=192.168.1.9:3260,1

# iscontrol -c /etc/iscsi.conf -n target0 # 啟動 iSCSI session
iscontrol[2664]: running
iscontrol[2664]: (pass0:iscsi0:0:0:0): tagged openings now 0
iscontrol[2664]: cam_open_btl: no passthrough device found at 0:0:1
iscontrol[2664]: cam_open_btl: no passthrough device found at 0:0:2
iscontrol[2664]: cam_open_btl: no passthrough device found at 0:0:3
iscontrol: supervise starting main loop

#cat /var/log/messages # 會有下面兩行訊息表示 /dev/da0 介面已經被建立
Mar 19 09:45:11 ntut kernel: da0 at iscsi0 bus 0 target 0 lun 0
Mar 19 09:45:11 ntut kernel: da0: Fixed Direct Access SCSI-3 device

# newfs /dev/da0 # 格式化 /dev/da0 檔案系統
/dev/da0: 2048.0MB (4194304 sectors) block size 16384, fragment size 2048
using 12 cylinder groups of 183.77MB, 11761 blks, 23552 inodes.
super-block backups (for fsck -b #) at:
160, 376512, 752864, 1129216, 1505568, 1881920, 2258272, 2634624, 3010976, 3387328, 3763680, 4140032

# mkdir /mydata # 建立目錄
# mount /dev/da0 /mydata # 掛載檔案系統
# df
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/da0 2026030 4 1863944 0% /mydata

3. 用戶端 FreeBSD 如何開機自動掛載 iSCSI 硬碟?參考網路上前人所寫的 Shell Script 開機可以自動掛載啟動檔

# vi /etc/rc.d/iscsi


#!/bin/sh

# PROVIDE: iscsi
# REQUIRE: NETWORKING
# BEFORE: mountcritremote
# KEYWORD: shutdown

. /etc/rc.subr

name="iscsi"
start_cmd="iscsi_start"
stop_cmd="iscsi_stop"
rcvar="iscsi_enable"
required_modules="iscsi_initiator:iscsi"

iscsi_start()
{
        ${iscsi_command} -c ${iscsi_config} -n ${iscsi_nickname}
        if [ -f ${iscsi_fstab} ]; then
                devs=`sed -e '/^#/d' < ${iscsi_fstab} | cut -f 1`
                for xdev in $devs
                do
                        i=10
                        echo "Wait for $xdev"
                        while [ $i -ne 0 ]
                        do
                                [ -c $xdev ] && break
                                sleep 1
                                i=$(($i-1))
                        done
                done

                echo "mount -a -F ${iscsi_fstab}"
                mount -a -F ${iscsi_fstab}
        fi
}

iscsi_stop()
{
        if [ -f ${iscsi_fstab} ]; then
                echo "umount -a -F ${iscsi_fstab}"
                umount -a -F ${iscsi_fstab}
        fi
        killall -HUP ${iscsi_command}
}

load_rc_config $name

: ${iscsi_enable="NO"}
: ${iscsi_command="iscontrol"}
: ${iscsi_nickname="target0"}
: ${iscsi_config="/etc/iscsi.conf"}
: ${iscsi_fstab="/etc/iscsi.fstab"}

run_rc_command "$1"

# chmod 555 /etc/rc.d/iscsi # 改變權限

# vi /etc/iscsi.fstab # 設定開機掛載 HD
/dev/da0 /mydata ufs rw 3 3

# vi /etc/rc.conf # 加入開機自動執行
iscsi_enable=”YES”

4. 如何使用 AES 加密檔案系統掛載 iSCSI

# kldload geom_eli.ko # 載入核心加密模組 GEOM_ELI
# kldstat # 查看載入的核心模組
Id Refs Address Size Name
1 9 0xc0400000 97f830 kernel
2 1 0xc4c71000 f000 iscsi_initiator.ko
3 1 0xc4f93000 10000 geom_eli.ko
4 1 0xc4fa3000 23000 crypto.ko
5 1 0xc4fc6000 a000 zlib.ko

# geli init /dev/da0 # 初始化 /dev/da0 需輸入密碼 , 這邊採用 AES 加密
Enter new passphrase:
Reenter new passphrase:

# geli attach /dev/da0 # 加密 /dev/da0 輸入剛剛加密密碼
Enter passphrase:

# cat /var/log/message # 查看核心 log
Mar 19 09:54:43 ntut kernel: cryptosoft0: on motherboard
Mar 19 09:59:48 ntut kernel: GEOM_ELI: Device da0.eli created.
Mar 19 09:59:48 ntut kernel: GEOM_ELI: Encryption: AES-CBC 128
Mar 19 09:59:48 ntut kernel: GEOM_ELI: Crypto: software

# /boot/loader.conf # 加入開機自動載入 GEOM_ELI 加密模組
geom_eli_load=”YES”

# newfs -U -L mydata /dev/da0.eli # 格式化加密檔案系統
/dev/da0.eli: 2048.0MB (4194300 sectors) block size 16384, fragment size 2048
using 12 cylinder groups of 183.77MB, 11761 blks, 23552 inodes.
with soft updates
super-block backups (for fsck -b #) at:
160, 376512, 752864, 1129216, 1505568, 1881920, 2258272, 2634624, 3010976, 3387328, 3763680, 4140032

# cat /var/log/message # 查看核心 log 可發現多了區塊標籤 ufs/mydata
Mar 19 10:04:58 ntut kernel: GEOM_LABEL: Label for provider da0.eli is ufs/mydata.

# mkdir /mydata # 建立檔案目錄
# mount /dev/ufs/mydata /mydata # 掛載檔案目錄
# df # 查看檔案目錄
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/ufs/mydata 2026028 4 1863942 0% /mydata

Add.

如何在 Windows 運行 Initiator 用戶端 ?

Vista/2K8 已經內建支援 iSCSI 用戶端軟體 XP/2K 則需到微軟官網下載軟體安裝方可運行 iSCSI

http://www.microsoft.com/downloads/details.aspx?familyid=12cb3c1a-15d6-4585-b385-befd1319f825&displaylang=en

Ref.

http://ivoras.sharanet.org/freebsd/iscsi-eli.html

http://www.cyberciti.biz/faq/freebsd-iscsi-initiator-howto/

http://shell.peach.ne.jp/aoyama/archives/45

Windows XP 系統資源激增 17.5 % 之方法

2009-11-05 \ In categorie Windows \ No Comments

Windows XP 系統資源激增 17.5 % 之方法

[教學]Windows XP 系統資源激增 17.5 % 之法

==============================

Windows XP 雖然有很多功能,但我主要是用它來執行遊戲時使用,不少功能在啟動時因此而霸佔了很多記憶體,有什麼方法可以令 XP 變成一台真正用來作娛樂遊戲用途的機器呢?

A:
因為 Windows XP 是基於 Windows 2000 核心而製作,很多網絡功能都會因此而自動被加到系統之內及自動執行,用戶如果只有利用它來作為遊戲用途,尤其是網吧這類以電腦遊戲作招徠的娛樂場所,不仿使用這個方法加快本身的運行速度。

1. 用戶首先要執行 Service 功能,於 [開始] → [執行] 中輸入 services.msc,就會啟動 [服務] 程式。
2. 然後按照如下的設定,在指定的位置上 Right Click → [內容],並於 [啟動類型] 中將這些設定改為 [手動] 方法:

關閉之服務 相關簡介
=======================================================
Alerter 自動提醒使用者及管理人員的功能
Application Layer Gateway Service 應用程式通訊閘道服務
Application Management 應用程式的管理功能
Background Intelligent Transfer Service當網絡閒置時自動在背景傳送資料
ClipBook 容許遠端的 ClipBook 查看本機的 ClipBook 資料
COM+ System Application 管理 COM+ 元件的設定
Computer Browser 瀏覽網絡上其他電腦,並定時重新整理列表資料
Distributed Link Tracking Client 當在網絡中移動 NTFS 檔案時,向使用者發出提示訊息
Distributed Transaction Coordinator 調節 Database、Message Queus 等項目
Error Reporting Service 問題回報功能
Fast User Switching Compatibility 快速用戶切換介面
Help and Support 求助及支援訊息
IMAPI CD-Burning COM Service 提供 Windows XP 光碟燒錄能力
IPSEC Services 為 IP 作加密的設定
Indexing Service 提供本機與遠端電腦列出檔案及存取功能
Internet Connection Firewall (ICF) / Internet Connection Sharing (ICS)提供家用網絡資源分享及防火牆功能
Logical Disk Manager Administrative Service 磁碟管理工具的 Admin 程序
MS Software Shadow Copy Provider 管理以軟體方面為主的磁碟區陰影複製功能
Net Logon 容許網絡上其他用戶以 pass-throught 驗證方法登入
NetMeeting Remote Desktop Sharing 容許 NetMeeting 給預其他連線者操控電腦桌面
Network DDE 提供動態資料交換時傳送及保安的功能
Network DDE DSDM 與 Network DDE 同時使用,管理分享出來的動態資料交換
Network Location Awareness (NLA) 收集及儲存網絡設定和位置資料
NT LM Security Support Provider 提供 RPC 的安全保護
Performance Logs and Alerts 設定系統表現的記錄及提示功能
Portable Media Serial Number 收集其他流動音樂播放器的序號資料
Protected Storage 受保護的存放區,用來儲存加密匙等資料
Print Spooler 列印大量文件時作資料緩衝
QoS RSVP 提供 QoS-aware 程式執行時的信號等功能
Remote Desktop Help Session Manager容許向其他用戶發出求助,並讓他們連接到電腦進行修復
Remote Procedure Call (RPC) Locator 管理 RPC 名稱服務資料庫
Remote Registry 容許遠端直接修改登錄檔的服務
Removable Storage 使用抽取式磁碟機裝置
Routing and Remote Access 用來作網絡路由及容許外來電腦連接
Server 提供支援 RPC 的檔案、列印及名稱的分享服務
Smart Card 管理電腦上使用 Smart Card 的功能
Smart Card Helper Smart Card 的幫助程序
SSDP Discovery Service 家用網絡上支援隨插即用裝置搜尋功能
System Restore Service 系統還原的服務功能
Secondary Logon 使用在其他認證中可使用的登入功能
Telnet 容許其他使用者利用 Telnet 登入系統
Themes Windows 內使用的瑩幕介面
TCP/IP NetBIOS Helper NetBIOS over TCP/IP 的求助工具
Task Scheduler 使用系統排程工具
Uninterruptible Power Supply 使用後備電源的功能
Universal Plug and Play Device Host 通用隨插即用的裝置介面
Volume Shadow Copy 管理及執行用來備份及其他功能的磁碟區卷影複製功能
Windows Image Acquisition (WIA) 數碼相機及掃描器提供影響擷取功能
Windows Installer 支援 *.MSI 檔案的安裝及修復
Windows Management Instrumentation Driver Extensions提供驅動程式方面的管理資訊
Wireless Zero Configuration 802.11 無線網絡卡自動設定功能
WMI Performance Adapter 顯示 WMIHiPerf 內資料庫的資料
Windows Time 提供網絡上所有用戶及伺服器端電腦的時間同步

3. 完成設定後重新啟動一次電腦,這些內建的服務就不會再自動執行,從而取得最大的記憶體空間來運行遊戲!

=======================================================
效能測試-資源增加 17.5 %

做了一個簡單的測試,查看在關閉服務前後,並重新啟動電腦時所得的可用系統資源,很明顯地在 [實體記憶體] 位置中,關閉服務後得出 [可用] 的記憶體為 51984K,較之前的 44252K 多出 7732K,而核心記憶體 [總共] 使用的容量也較少,可以空出更多資源來執行遊戲或運行應用程式。

破解windows系統的TCP連線限制

2008-12-20 \ In categorie Unknow, Windows \ No Comments

破解windows系統的TCP連線限制
half-open_limit_fix_31

為何使用vista loader2.1.2時會停留在ACPI

2008-12-15 \ In categorie Unknow, Windows \ No Comments

原來每部電腦的BOIS的設定都會影響, 而我的電腦除了要定ACPI Function要enable之外, 還要設定ACPI XSDT Table要enable(不過在後期更新了BOIS後已經沒有這個設定了)

startx錯在邊?

2008-10-09 \ In categorie Unix | Linux | BSD \ No Comments

SERVER# startx
xauth: creating new authority file /root/.serverauth.47373

X.Org X Server 1.4.0
Release Date: 5 September 2007
X Protocol Version 11, Revision 0
Build Operating System: FreeBSD 6.3-STABLE i386
Current Operating System: FreeBSD SERVER.PC 7.0-STABLE FreeBSD 7.0-STABLE #2: Sat Mar 29 07:03:24 HKT 2008 root@SERVER.PC:/mnt/base/system_all/freebsd/obj/mnt/base/system_all/freebsd/src/sys/BEST i386
Build Date: 14 March 2008 01:04:09PM

Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Module Loader present
Markers: (–) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: “/var/log/Xorg.0.log”, Time: Fri Sep 26 22:31:20 2008
(==) Using config file: “/etc/X11/xorg.conf”
(II) Module “ddc” already built-in
(II) Module “ramdac” already built-in
expected keysym, got XF86KbdLightOnOff: line 70 of pc
expected keysym, got XF86KbdBrightnessDown: line 71 of pc
expected keysym, got XF86KbdBrightnessUp: line 72 of pc
expected keysym, got XF86KbdLightOnOff: line 70 of pc
expected keysym, got XF86KbdBrightnessDown: line 71 of pc
expected keysym, got XF86KbdBrightnessUp: line 72 of pc

Fatal server error:
could not open default font ‘fixed’
XIO: fatal IO error 53 (Software caused connection abort) on X server “:0.0″
after 0 requests (0 known processed) with 0 events remaining.

Vista卖得不怎么样

2007-04-02 \ In categorie Windows \ No Comments

尽管在3个月以前,PC厂商还对Vista趋之若骛,生怕在Windows升级换代过程中落伍,现在来看,却已纷纷暗中叫苦,避之唯恐不及。

Acer总裁Gianfranco Lanci近期明确表示,“PC制造商现在已不指望Vista能够带动市场需求。”三星代表也透露,Vista对DRAM市场拉动效果远远没有达到预期水平。国内PC厂商亦无奈,很多新用户都提出卸载Vista,安装普通Windows XP的要求——花了大价钱买正版Vista的联想无疑是最后悔的。

道理其实很简单,当PC用户们揭开Vista的神秘华丽面纱,展开亲密接触,突然发现,IE 7经常“失去响应”,熟悉的软件被拒之门外,Adobe也堂而皇之地宣布现有产品不兼容Vista——PC是拿来用的,操作系统如果不能稳定运行软件,欣赏半透明特效有何用?

普通用户很快明白——Vista目前不是一个稳妥的选择。

PC业给了微软很多机会,媒体的关注,厂商的支持,用户的期待,要怪只能怪微软自己,Vista登场过于仓促,败给了自身的缺陷与不足。

别总拿Vista说事儿,2008年再见

freebsd cannot add user

2007-03-17 \ In categorie Unix | Linux | BSD \ No Comments

帳號資料在系統中存放的位置
/etc/passwd , /etc/master.passwd , /etc/pwd_db , /etc/spwd_db

事實上系統為了存取效率, 實際上系統並沒有直接使用passwd及master.passwd兩個文字檔, 而是將之轉成database型式的另外兩個檔案pwd_db及spwd_db(這是由指令pwd_mkdb所產生的)

%pwd_mkdb -p -d /etc /etc/master.passwd

就可以了

freebsd 不能探測音效卡嗎?

2007-03-16 \ In categorie Unix | Linux | BSD \ No Comments

%kldload snd_driver
試一試用到音效卡嗎? 我不太相信載入所有音效卡的driver都探測唔到音效卡

%cat /dev/sndstat
就會見到類似文字
Installed devices:
pcm0: at io 0×1000 irq 5 kld snd_t4dwave (4p/1r/0v channels duplex default)

snd_t4dwave就是你需要的driver, 當然每部電腦會有不同.

%ee /boot/loader.conf.local
輸入你要的driver
snd_t4dwave_load=”YES”

然後重新開機後就用到了

freebsd RPC port mapper failure

2007-03-09 \ In categorie Unix | Linux | BSD \ No Comments

主要問題在於當啟動Internet Services and Protocols(inetd)後會同時啟動TCP Wrappers,
而TCP Wrappers在/etc/hosts.allow的預設定是會限制rpcbind(因為於rpcbind這行你根本不是用這個ip),

只要設定好,然後再重新啟動inetd, 理論上rpcbind不會再有問題.
#/etc/rc.d/inetd reload

結論是/etc/hosts.allow設定上的問題.

I love freebsd

2007-03-09 \ In categorie Unix | Linux | BSD \ No Comments

我對freebsd 的可用性,穩定,易修復及核心定制等特性而感到驚奇.

自從用了freebsd的作業系統後…..
我忘記了要重組硬盤.
我忘記了藍色畫面.
我忘記了非法軟件.
我忘記了電腦是需要防火牆.
我忘記了甚麼叫電腦病毒甚麼叫間碟及廣告軟件.
我已經忘記了如何format硬盤然後再重新安裝作業系統.
我忘記了要下載作業系統的更新包來修保漏洞.
我忘記了如何重新啟動電腦.

我只記得I love freebsd.

by kwong

Next Page »


Powered by WordPress with Pool theme design by Borja Fernandez. change by kwong
Entries and comments feeds. Valid XHTML and CSS. ^Top^. 13 queries. 0.840 seconds.