廣告

2026 年 4 月
 12345
6789101112
13141516171819
20212223242526
27282930  

彙整

Large Mailbox threshold 40MB之Syslog警訊

發現Syslog只要信箱超過40MB都會出現警訊:

Large Mailbox threshold: 40MB (41943040 bytes)
  Warning: Large mailbox: teresa.wu (1151343331)
  Warning: Large mailbox: karen.wang (489717393)

GOOGLE了一下知道怎麼改這個設定:

在 [root@mail ~]# vi /usr/share/logwatch/default.conf/services/sendmail-largeboxes.conf中 <==CentOS 5.5內位置有變動

  # Mailbox size threshold

# can add units KB, MB, GB, TB

# can set to 0 to report spool files being created where they shouldn't

sendmail_largeboxes_size = 40MB

# 改為希望的大小就可以了。

 

文章出處:http://linuxdiary.blogspot.com/2008/10/logwatch.html

Winmail.dat -TNEF格式文件

今天看mail server log看到這樣的訊息:

Message C187524D806E.A9FB1 has had TNEF winmail.dat removed : 1 Time(s)

再查MAILLOG看到:

Oct 27 12:14:35 mail MailScanner[28827]: New Batch: Scanning 1 messages, 50620 bytes
Oct 27 12:14:35 mail MailScanner[28827]: Expanding TNEF archive at /var/spool/MailScanner/incoming/28827/C187524D806E.A9FB1/winmail.dat
Oct 27 12:14:35 mail MailScanner[28827]: Message C187524D806E.A9FB1 has had TNEF winmail.dat removed
Oct 27 12:14:35 mail MailScanner[28827]: Virus and Content Scanning: Starting
Oct 27 12:14:36 mail MailScanner[28827]: Requeue: C187524D806E.A9FB1 to 5610124D80C9

然後GOOGLE一下:TNEF找到下面文章,文章出處:http://translate.google.com.tw/translate?hl=zh-TW&sl=zh-CN&u=http://moment.blog.51cto.com/1125796/330328&ei=HNfITMaCLIGivQPW7tiVCQ&sa=X&oi=translate&ct=result&resnum=9&ved=0CFUQ7gEwCA&prev=/search%3Fq%3DTNEF%26hl%3Dzh-TW%26sa%3DG%26biw%3D1280%26bih%3D905

Winmail.dat -TNEF格式文件

今天看到有個同事收到的郵件,裡邊有個奇怪的附件Winmail.dat不知道怎麼打開,信裡也沒別的有效內容了,沒辦法,只好動用法寶先用記事本強制打開發現含有IPM. Microsoft Mail.Note之類的信息。 再動用google才了解到,原來這是微軟的Email傳輸不確定封裝格式,直接用MS Office Outlook收取才能打開,如果用其它終端收取再用MS Office Outlook 也無法識別打開。 後來在網上找到了好幾個開這種附件的軟件,發現這個Winmail Opener最好用。 放在這裡,方便大家,下載地址: http://www.eolsoft.com/download/winmail_opener.exe

順便介紹一下相關知識:
TNEF
Exchange Server 2003 使用傳輸不確定封裝格式(TNEF) 將MAPI 郵件轉換為RFC 822 格式。 TNEF 以application/ms-tnef 類型的MIME 附件的形式出現在郵件中。 該附件的名稱為Winmail.dat。 它包含完整的郵件內容以及所有附加文件。 只有MAPI 客戶端(如Outlook)能夠對Winmail.dat 附件進行解碼。 非MAPI 客戶端無法對TNEF 進行解碼,並且可能將Winmail.dat 顯示為典型但無用的文件。
Note :
在以下幾種可能的Exchange 對Exchange 傳輸情形下,必須進行MAPI 到RFC 822 的轉換:
收件人在同一路由組中的Exchange 服務器上Exchange Server 2003 將MAPI 郵件轉換為Summary-TNEF (S/TNEF) 格式,這是一種特殊的傳輸不確定封裝格式(TNEF),沒有純文本部分,並且以八位的二進制格式傳送。 S/TNEF 郵件僅僅包含Winmail.dat。 Note :
收件人在另一個路由組中的Exchange 服務器上,並且Exchange 組織在純模式下工作Exchange Server 2003 將MAPI 郵件轉換為Summary-TNEF (S/TNEF) 格式,因為純模式下的Exchange 組織只能包含支持二進制MIME 的Exchange 2000 Server 服務器和Exchange Server 2003 服務器。
收件人在另一個路由組中的Exchange 服務器上,並且Exchange 組織在混合模式下工作在混合模式下,有可能將Exchange Server 5.5 的Internet 郵件服務用作SMTP 連接器,但是Internet 郵件服務不支持二進制MIME。 由於S/TNEF 的RFC 822 表示(由IMAIL 產生)是二進制MIME,因此Internet 郵件服務無法傳輸S/TNEF 郵件。 由於Exchange 分類程序無法預先檢測到郵件將採用什麼路由路徑,因此在混合模式下,分類程序不為本地路由組外部的服務器上的收件人進行郵件轉換,也就是不將郵件轉換為S/TNEF 。 為了在傳輸路徑中容納可能的Internet 郵件服務實例,Exchange 分類程序將郵件轉換為純文本部分以及舊版TNEF 格式附件。 舊版TNEF 格式是Internet 郵件服務能夠傳輸的七位MIME。
收件人是本地Exchange 組織之外的MAPI 收件人用戶和管理員可以為外部郵件環境中使用Outlook 的收件人啟用跨本地Exchange 組織邊界的TNEF 傳輸。 由於收件人不在本地Exchange 組織中,Exchange 分類程序無法確定郵件傳輸中涉及到的所有SMTP 主機是否都支持二進制MIME。 因此,Exchange 分類程序將郵件轉換為純文本部分以及舊版TNEF 格式的附件。

