阿福的VMWare优化方法

How to make your virtual machine smaller and faster


如果你用过我做的VM Template并且喜欢那些又小又快的VM的话, 很遗憾地说, 我没有时间再做了. 其实除了前段时间给Robin做了一个以外, 已经快一年没做这种东西了. 如果你觉得自己做的VM又大又慢的话, 我在这里给出优化的方法, 其他爱莫能助了.

开发人员->技术支持人员->正版用户->盗版用户

[论语][季氏][九] 子曰:

生而知之者, 上也; 学而知之者, 次也; 困而学之、又其次也; 困而不学, 民斯为下矣.

[阿福翻译]:

软件编出来就了解它, 是上等; 经过学习才了解, 是次一等; 有了问题打800来学习解决的, 是再次一等; 有了问题还不打800, 只知道重装的, 一般的人就是这种最下等了.

今天听说有人不知道延安怎样用拼音输入词, 只好一个字一个字的输入. 于是就问他会输入驴吗. 结果他说会的, 不就是LV嘛.

于是乎, 在这个没有(明媚)阳光的午后, 我顿悟了时尚原来就是头驴.

  • ps1: 延安正确的拼音是yan'an
  • ps2: LV = Louis Vuitton
  • ps3: The above “ps2” doesn’t mean the game console.
  • ps4: The above “ps3” doesn’t mean a game console too.
  • ps5: 老吴说: LV = Look, Very expensive

在地铁中看到Windows XP

今天早上在河南中路出来时看到一台地铁自动售票机出了错, WinXP询问是否发送到微软的对话框出现在最上面. 于是发现这个系统是基于WinXP上开发的, 而且使用了Luna-Blue Style (The WinXP default theme, if you don’t know what Luna Style is).

于是(没有忍住)点了”不发送”, 就看到了XP桌面, 还有上面在运行的一个软键盘. 可怜的开发人员, 他们不知道有osk.exe, 自己开发了一个巨大的soft keyboard.

地铁售票系统还在运行(刚被kill掉的部分应该是分离的), 虽然不能准确判断这个系统是用什么语言/工具写的, 桌面上的图标是VC6的那个(三个方块)的icon.

没有被杀掉的这个进程这时发现了自动售票系统不见了, 于是自动launch了一个新的, 那个由一堆铁轨组成的地图又出来了. 这个监控系统的想法是好的, 可是要能规避发送错误的模态对话框才能完美啊. 当然, 监控系统(通过进程间通信, 例如IPC)检测售票系统进程是否正常工作-而不是只看进程是否在运行-才是正解, 可是对某些人来讲太难了吧.

总之, 地铁新自动售票系统用的是Windows XP, 期待其他系统也早日做出正确抉择.

Print Counter

R*y一定想要一个命令行的工具来计算每个用户打印了多少张纸 (通过EventLog), 告诉他要买第三方软件就是不肯. 考虑到OOB的问题, 就不在现有系统上帮他实现, 所以在MSH上看了一下, 结果发现真是xxx的方便啊.

一条命令搞定:

1
(get-eventlog systemwhere {($_.source -eq "Print") -and ($_.eventid -eq "10")})foreach {$_.TimeWritten.tostring() +","+ $_.username.tostring() +","+ $_.ReplacementStrings[6].tostring()}sort-object -property TimeWritten>PrintCount.csv

用Excel打开, 做图表啊做图表.

