Sophos Puremessage for Unix System Requirements
Posted On 2012年5月11日 星期五 at 於 下午1:11 by LaniHow to add an alias ip address to a network card in FreeBSD
Posted On 2011年4月8日 星期五 at 於 下午2:16 by Lani1、How to add an additional IP address to a network card in FreeBSD
# ifconfig em0 192.168.78.242 netmask 255.255.255.255 alias
####################################################
2、Removing an IP alias from a network card in FreeBSD
# ifconfig em0 192.168.78.242 -alias
主機硬碟毀損事件:戰國策低調以對
Posted On 2010年3月4日 星期四 at 於 下午5:10 by Lani文/蘇文彬 (記者) 2010-02-25
事件原因在於老舊硬碟出現壞軌,導致RAID 5硬碟上的備份資料也無法壓縮還原,由於戰國策遲遲不願主動回應解釋,引發外界猜測、批評。
對於客戶抱怨因主機硬碟故障導致網站資料毀損,國內網站代管業者戰國策雖然對受影響客戶提出補償方法,並尋求方法試圖回復資料,但面對客戶抱怨至今仍選擇低調面對,。
戰國策1月底發生主機硬碟故障意外,由於老舊主機硬碟故障,導致該主機上儲存的客戶網站資料無法還原,連帶使得在該主機上營運的客戶網站停擺,引發該公司客戶不滿,在網路上貼文批評戰國策內部管理疏失,事後處理方式草率。
事件發生後由於戰國策低調以對,並未主動回應此事,外界也無法瞭解真相,網友在網路上討論,甚至指出戰國策備份方式是將網站資料與備份資料儲存在相同硬碟,才會導致硬碟毀損連備份資料也無法回復的問題。
據記者了解,這次事件起因在於S5老舊主機上一顆135GB的舊SCSI硬碟出現壞軌,致使該主機上RAID 5硬碟備份的資料也無法壓縮還原資料,因此造成網站資料損毀,戰國策已尋求硬碟資料救援,希望救援毀損的資料,不過由於硬碟毀損相當嚴重,至今仍無法救回被毀損的資料。受影響網站多達80個。
事後,戰國策動員人力清查主機硬碟壞軌情形,並與客戶聯絡,協助客戶將自己備份的資料回復至網站上。
儘管自家主機硬碟毀損造成客戶損害,但巧合的是戰國策在硬碟損毀事件相近的時間點,也在1月底發表線上儲存服務,強調簡單易用、快速與安全的線上儲存、備份服務。
依照戰國策原有服務條約,非人為因素造成客戶損失,戰國策不負賠償責任,人為因素則依情形給予費用折價補償,而這次主機硬碟壞軌因被視為非人為因素,戰國策不需負責,網友批評業者以此推卸責任。
據悉,為挽回商譽,戰國策已對受害客戶提出兩個補償方案供選擇,一是延長主機空間到期日一個月,另一個則是增加5個Email及1GB的主機硬碟空間。不過仍有部份客戶對補償方案不滿意。
目前戰國策選擇低調不回應,僅透過客服處理這起事件。
資料引用:IThome
FreeBSD System Backup Methods2 mini install & tar restore
Posted On 2009年5月20日 星期三 at 於 清晨7:36 by LaniMethods2
if u can install new system in local , it will easy restore system , so fast.
1、backup old system
tar -zcvpf /tmp/backup.tar.gz --exclude=/proc --exclude=/home --exclude=/compat --exclude=/sys --exclude=/mnt --exclude=/tmp --exclude=/lost+found /
2、install mini new system
Filesystem Size Used Avail Capacity Mounted on
/dev/da0s1a 6.3G 2.1G 3.8G 36% /
devfs 1.0K 1.0K 0B 100% /dev
/dev/da0s1e 1.7G 12K 1.6G 0% /tmp
/dev/da0s1d 6.3G 33M 5.8G 1% /var
/ /dev/da0s1a
/var /dev/da0s1d
/tmp /dev/da0s1e
swap /dev/da0s1b
3、old system mount new mini system
mount /dev/da0s1a /tmp/da1
mount /dev/da0s1d /tmp/da1/var
Restore:
cd /tmp/da1
tar -zxvpf /tmp/backup.tgz
ln -s /usr/home /home
FreeBSD System Backup Methods1
Best Regards
========================
Lani
FreeBSD System Backup Methods1
Posted On 2008年12月4日 星期四 at 於 上午11:27 by LaniSystem is online, use tar command backup system os
Backup:
tar -zcvpf /backup.tgz --exclude=/proc --exclude=/compat --exclude=/home --exclude=/sys --exclude=/mnt --exclude=/tmp --exclude=/lost+found --exclude=/backup.tgz /
dd if=/dev/da0 of=/bsd.mbr bs=512 count=1
Restore:
tar -zxvpf /backup.tgz /
mkdir /proc /mnt /tmp
ln -s /usr/compat /compat
ln -s /usr/home /home
ln -s /usr/src/sys /sys
dd of=/bsd.mbr if=/dev/da0 bs=446 count=1
手動分割1
http://www.netlab.cse.yzu.edu.tw/~statue/freebsd/docs/completed/95.shtml.htm
fdisk -i da1
FreeBSD分區為165
DOS分區為6
disklabel -r -w da1s3 auto
disklabel -e da1s3
a這是指 root 分割區,也就是常說的根目錄「/」
b這是指 swap (虛擬記憶體置換裝置)
c這是指整個分配到的主要分層 (Primary Slice)
d這是指整顆硬碟
e可任意使用 (比如︰/tmp)
f可任意使用 (比如︰/var)
g可任意使用 (比如︰/usr)
h可任意使用 (比如︰/home)
newfs /dev/da1s1e
fsck -y /dev/da1s1e
mount /dev/da1s1e /mnt
swapon /dev/da1s1b
手動分割2
fdisk -BI /dev/ad0
bsdlabel -wB /dev/ad0s1
寫入:
bsdlabel -e /dev/ad0s1
bsdlabel /dev/ad0s1 > bsdlabel.txt
讀取:
bsdlabel -R /dev/ad0s1 bsdlabel.txt
newfs /dev/ad0s1a
OS RAID-1(gmirror)
http://www.freebsd.org/doc/zh_TW/articles/remote-install/installation.html
NAS benchmark
Posted On 2008年10月15日 星期三 at 於 下午2:15 by LaniSMall Home NAS benchmark
http://www.smallnetbuilder.com/component/option,com_nas/
Virtualization ESX Server Switch Storage Configure MTU 9000
Posted On 2008年9月29日 星期一 at 於 晚上9:51 by LaniWith the release of VMware Infrastructure version 3.5, VMware added support for jumbo frames. Although the documentation states that jumbo frames “are not supported for NAS and iSCSI traffic”, jumbo frames for NFS and iSCSI does actually work. Here’s some information on getting it working.
How I Tested
Keep in mind that this is not an “officially supported” configuration (see the section on the “Official” Support Statement below), so use at your own risk. I will not be held responsible if you blow up your production environment trying to make jumbo frames work.
Here’s how I tested the use of jumbo frames for software iSCSI and NFS datastores:
- For the physical switch infrastructure, I used a Cisco Catalyst 3560G running Cisco IOS version 12.2(25)SEB4.
- For the physical server hardware, I used a group of HP ProLiant DL385 G2 servers with dual-core AMD Opteron processors and a quad-port PCIe Intel Gigabit Ethernet NIC.
- For the storage system, I used a NetApp FAS940 running Data ONTAP 7.2.4.
The exact commands and/or procedures may be different for you depending upon the hardware and/or software versions that you’re running in your environment. Keep that in mind.
Configuring the Physical Switch
Fortunately for me, the Cisco Catalyst 3560G does indeed support jumbo frames. (Naturally, you’ll want to ensure that your switch supports jumbo frames.) Jumbo frames are not, however, enabled by default; they must be enabled using the following command in global configuration mode:
system mtu jumbo 9000
Note that 9000 bytes seems to be the generally accepted size for jumbo frames, so that’s what I used.
After running this command, you must reboot the switch. The change doesn’t take effect until a reload. Fortunately, IOS reminds you of this after you enter the command. Once the switch has rebooted, you can verify the MTU setting with this command:
show system mtu
This should report that the system jumbo MTU size is 9000 bytes, confirming that the switch is ready for jumbo frames. Now we’re prepared to configure the storage system.
Configuring the Storage System
Using FilerView, increasing the MTU on the appropriate network interfaces to 9000 bytes is as simple as going to Network > Manage Interfaces and then clicking the Modify link for the interface to be changed. Set the “MTU size” to 9000 (from the default of 1500), click Apply, and you’re ready to roll.
You can verify the settings in FilerView using Network > Manage Interfaces > Show All Interface Details, or by using the “ifconfig -a” command from a Data ONTAP command prompt.
Configuring ESX Server
There is no GUI in VirtualCenter for configuring jumbo frames; all of the configuration must be done from a command line on the ESX server itself. There are two basic steps:
- Configure the MTU on the vSwitch.
- Create a VMkernel interface with the correct MTU.
First, we need to set the MTU for the vSwitch. This is pretty easily accomplished using esxcfg-vswitch:
esxcfg-vswitch -m 9000 vSwitch1
A quick run of “esxcfg-vswitch -l” (that’s a lowercase L) will show the vSwitch’s MTU is now 9000; in addition, “esxcfg-nics -l” (again, a lowercase L) will show the MTU for the NICs linked to that vSwitch are now set to 9000 as well.
Second, we need to create a VMkernel interface. This step is a bit more complicated, because we need to have a port group in place already, and that port group needs to be on the vSwitch whose MTU we set previously:
esxcfg-vmknic -a -i 172.16.1.1 -n 255.255.0.0 -m 9000 IPStorage
This creates a port group called IPStorage on vSwitch1—the vSwitch whose MTU was previously set to 9000—and then creates a VMkernel port with an MTU of 9000 on that port group. Be sure to use an IP address that is appropriate for your network when creating the VMkernel interface.
To test that everything is working so far, use the vmkping command:
vmkping -s 9000 172.16.1.200
Clearly, you’ll want to substitute the IP address of your storage system in that command.
That’s it! From here you should be able to easily add an NFS datastore or connect to an iSCSI LUN using jumbo frames from the ESX server.
“Official” Support Statement
Officially, jumbo frames are only supported by VMware for use by virtual machines. Technically, VMware does not support the use of jumbo frames for the software iSCSI initiator or for use with NFS datastores. At least, that’s my understanding.
So, feel free to tinker around with jumbo frames for IP-based storage, and when VMware adds official support for it in the future—I can’t imagine why they wouldn’t—then you’ll be able to hit the ground running with the configuration steps necessary to make it work.
Data link from : http://blog.scottlowe.org/2008/04/22/esx-server-ip-storage-and-jumbo-frames/
Freebsd add new SCSI Disk
Posted On 2008年8月19日 星期二 at 於 中午12:22 by Lani#camcontrol all
#disklabel -r -w da1s1 auto
# disklabel -e da1s1
# /dev/da1s1c:
type: SCSI
disk: IBM
label:
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 1114
sectors/unit: 17912412
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0 # milliseconds
track-to-track seek: 0 # milliseconds
drivedata: 0
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
c: 17912412 0 unused 0 0 # (Cyl. 0 - 1114*)
~
# newfs /dev/da1s1c
Warning: Block size and bytes per inode restrict cylinders per group to 89.
Warning: 3492 sector(s) in last cylinder unallocated
/dev/da1s1c: 17912412 sectors in 4374 cylinders of 1 tracks, 4096 sectors
8746.3MB in 50 cyl groups (89 c/g, 178.00MB/g, 22144 i/g)
super-block backups (for fsck -b #) at:
32, 364576, 729120, 1093664, 1458208, 1822752, 2187296, 2551840, 2916384,
3280928, 3645472, 4010016, 4374560, 4739104, 5103648, 5468192, 5832736,
6197280, 6561824, 6926368, 7290912, 7655456, 8020000, 8384544, 8749088,
9113632, 9478176, 9842720, 10207264, 10571808, 10936352, 11300896, 11665440,
12029984, 12394528, 12759072, 13123616, 13488160, 13852704, 14217248,
14581792, 14946336, 15310880, 15675424, 16039968, 16404512, 16769056,
17133600, 17498144, 17862688
#mount /dev/da1s1c /data1
#df -h
可參考freebsd handbook作法:
http://www.freebsd.org/doc/zh_TW/books/handbook/disks-adding.html
MS SQL 2005 Server Change Listen Port
Posted On 2008年8月7日 星期四 at 於 上午9:19 by Lani"SQL Server Configuration Manager"
in menu "Start -> All Programs -> Microsoft SQL Server 2005 -> Configuration Tools -> SQL Server Configuration Manager",把TCP/IP設Enabled
SQL Server 2005 網路組態 -> MSSQLServer 的通訊協定 -> TCP/IP -> IP位址 -> TCP 通訊埠
MSSQL Server 改 port:
修改前:
1433
修改後:
15000
MSSQL Server 多聽一個 port:
修改前:
1433
修改後:
1433,15000
Yahoo 無名小站 -- 被我看到壞了
Posted On 2008年8月1日 星期五 at 於 凌晨2:15 by Lani安裝 PHP 支援 GD
Posted On 2008年7月18日 星期五 at 於 上午9:54 by LaniGD 安裝
第一部需要做的是先要安裝 GD 到系統內,而安裝 GD 前需要安裝 jpeg-6b, libpng, zlib。以下是下載網址:
GD 2.0.33
jpeg-6b
libpng 1.2.8
zlib 1.2.2
下載完成後鍵入以下指令進行安裝。
安裝 zlib
01 tar zxvf zlib-1.2.2.tar.gz
02 cd zlib-1.2.2
03 ./configure
04 make
05 make install
安裝 libpng
01 tar zxvf libpng-1.2.8-config.tar.gz
02 cd libpng-1.2.8-config
03 ./configure
04 make
05 make install
安裝 jpeg-6b
01 tar zxvf jpegsrc.v6b.tar.gz
02 cd jpeg-6b
03 ./configure
04 make
05 make install
安裝 GD
01 tar zxvf gd-2.0.33.tar.gz
02 cd gd-2.0.33
03 ./configure
04 make
05 make install
因為以上各套件均使用預設值安裝,所以安裝時所遇到的問題會較少,下一步需要配置 PHP 。
PHP 配置
現在需要重新編譯 PHP,並選擇支援 GD,如果系統內已刪除了 PHP 的原始碼,可以到 php.net 下載,然後輸入以下指令:
01 tar zxvf php-4.3.11.tar.gz
02 cd php-4.3.11
03 ./configure --with-apxs2=/usr/local/apache/bin/apxs --with-mysqli=/usr/local/mysql/bin/mysql_config --prefix=/usr/local/php --with-gd --with-zlib-dir=/usr/local
04 make
05 make install
以上在 ./configure 裡的選項只可以參考,在編譯時必須根據自己的環境配置而修改,而 --with-gd 及 --with-zlib-dir=/usr/local 就是設定成支援 GD。
====================================================
歡迎轉載,但轉載時請保留此宣告,不得作為商業用途
作者: Sam Tang
來源網站: http://www.phpdc.com/
http://www.phpdc.com/article/21/
FreeBSD Rescan SCSI device
Posted On 2008年7月14日 星期一 at 於 下午2:24 by LaniPav said I should now be able to see the CD-RW as a SCSI device. I started searching:
# camcontrol rescan all
FreeBSD 重新抓取 SCSI 裝置
參考資料:http://www.freebsddiary.org/cdrecord-ide.php
Freebsd make kernel
Posted On 2008年6月13日 星期五 at 於 上午10:40 by LaniProcedure 1. Building a Kernel the “Traditional” Way
1.Run config(8) to generate the kernel source code.
# /usr/sbin/config MYKERNEL
2.Change into the build directory. config(8) will print the name of this directory after being run as above.
# cd ../compile/MYKERNEL
For FreeBSD versions prior to 5.0, use the following form instead:
# cd ../../compile/MYKERNEL
3.Compile the kernel.
# make depend
# make
4.Install the new kernel.
# make install
Procedure 2. Building a Kernel the “New” Way
1.Change to the /usr/src directory.
# cd /usr/src
2.Compile the kernel.
# make buildkernel KERNCONF=MYKERNEL
3.Install the new kernel.
# make installkernel KERNCONF=MYKERNEL
8.3 重新調配、編譯 kernel
Network File System (NFS)
Posted On 2008年5月27日 星期二 at 於 中午12:03 by Lani最近因為Mail server 使用NFS方式 mount nas ,
但是一直因為NFS server file lock,造成NFS client cyrus ioerror:
IOERROR: locking header for user.lani: Operation not supported
NFS Server and NFS Client OS 皆是FreeBSD
為了解此問題,所以查詢了一下NFS man page.
其實Frebsd NFS 針對 locking 說明:
If real locking between the NFS clients and NFS server is not required, it is possible to let the NFS client do locking locally by passing -L to mount_nfs(8). Refer to the mount_nfs(8) manual page for further details.
參考資料:
FreeBSD mount NFS file systems
mount_nfs -- mount NFS file systems
Red Hat Enterprise Linux Reference Guide Network File System
基本設定可參考此說明:
http://turtle.ee.ncku.edu.tw/~ac/FreeBSD/50_NFS/nfs.html
http://mgtcc.mgt.ncu.edu.tw/faq_in.php?op=Linux&oop=NFS.htm
BSD big5 to utf8
Posted On 2008年5月14日 星期三 at 於 下午5:10 by Lani將 big5 的文字檔轉換為 utf8 的文字檔
Usage: iconv [-c] [-s] [-f fromcode] [-t tocode] [file ...]
or: iconv -l
iconv -l :顯示支援的字形
iconv -f BIG5 -t UTF-8 big5.txt > utf8.txt
FreeBSD CARP ( Common Access Redundancy Protocol ) 設定與測試方法
Posted On 2008年3月20日 星期四 at 於 中午12:15 by Lani測試前說明:
使用三台主機作測試,兩台Server,一台Client,
dk.oio.idv.tw 192.168.78.1
dk1.oio.idv.tw 192.168.78.2
dk2.oio.idv.tw 192.168.78.3
dk3.oio.idv.tw client
1、先將兩台Server,於kernel中,增加一個device carp,再重新編譯kernel。
device carp
2、於dk1、dk2,執行以下步驟:
a、device使用carp portocol
#sysctl net.inet.carp.allow=1
執行後:
net.inet.carp.allow: 0 -> 1
b、建立一個carp5的interface
#ifconfig carp5 create
執行後:
carp5: flags=8
c、設定carp5 VHID IP Netmask,** VHID是重點:這會影嚮carp5 mac address
#ifconfig carp5 vhid 5 192.168.78.1 255.255.240.0
dk1 查視 carp5 interface
#ifconfig carp5
carp5: flags=49
inet 192.168.78.1 netmask 0xffffff00
carp: MASTER vhid 5 advbase 1 advskew 0
/var/log/message
dk1 kernel: em0: promiscuous mode enabled
dk2 查視 carp5 interface
#ifconfig carp5
carp5: flags=49
inet 192.168.78.1 netmask 0xffffff00
carp: BACKUP vhid 5 advbase 1 advskew 0
/var/log/message
dk2 kernel: em0: promiscuous mode enabled
dk3 client ping dk.oio.idv.tw 測試封包不中斷。
dk1
#ifconfig carp5 down
carp5: flags=8
inet 192.168.78.1 netmask 0xffffff00
carp: INIT vhid 5 advbase 1 advskew 0
dk2
1、/var/log/message 會先收到
dk2 kernel: arp_rtrequest: bad gateway 192.168.78.241 (!AF_LINK)
2、會自動變成Master
carp5: flags=49
inet 192.168.78.1 netmask 0xffffff00
carp: MASTER vhid 5 advbase 1 advskew 0
3、會自動接起 dk.oio.idv.tw,文件說1/256 sec
自動接下送往192.168.78.1封包
--- dk.oio.idv.tw ping statistics ---
509 packets transmitted, 509 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.100/0.222/0.424/0.051 ms
dk1 重啟後,並不會自動轉為Master
#ifconfig carp5 up
/var/log/message 會收到
dk1 kernel: arp_rtrequest: bad gateway 192.168.78.241 (!AF_LINK)
#ifconfig carp5
carp5: flags=49
inet 192.168.78.241 netmask 0xffffff00
carp: BACKUP vhid 5 advbase 1 advskew 0
如希望dk1,恢復後可以自動轉為Master,則須在dk1、dk2執行以下指令
#sysctl net.inet.carp.preempt=1
引用資料:http://www.openbsd.org/faq/pf/carp.html#carpconfig
grep & 統計 & 排列 常用指令
Posted On 2008年1月24日 星期四 at 於 晚上11:33 by Lanicat /var/log/maillog #讀取郵件紀錄
#以 relay= 為分隔點, 列出"relay="以後
| awk '{FS="relay=";print $2}'
#以 ] 為分隔點, 列出"relay="以前
| awk '{FS="]";print $1}'
#由0-9 & a-z 作排序
| sort
#統計相同資料的數量
| uniq -c
#將統計的數量遞減排序
| sort -r
grep 搜尋含有字串的該行資料
| grep "Sep 4"
| grep "unknown"
grep 搜尋不含"User unknown"的該行資料
| grep -v "User unknown"
bzcat 寫法如下 :
#bzcat maillog.* | awk '{FS="relay=";print $2}' | awk '{FS="]";print $1}' | sort | uniq -c | sort -r
引用:4wei-diary
tar 用法
Posted On 2008年1月17日 星期四 at 於 下午1:50 by Lani參數說明:
c, --create 建立新的備份檔
f, --file 指定檔案
r, --append 新增檔案至備份檔結尾
--delete 將 .tar 中的某個檔案刪除
t, --list 列出備份檔內檔案清單
u, --update 僅置換檔案更新部分
v, --verbose 顯示指定執行過程
z, --gzip, --unzip 透過 gzip 處理備份檔
x, --extract 還原備份檔
-C 指定還原路徑
指令範例:
1.tar cfv back.tar /backup
2.tar czf back.tar.gz /backup
3.tar xf back.tar
4.tar xzf back.tar
5.tar tf back.tar
6.tar tfv back.tar
7.tar --delete -vf back.tar backup/srm.conf
8.tar xf back.tar -C /root
Disable Linux IPv6
Posted On 2008年1月16日 星期三 at 於 下午3:52 by Lani大部份現有的系統安裝完,IPv6 (Internet Protocol Version 6) 預設是開啟的,但實際上不需要 IPv6 支援,關閉 IPv6 可用方法:
Debian / Ubuntu
1. 開啟 /etc/modprobe.d/aliases
2. 裡面有一行是 "alias net-pf-10 ipv6"
3. 將以上一行用以下兩行取代:
alias net-pf-10 off
alias ipv6 off
Red Hat
1. 開啟 /etc/modprobe.conf
2. 加入這一行:
alias net-pf-10 off
MySQL 編譯問題
Posted On 2007年12月27日 星期四 at 於 上午11:27 by Lani編譯 MySQL 出現 "Linux thread not found" error
執行以後
# ./configure
出現error message
checking “LinuxThreads”… “Not found”
先執行以下指令,再重新編譯即可。
echo '/* Linuxthreads */' >> /usr/include/pthread.h