Note :
發送到公用文件夾中的MAPI 郵件發送到公用文件夾中的郵件始終以舊版TNEF 格式中繼。 本節後面提供了有關公用文件夾郵件處理的詳細信息。
通過SMTP 發送到展開服務器的MAPI 郵件如果郵件包含通訊組列表,並且明確指定的展開服務器不是本地服務器,郵件將以舊版TNEF 格式轉發到展開服務器(如果使用SMTP 傳輸郵件)。 在這種情況下,會將一個屬性放入郵件傳輸信封中通過XEXCH50 傳輸。 該屬性通知展開服務器最初通過Exchange 存儲驅動程序收到郵件的時間。 展開服務器上的分類程序展開通訊組列表後,必須分別對每個收件人應用有效的RFC 822 郵件格式。 分類程序使用Exchange 存儲驅動程序將郵件複製到Exchange 存儲中,IMAIL 再從Exchange 存儲中讀取TNEF 數據並用原始郵件的提交時間構建MAPI 郵件。 之後,SMTP 傳輸子系統便能夠從存儲中讀取符合收件人格式要求的RFC 822 格式MAPI 郵件。
可以通過添加以下註冊表項,控制發送郵件的TNEF 格式行為。 數字nn 代表此計算機的虛擬服務器實例。
位置HKey_Local_Machine\Software\Microsoft\Exchange\StoreDriver\Exchange\ nn \EnableTnef
值Disabled
類型REG_DWORD
數值數據0×0
描述如果值為0×0,則禁用TNEF,不使用TNEF 生成郵件。 如果值為0×1,則使用舊版TNEF 生成郵件,此時通常生成S/TNEF。 值為0×2 則沒有任何影響,因為這是默認行為。

Postfix 郵件格式由 mbox 轉 maildir – 解決mbox LOCK與alias群組重複收信問題

2010-10-27

mbox 與 maildir 優缺點比較:

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

mbox 與 maildir 之優缺點比較

這裡給出一個基本的特性對比,很容易就能清楚自己的程式應該選什麼存儲格式:

可靠性

優選是 maildir,因為 mbox 只有一個檔案,一旦出問題,所有郵件可能一併損毀。

更新效能

這裡主要指的是刪除/ 增加郵件的能力,無疑 maildir 完勝 mbox

搜尋速度

這點 mbox 因為是單檔案,搜尋能力要強於 maildir

並行存取能力

對於繁忙的郵件系統,多個 Process 同時存取同一封郵件是可能的事情,mbox 需要 flock() 的支援,而且如果某一個 Process 操作時間長,則其他所有 Process 都堵塞了。maildir 沒有這個問題。在 NFS 等網路檔案系統上,maildir 相對安全,mbox 則不能用於此類型環境

擴充能力

現下的郵箱容量已經不是十年前的 MB, 而是 GB,mbox 應付大容量已力不從心,無疑 maildir 是比較適合的。

檔案系統倚賴

maildir 較倚賴檔案系統的索引能力,用 ReiserFS 會比較快,對於超大型的 maildir,讀寫性能將受到考驗。相對而言 mbox 則不存在這個問題。