一劳永逸 (记得放到profile.msh里啊):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function print-count
{
$local:summary = @{}
$local:sum = 0
if ( $Args.length -eq 2)
{
$local:elog=(get-eventlog systemwhere {($_.source -eq "Print") -and ($_.eventid -eq "10") -and ($_.timegenerated -ge $args[0]) -and ($_.timegenerated -le $args[1])})
}
else
{
$local:elog=(get-eventlog systemwhere {($_.source -eq "Print") -and ($_.eventid -eq "10")})
}
if ($local:elog.count -gt 0)
{
foreach ($local:log in $local:elog)
{
if(-not $summary.containskey($local:log.username.tostring()))
{
$summary.add($local:log.username.tostring(),0)
}
$summary[$local:log.username.tostring()]+=$local:log.ReplacementStrings[6]
$sum+=$local:log.ReplacementStrings[6]
}
}
$local:format = @{Expression={$_.Key}; Label = "User Name"; Width = 20}, @{Expression={$_.Value}; Label = "Printed Pages"; Width = 25}
$local:summarysort-object -property Valueformat-table $local:format
write-host "----------------------------------------------"
write-host ("Total Pages"+" "*(35-$local:sum.tostring().length)+$local:sum.tostring())

然后就可以:
print-count
或者
print-count ("2005-1-1","2005-12-31")

New Shell, New Prompt

MSH Bata 3.1 发布了一段时间了, 这次是基于.Net 2.0正式版的. 不需要安装bata版的.Net, 放心开始安装学习吧.

年轻人的世界越来越复杂, 回想我年轻的时候, 我用下面这样的prompt: (在cmd下面用的, 如果要在command下面需要做些修改)

1
prompt [$T$H$H$H$H$H$H][@$M]$S[$+$P]$_$G

而现在为了实现近似的功能:

1
function prompt { "[MSH]["+(get-date).hour+":"+(get-date).minute.tostring("D2")+"]"+" ["+(get-location).provider.tostring().split("\")[-1]+"]["+(get-location).providerpath+"]`n>" }

如此复杂的命令等人家开始问了才去学的话, 恐怕就不太来得及了, 建议大家有空的时候去看一下.

ps: 如果你不知道prompt是什么……表告诉我

Disk Crush

May 27, 10pm

老婆说最近玩大富翁的时候会死机, 并对计算机的该种不良表现表示了不满.

May 27, 11pm

真的又死掉了. 技术上讲, 计算机hang住了; 鼠标能够正常移动, 但点击没有反应; 约1分钟后鼠标移动停止.

May 27, 11.15pm

因为是最重要的客户, 进入SPIN流程:

  • S: P4 2.0A, 1G DDR, 80G IDE (one partition, boot, system, application, data), 16G SCSI (one partition, paging). Windows server 2003 Enterprise CHS(SP1 NOT installed). WMP9, DFW7CHS, QQ珊瑚虫2005版.

  • P: System will hang when runing DFW & WMP at same time.

  • I: Cannot play game. She will be unhappy and the quality of my life will be affected.

She also remembered the problem first occured some days before when she used QQ on the computer. The problem often occurs when running DFW & WMP at same time; and the problem occurs more and more frequently.

  • N: Let her play the game on a stable computer.

从SPIN上看似乎把我的BB (IBM X31, 1.6G, 1024M) 贡献出来玩游戏是很好的解决方案. 不过我不想…

May 27, 11:30pm

权衡之后, 决定对目标计算机的故障进行排错.

  • 11:35pm 找到串口线
  • 11:38pm X31没有串口, 找出USB转串口线
  • 11:40pm 寻找/下载/安装USB转串口驱动
  • 11:50pm 配置boot.ini, 准备进行kernel debug
  • 11:55pm 启动时习惯性地对问题机器进行了chkdsk, 在完成的最后有消息指出MFT如何如何. 心不在焉, 54之, 留下祸根.
May 28, 0:10am

Launch WMP, play songs, try to launch DFW. DFW’s license protection program said it cannot be launched under debugger’s monitor. /faint
BTW, if we can launch debugger for a system stalled issue, the !process 0 7 extension is the best way to find the problem on a hung system.

Researching, want to know how to avoid a program be aware it is under debugging. 未果

May 28, 0:20am

hang when use IE!!! Fource reboot

May 28, 0:35am

stop 0xed "UNMOUNTABLE_BOOT_VOLUME" during reboot. Status 0xc00000032 means file system crushed due to unexcepted power off
Tried reboot again, same error

May 28, 0:40am

Boot to RC, Stop with same bug check during loading RC

May 28, 0:50am

Boot to RC from Win2k3 CD, it jumped to C:\ WITHOUT asking password of administrator

1
2
3
4
5
6
dir 
"枚举目录时遇到错误"
chkdsk
"分区看起来不错......"
chkdsk /p
"在75%左右"遇到一个不可恢复错误..."
May 28, 1am

拆卸, plug the 80G disk to X31 by USB2IDE adapter

May 28, 1:05am

Launch EasyRecovery
Advanced Recovery -> “MFT missing” /faint
RAW Recovery -> Searching…

May 28, 2:25am

60G data find, selected 7.5G to recover

May 28, 4:15am

Recovery under progress, 1.36G recoveried already, 3 hours remain.

=======================
在troubleshooting初期, 曾被询问”如果普通用户问DFW运行的时候会死机, 将如何处理?” 答曰”不要运行DFW.” 结果被威胁如果她是普通用户将对我方进行恐怖主义打击.