總合結論

使用 maildir 格式,安全可靠,大部分操作都快於 mbox。而且現今支援 maildir 的軟體越來越多。

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

 

2010-10-26

1.轉換信件後變成一封信一個檔案,因權限沒正確修改好,故手動修正了好一陣子 >_<

2.
/var/spool/maildir/帳號/cur <=看過的信如果還保留在SERVER上的信就存這
/var/spool/maildir/帳號/new <=新進的信還沒看過就存這
/var/spool/maildir/帳號/tmp <=收信件暫存區,收完信後才移到new

3.換了這個maildir格式後,感覺MAIL SERVER很順,以前收發都會卡,可能就是因為mbox的LOCK機制造成。

4.用maildir格式要是使用者人很多,且都有留幾天信在SERVER上的習慣,那要特別留意檔案數量與 Inode 數量,超過就無法在寫入磁碟。

[root@mail ~]# df -i
檔案系統              Inode    I已用  I可用 I已用% 掛載點
/dev/sda1            3840192   24549 3815643    1% /
/dev/sda6            98074624   10654 98063970    1% /var
/dev/sda3            2560864  117080 2443784    5% /usr
/dev/sda2            25624576   10116 25614460    1% /home
tmpfs                 221892       1  221891    1% /dev/shm

 

2010-10-25

Postfix 郵件格式由 mbox 轉 maildir ,maildir格式可避免mbox格式 LOCK鎖檔案造成 aliases 的群組人員重複收到信。

格式說明出處:http://www.creativecrap.com/story/software/mbox-to-maildir

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

mbox mail storage format

這是傳統的郵件格式,將所有的信件都存在一個檔案中,所以相對的會有很多的缺點,包含當檔案太大時存取的效率即變差,若郵件檔損毀則所有的信件都沒了,同時只能有一個 process 存取,第二個 process 須等第一個 unlock 之後,才能存取。優點應該是簡單,單一檔案搜尋時較快,大部份預設值都還是 mbox,備份時也方便,因為只有一個檔案。

maildir mail storage format

這就是比較新的格式,沒記錯的話早先是由 Qmail 開始使用。將每一封信件就單獨存成一個檔案。相對於 mbox 的缺點即 maildir 的優點,反過來搜尋速度就是 maildir 的缺點了。

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

以下是看旗標 Linux Mail Server 技術實務來測試轉換(因自架MAIL SERVER於VM中,故先行快照,避免有問題時可回復原狀)

停止 MTA 服務(Mailscanner)
[root@mail ~]# /etc/init.d/MailScanner stop
Shutting down MailScanner daemons:
         MailScanner:                                      [  確定  ]
         incoming postfix:                                 [  確定  ]
         outgoing postfix:                                 [  確定  ]

[root@mail ~]# /etc/init.d/dovecot stop
正在停止 Dovecot Imap:                                     [  確定  ]

建立 maildir 格式存放目錄:
[root@mail ~]# mkdir /var/spool/maildir

查看原先mbox存放目錄的擁有者
[root@mail ~]# ls -ld /var/spool/mail
drwxrwxr-x 2 root mail 4096  1月 27  2010 /var/spool/mail

建立 maildir 與 mbox 目錄一樣的擁有者權限
[root@mail ~]# chown root.mail /var/spool/maildir/

建立 maildir 目錄存取權限
[root@mail ~]# chmod 1777 /var/spool/maildir/

修改 vi /etc/postfix/main.cf
[root@mail ~]# vi /etc/postfix/main.cf
………
home_mailbox = Maildir/
mail_spool_directory = /var/spool/maildir/
mailbox_command = /usr/bin/procmail -a "$EXTENSION" DEFAULT=/var/spool/maildir/$USER/ MAILDIR=/var/spool/maildir/$USER/ <==指定收件路徑,不指定會送到mbox信箱
………

修改 vi /etc/dovecot.conf
[root@mail ~]# vi /etc/dovecot.conf
……
mail_location = maildir:/var/spool/maildir/%u (書上寫的是 default_mail_env = maildir:/var/spool/maildir/%u,不過裡面是寫我前面的樣式。)
……

將mbox轉maildir格式:

安裝perl-5* perl-TimeDate*
yum install perl-5* perl-TimeDate*

下載安裝 mb2md
[root@mail ~]# wget http://batleth.sapienti-sat.org/projects/mb2md/mb2md-3.20.pl.gz
[root@mail
~]# gzip -d mb2md-3.20.pl.gz
[root@mail ~]# chmod +x mb2md-3.20.pl
[root@mail ~]# mv mb2md-3.20.pl /usr/local/bin/mb2md

建立 mbox 轉 maildir 批次執行檔:
vim /usr/local/bin/allmb2md
==================================
#!/bin/sh

#設定原本mbox格式郵件目錄
MBOXDIR="/var/spool/mail"

#設定maildir格式目錄
MAILDIR="/var/spool/maildir"

cd $MBOXDIR

for user in *; do
  mkdir -p $MAILDIR/$user
  mb2md -s $MBOXDIR/$user -d $MAILDIR/$user/
  chmod -R 700 $MAILDIR/$user/
  chown $user.mailuser $MAILDIR/$user/   <==這邊若使用者名稱為 名.姓 Roger.Lin 則要使用 :號區隔群組  Roger.Lin:mailuser
done
===================================

給權限
[root@mail ~]# chmod +x /usr/local/bin/allmb2md

執行轉換
[root@mail ~]# allmb2md

POSTFIX MAILQ 指令集 – 管理MAIL Queue

 
文章出處:http://blog.yam.com/rei92/article/28165379
 
如果你要套用其中一筆 Queue 中的郵件,可以先用 mailq 或 postqueue 指令查詢出或篩選出你要重新排 Queue 的郵件 ID,並使用以下指令重新排 Queue:
#postsuper -r 7B8CE830BD

若要套用「所有」郵件,可以使用特殊的 ALL 關鍵字:
#postsuper -r ALL

最後再強制重送所有的信件
#postqueue -f

檢視剩下多少Queue
#postqueue -p

若還是不行的話… 那就考慮刪除掉吧XD

# 列出目前在 Mail Queue 中的信件
    mailq

# 刪除某一個佇列的郵件
   postsuper -d queue_id

# 刪除所有在 Queue 中的郵件
    postsuper -d ALL

# 刪除所有正在 deferred 佇列中的郵件 ( 刪除曾經發送失敗的信 )
    postsuper -d ALL deferred

# 刪除所有正在 deferred 佇列中的郵件 ( 可看出哪些信被刪除了 )
    find /var/spool/postfix/deferred -type f -exec rm -vf \{\} \;

# 刪掉「三天以前」無法發出的郵件
    find /var/spool/postfix/deferred -type f -mtime +3 -exec rm -f \{\} \;

# 列出目前所有無法發出的郵件
    find /var/spool/postfix/deferred -type f -exec ls -l –time-style=+%Y-%m-%d_%H:%M:%S {} \;

# 刪除超過 5 天的 "defer" 佇列中的退信紀錄
    find /var/spool/postfix/defer -type f -mtime +5 -exec rm -f \{\} \;

若你發現在MailQ裡面有相同的地址大量寄送垃圾信件時,可以透過下面的方式來擋掉…

# vi /etc/postfix/header_checks
# 加入要擋掉的來原信
/^From:.service\@kcg\.gov\.tw/ DISCARD Attack Mail

# postmap -q – regexp:/etc/postfix/header_checks < /etc/postfix/header_checks
# 重新讓 Postfix 新 header_checks 生效

# mailq | grep "xxx@abc.com" | cut -d " " -f1 | cut -d’*’ -f1 | postsuper -d –
# 刪掉所有來自xxx@abc.com的MailQ

此內容轉貼自: Mail Attack & Delete Postfix selected mailq

預設所有跟 Postfix 相關的郵件都會放在 /var/spool/postfix/ 目錄下,
想瞭解 Postfix 是如何管理 Mail Queue 的可以參考 qmgr – Postfix queue manager 的手冊。

以下是每個目錄摘要的說明其用途:

MAIL QUEUES

    *
      incoming

          從網路寄信進來本機的信。
          或從本地寄送到本地的信。
    *
      active

          正在準備發送的郵件。
    *
      defered

          無法傳送的信。會持續重試。
    *
      corrupt

          無法讀取或毀損的信。
    *
      hold

          被暫停發送的信。需要手動開啟才會發出。

DELIVERY STATUS REPORTS

    *
      bounce

          每一位收件者的寄送狀態資訊,說明為什麼被「退信」。
          由 bounce(8) 程式控管
    *
      defer

          每一位收件者的寄送狀態資訊,說明為什麼被「延遲寄信」。
          由 defer(8) 程式控管
    *
      trace

          每一位收件者的寄送狀態資訊,說明被 Postfix 用 "sendmail -v" 或 "sendmail -bv" 指令執行過的狀態。
          由 trace(8) 程式控管

postfix 延持與重複收信–unable to lock for exclusive access: Resource temporarily unavailable 訊息作怪–更新20101022

使用/etc/aliases的群組方式,在Postfix為MBox的模式下,因外站遠端連入收信時間很久,故會遇到MBOX模式下 LOCK 檔案造成重複收信的問題,解決這個LOCK的最根本方式就是把 Mbox 改為 maildir 的格式,這兩個格式的介紹:

http://www.extmail.org/forum/viewthread.php?tid=10560&extra=page%3D1&frombbs=1

今天晚上在花時間轉格式看看。

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

最近我又遇到這個問題,兩間公司合併但還是各自獨立網段,MAIL SERVER 整合後另一邊外站人太多,又習慣用 mail 傳檔, 2M上傳每天都滿載…..又因群組關係,每封信一卡就是好久,重複收信狀況超嚴重,信件延持收到也是很誇張,剛自己寫了個script,然後每10分鐘跑一次,同用到啟用中斷過程非常微小,卻可以把mailq內老是積50封因LOCK問題的信給寄出去清乾淨.

小插曲…如果有個天兵寄了5MB以上的檔案,想想看外站如果40個人同時收這信,2M上傳不知道要傳到何時才能把信傳給大家,這時候又中斷大家收信……想想USER又要重收信,看來要用這個Script真的要小心.

#!/bin/bash
/etc/init.d/dovecot stop
postqueue -f
/etc/init.d/dovecot start

已參照下面修改,暫時停止上面的SCRIPT,星期一再來觀察吧……

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

文章出處:http://blog.yam.com/ymwen/article/25977088

mail 的 mbox 檔案由於有可能有兩支程式同時存取的問題,所以需要注意 file lock 的問題,不當的設定可能會造成 deadlock 產生,此時只能重啟 mail service 或將 lock 的 process kill 掉才能解套。
以 mail server 來說,我用的是 Postfix + dovecot,怎麼設定兩邊的 lock 方法,可以參考 http://wiki.dovecot.org/MboxLocking 的說明,主要是兩支程式的鎖定的方法與順序要一致就對了。
我的 postfix 裡的 main.cf 設定:

deliver_lock_attempts = 20 # 嘗試 20 次
deliver_lock_delay = 1s # 每次間隔 1 秒
mailbox_delivery_lock = dotlock, fcntl # 使用系統呼叫的 dotlock 或 fcntl
stale_lock_time = 500s # 500 秒後 lock 失效
virtual_mailbox_lock = dotlock, fcntl # virtual mailbox 的設定 (這個我沒在用也不懂)

我的 dovecot.conf 的設定:

mbox_read_locks = fcntl
mbox_write_locks = dotlock fcntl

不過我遇到了另外一個問題是,mail server 有設定 alias 信箱的情況下,若在寄送給 alias 的轉寄過程中,剛好有一位 alias list 裡的 user mbox 剛好是 lock 的話 (可能正在用 dovecot pop3 收信),mail server 就會因此 fail 而再寄一次,造成其他 alias list 的人收到這封信超過兩次以上。
目前這個問題我尚無解,尤其當有同事在國外收大檔的信件時整個收信時間比較久,剛好別的同事發個公告到 alias 信箱,就會造成全公司同事可能收到三四封公告。
我現在是先加大了 deliver_lock_attempts 和 deliver_lock_delay 的值,讓 postfix 可以試得久一點 (20 x 1s 加大為 30 x 20s),減低遇到 lock 的機會,但偶爾還是會遇上,並非根本辦法就是了。
2010 年 5 月 20 日補充
在 Dovecot 的 wiki 中有提到,dotlock 是很常見的 mbox lock 方式,但是 lock 可發生在讀取 / 寫入兩種事情上面,而讀取上 dotlock 方式並不太具有效能,我猜想是因為讀取不太需要完整的 lock, 寫入才需要很嚴謹的 lock 的緣故?
不管如何,我們發現在 dovecot 安裝完成後,dovecot 在 mbox_read_locks 的設定預設是 fcntl,mbox_write_locks 的設定預設則使用了 dotlock fcntl。換句話說 dovecot 想要使用效能相對較快的 fcntl 來讀 mbox,但可以讓其他 process (可能是另一個 pop3,或是 postfix) 採用 dotlock 來寫。
而 postfix 預設的設定卻是 mailbox_delivery_lock = fcntl, dotlock,看來 postfix 也想使用 fcntl 來 lock 它的 mbox,但 dovecot 的 wiki 明白指出,如果 lock 方法的順序不一樣,可能會造成 deadlock。
所以我就以 postfix  不動為主,把 dovecot 的 mbox_write_locks 預設順序對調,但幾個月觀察下來,某個 user 的 mbox 因為超過 1GB,常會發生 pop3 意外終止的情形,我不知道這是怎麼回事,也拉長了 Outlook 在收信時的逾時設定,但是就不見改善。
因此我回過頭來思考,dovecot 要處理讀與寫 mbox 的工作,postfix 則只要處理寫這件事,我是不是應該以 dovecot 的預設設定比較好呢?所以我就把 dovecot 的設定調回來,而更改了 postfix 寫 mbox 的 lock 方法順序,接下來就持續觀察是否有改善了…

我要一個大手機~~SAMSUNG GALAXY Tab 無限機重量僅 380g 的輕薄精巧外觀設計,是 Apple iPad 的一半。

這個產品真屌,不過如果可以變成軟螢幕折疊,攜帶更方便,我想離這項科技不遠了!

SAMSUNG GALAXY Tab 無限機重量僅 380g 的輕薄精巧外觀設計,是 Apple iPad 的一半。

http://mag.udn.com/mag/digital/storypage.jsp?f_MAIN_ID=320&f_SUB_ID=2942&f_ART_ID=278225

esx所用的port列表

參考來源 : http://s852254.blogspot.com/2009/09/esxport.html
esx所用的port列表

不翻譯了,直接看比較快
port 80
vCenter Server requires port 80 for direct HTTP connections. Port 80 redirects requests to HTTPS port443. This is useful if you accidentally use http://server instead of https://server.
port 389
This port must be open on the local and all remote instances of vCenter Server. This is the LDAP portnumber for the Directory Services for the vCenter Server group. The vCenter Server system needs tobind to port 389, even if you are not joining this vCenter Server instance to a Linked Mode group. Ifanother service is running on this port, it might be preferable to remove it or change its port to differentport. If needed, you can run the LDAP service on any port from 1025 through 65535.If this instance is serving as the Microsoft Windows Active Directory, change the port number from 389to an available port from 1025 through 65535.
port 443
The default port that the vCenter Server system uses to listen for connections from the vSphere Client.To enable the vCenter Server system to receive data from the vSphere Client, open port 443 in thefirewall.The vCenter Server system also uses port 443 to listen for data transfer from the vSphere Web AccessClient and other SDK clients.If you use another port number for HTTPS, you must use : when you log in to thevCenter Server system.
port 636
For vCenter Linked Mode, this is the SSL port of the local instance. If another service is running on thisport, it might be preferable to remove it or change its port to different port. If needed, you can run theSSL service on any port from 1025 through 65535.
port 902
The default port that the vCenter Server system uses to send data to managed hosts. Managed hostsalso send a regular heartbeat over UDP port 902 to the vCenter Server system. This port must not beblocked by firewalls between the server and the hosts, or between hosts.
port 902/903
Ports 902 and 903 must not be blocked between the vSphere Client and the hosts. These ports are usedby the vSphere Client to display virtual machine consoles.
port 8080
Web Services HTTP. Used for the VMware VirtualCenter Management Webservices.
port 8443
Web Services HTTPS. Used for the VMware VirtualCenter Management Webservices.

DELPHI下使用FileSetDate()函式修改檔案的”修改日期”

Delphi下使用function FileSetDate(Handle: Integer; Age: Integer): Integer; overload;函式修改檔案的”修改日期”:

參考:http://delphi.ktop.com.tw/board.php?cid=30&fid=70&tid=37667

procedure TForm1.Button1Click(Sender: TObject);
Var
    FileHandle : Integer;
    Str : String;
begin
    FileHandle := FileOpen(‘D:\prog\1.txt’, fmOpenReadWrite);
    if FileHandle = -1 then
      ShowMessage(‘開啟檔案失敗’)
    else
    begin
      Str := ‘檔案原來日期時間: ‘+ DateTimeToStr(FileDateToDateTime(FileGetDate(FileHandle)))+#10#13;
      if FileSetDate(FileHandle, FileAge(‘D:\prog\AMS.exe’)) = 0 then
        Str := Str+DateTimeToStr(FileDateToDateTime(FileAge(‘D:\prog\AMS.exe’)))
      else
        Str := Str+’新的日期時間設定失敗’;
      ShowMessage(Str);
    end;
    FileClose(FileHandle);
end;

ESXi 4.1 設定檔重開機後自動復原初始值?無法修改設定檔

今天想修改ESXi 4.1 自動開啟SSH 與關閉LOADING IPMI功能,修改設定檔無法作用,重開機後復原設定值?廠商真是貼心………

IPMI功能為何關閉如下:
http://ithelp.ithome.com.tw/question/10051917

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

發問文章:http://ithelp.ithome.com.tw/question/10052113

小弟又來了,測試了 ESXi 開啟ssh 與 關閉IPMI功能的方式,修改設定檔,但是只要重開機就會回復預設值,例如我開了 SSH :

 

  1. 1、在控制台下,按 ALT+F1 進入控制台界面  
  2. 2、輸入 unsupported 然後按 enter  (輸入的時候是看不到你輸入的,所以一定要注意)  
  3. 3、如果輸入的 unsupported 正確,您將看到支持模式和密碼提示,然後輸入 root 密碼進行登錄  
  4. 4、登錄后,修改設定檔   
  5.      # vi /etc/inetd.conf
  6. 5、搜索  #SSH  這一項后,把前面的 # 去掉      
  7. 6、然後保存退出 
1、在控制台下,按 ALT+F1 進入控制台界面
2、輸入 unsupported 然後按 enter  (輸入的時候是看不到你輸入的,所以一定要注意)
3、如果輸入的 unsupported 正確,您將看到支持模式和密碼提示,然後輸入 root 密碼進行登錄
4、登錄后,修改設定檔 
     # vi /etc/inetd.conf
5、搜索  #SSH  這一項后,把前面的 # 去掉    
6、然後保存退出

但是重開機後,進去看又被#號起來,必需手動在啟動一次………IPMI修改設定檔的情形也是這樣,查了關鍵字都沒看到有人遇到相同問題,請問有人知道原因與解法嗎?

ESXi 4.1是安裝在USB當開機系統.懷疑是因為開機只從USB讀入?修改是修改記憶體內的設定檔,所以開機從USB讀入又回復原狀?如果真是這樣,那要如何才能改到正確的設定檔?

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

自己找到的另類解法:

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

關閉IPMI功能:

安裝完後,到SERVER上開啟SSH功能(參考系統安裝篇),使用SSH連入:

修改

vi /etc/vmware/init/init.d/72.ipmi

加入紅字

return ${SUCCESS} # disable IPMI

Exec esxcfg-init -I || {

return ${NON_CRITICAL_FAILURE}

}

按wq! ‘強制存檔退出

######若重開機剛剛改的設定檔回復初始值,請使用 VMware vSphere Client 連入 用 VMware vSphere Client介面修改。

把勾勾拿掉即可。

clip_image002

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

開啟SSH自動啟動功能:

ESX4.1付費版方式

我們可以根據以下步驟開啟

1. 在ESX Server伺服器上,依畫面指示按下「Alt+F1」,登入Service Console。

2. 切換到ssh目錄下,並編輯「sshd_config」,這個檔案。指令如下:

cd etc/ssh

vi sshd_config

3. 在「sshd_config」中找到「PermitRootLogin」這一行,並將後面的「no」改成「yes」

修改後再按下「Shift+q」切換到「:」命令模式,之後在:輸入「wq」,表示儲存修改並離開vi編輯程式。

4. 回到Service Console後,重新啟動sshd服務,指令是:

service sshd restart

免費版ESXi 4.1方式:

1、在控制台下,按 ALT+F1 進入控制台界面

2、輸入 unsupported 然後按 enter  (輸入的時候是看不到你輸入的,所以一定要注意)

3、如果輸入的 unsupported 正確,您將看到支持模式和密碼提示,然後輸入 root 密碼進行登錄

4、登錄后,修改設定檔

     # vi /etc/inetd.conf

5、搜索  #SSH  這一項后,把前面的 # 去掉

6、然後保存退出

  • From the console press ALT-F1
  • Type unsupported and press ENTER
  • Enter the root password
  • Enter the following command vi /etc/inetd.conf
  • Search for the #SSH settings
  • Remove the # from the SSH row
  • Save the config by using :wq!
  • Type ps | grep inetd on the console
  • Send a hangup signal by using the following command kill -s HUP

######若重開機剛剛改的設定檔回復初始值,請使用 VMware vSphere Client 連入 用 VMware vSphere Client介面修改。

clip_image001

clip_image002[5]

解決VMWare ESXi 2TB硬碟限制問題

最近公司買了便宜的ASUS TS-300/PS4 SERVER,很怪的是 安裝ESX4.1 到選安裝系統到那個硬碟畫面時,硬碟有抓到 LSI 2.8TB,但是卻是反灰不能選,另外使用USB也是一樣,變成兩個都反灰,已打去原廠反應,但都沒下文………………………可是ESXi4.1免費版本確可以正常安裝,傻眼………

但是遇到了2TB限制問題,外加原廠 LSI 1078 MegaRaid陣列卡配上4顆 1TB 原廠 3.5吋7200轉硬碟做RAID 5,容量有2.8TB左右,可是如果直接安裝系統在 LSI上,因2TB限制,則會有800G空間左右浪費。

我的解決方式如下:

使用USB當開機系統碟。

使用SSH連入

看分割狀況 一個RAID5 一個USB開機

~ # fdisk -l

Disk /dev/disks/naa.600e0180000b5a40143c6d7206ef1a34: 2998.9 GB, 2998960914432 bytes

255 heads, 63 sectors/track, 364602 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/disks/naa.600e0180000b5a40143c6d7206ef1a34p1 1 523 4193280 6 FAT16

Partition 1 does not end on cylinder boundary

/dev/disks/naa.600e0180000b5a40143c6d7206ef1a34p2 523 537 112640 fc VMKcore

Partition 2 does not end on cylinder boundary

/dev/disks/naa.600e0180000b5a40143c6d7206ef1a34p3 537 97254 776882176 fb VMFS

Disk /dev/disks/mpx.vmhba32:C0:T0:L0: 1030 MB, 1030750208 bytes

64 heads, 32 sectors/track, 983 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

Device Boot Start End Blocks Id System

/dev/disks/mpx.vmhba32:C0:T0:L0p1 5 900 917504 5 Extended

/dev/disks/mpx.vmhba32:C0:T0:L0p4 * 1 4 4080 4 FAT16 <32M

/dev/disks/mpx.vmhba32:C0:T0:L0p5 5 254 255984 6 FAT16

/dev/disks/mpx.vmhba32:C0:T0:L0p6 255 504 255984 6 FAT16

/dev/disks/mpx.vmhba32:C0:T0:L0p7 505 614 112624 fc VMKcore

/dev/disks/mpx.vmhba32:C0:T0:L0p8 615 900 292848 6 FAT16

 

分割指定硬碟

~ # fdisk /dev/disks/naa.600e0180000b5a40143c6d7206ef1a34

The number of cylinders for this disk is set to 364602.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

(e.g., DOS FDISK, OS/2 FDISK)

按 m 看指令有那些

Command (m for help): m

Command Action

a toggle a bootable flag

b edit bsd disklabel

c toggle the dos compatibility flag

d delete a partition

l list known partition types

n add a new partition

o create a new empty DOS partition table

p print the partition table

q quit without saving changes

s create a new empty Sun disklabel

t change a partition’s system id

u change display/entry units

v verify the partition table

w write table to disk and exit

x extra functionality (experts only)

 

刪除所有磁區

Command (m for help): d

Partition number (1-4): 3

列表看看 第三磁區已刪除

Command (m for help): p

Disk /dev/disks/naa.600e0180000b5a40143c6d7206ef1a34: 2998.9 GB, 2998960914432 bytes

255 heads, 63 sectors/track, 364602 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/disks/naa.600e0180000b5a40143c6d7206ef1a34p1 1 523 4193280 6 FAT16

Partition 1 does not end on cylinder boundary

/dev/disks/naa.600e0180000b5a40143c6d7206ef1a34p2 523 537 112640 fc VMKcore

Partition 2 does not end on cylinder boundary

Command (m for help):

 

使用 VMware vSphere Client 連入管理

clip_image001

clip_image002

clip_image003

若刪除分割區後第一次應該會有第三個選項,執行第三個選項一次,即可讓系統自動分割。

clip_image005

clip_image006

clip_image007

clip_image008

再新增一次

clip_image009

clip_image010

clip_image011

剛第三項新增 LOCAL DISK動作系統自己幫我們切割好一個 2TB與一個 744.89 剩餘空間的兩個分割區,選第一項可以把這兩個分割區合併成一個VM內邏輯的分割區。第四個選項可以回到2TB限制原狀,因手動刪除分割區無效,要回復原狀就要使用這方式。

clip_image012

clip_image013

成功破除2TB限制,實際上是兩個分割區合併後的狀況,一個實體分割還是不能超過2TB

clip_image014