[root@dg1 ~]# tune2fs -l /dev/sda1 |grep 'Block size'
Block size: 4096
[root@dg1 ~]#
查看os系统页的大小
[root@dg1 ~]# getconf PAGESIZE4096[root@dg1 ~]#
修改块的大小:
创建文件系统时,可以指定块的大小。如果将来在你的文件系统中是一些比较大的文件的话,使用较大的块大小将得到较好的性能。将ext2文件系统的块大小调整为4096byte而不是缺省的1024byte,可以减少文件碎片,加快fsck扫描的速度和文件删除以及读 *** 作的速度。另外,在ext2的文件系统中,为根目录保留了5%的空间,对一个大的文件系统,除非用作日志文件,5%的比例有些过多。可以使用命令
# mke2fs -b 4096 -m 1 /dev/hda6
将它改为1%并以块大小4096byte创建文件系统。
使用多大的块大小,需要根据你的系统综合考虑,如果系统用作邮件或者新闻服务器,使用较大的块大小,虽然性能有所提高,但会造成磁盘空间较大的浪费。比如文件系统中的文件平均大小为 2145byte,如果使用4096byte的块大小,平均每一个文件就会浪费1951byte空间。如果使用1024byte的块大小,平均每一个文件会浪费927byte空间。在性能和磁盘的代价上如何平衡,要看具体应用的需要。
systeminfo | find "system model" /iwmic bios get serialnumber 获取硬件序列号
"wmic csproduct get name" 获取型号
远程: systeminfo /s computername
wmic /node:"IPorCOMPUTERNAME" bios get serialnumber
WMIC /NODE:"computer1" /USER:"domainname\username" /PASSWORD:"userpassword" OS GET Caption,CSDVersion,CSName
如何获取电脑序列号的两种方法: 第二种可以获取域中远程的电脑http://support.microsoft.com/kb/558124
测试在中:win7可以被远程wmic xp不行,似乎不同品牌机器也不能被远程wmic
以下是systeminfo参数
Host Name:
OS Name:
OS Version:
OS Manufacturer:
OS Configuration:
OS Build Type:
Registered Owner:
Registered Organization:
Product ID:
Original Install Date:
System Up Time:
System Manufacturer:
System Model:
System type:
Processor(s):
BIOS Version:
Windows Directory:
System Directory:
Boot Device:
System Locale:
Input Locale:
Time Zone:
Total Physical Memory:
Available Physical Memory
Virtual Memory: Max Size:
Virtual Memory: Available
Virtual Memory: In Use:
Page File Location(s):
Domain:
Logon Server:
Hotfix(s):
#############################
今天加一个dmidecode ,这个是linux下的查看硬件工具,也有windows 版本
装了之后必须去安装目录下才能用命令
#############################
【例】将当前系统BIOS,CPU,主板等信息输出到一个HTML网页文件,命令如下:
::得到系统信息.bat,运行bat文件即可
::系统信息输出到HTML文件,查看帮助: wmic /?
::wmic [系统参数名] list [brief|full] /format:hform >|>>[文件名]
wmic bioslist brief /format:hform >PCinfo.html
wmic baseboard list brief /format:hform >>PCinfo.html
wmic cpu list full/format:hform >>PCinfo.html
wmic os list full/format:hform >>PCinfo.html
wmic computersystem list brief /format:hform >>PCinfo.html
wmic diskdrive list full/format:hform >>PCinfo.html
wmic memlogical list full/format:hform >>PCinfo.html
PCinfo.html
#####################################################
for /F %%i in (serverlist.txt) do (
echo Processing %%i...
wmic /Failfast:ON /node:"%%i" >"%%i_OS.txt" OS Get csname,name
wmic /Failfast:ON /node:"%%i" >>"%%i_OS.txt" bios Get serialnumber
)
PAUSE
####################################################################
via:http://wangdehe88.blog.163.com/blog/static/12332866201261210521648/
强大的命令行工具wmic
.wmic=Microsoft Windows Management Instrumentation
2. C:\WINDOWS\system32\wbem 下的东西,特别是.xsl格式化文件,实现wmic的格式化输出
如wmic /output:c:\process.html process list /format:htable.xsl
/format:textvaluelist.xsl
/format:hform.xsl
/format:htable.xsl
/format:csv.xsl
/format:xml.xsl
3.wmic可以做什么?系统管理、远程主机信息获取。。。都可以
4.wmic /?
查看wmic对象有何可用属性: wmic 对象名称 get /? 例如
wmic process get /?
查看wmic对象某个属性的值: wmic 对象名称 get 对象某个属性 例如
wmic process get name
PROCESS - 进程管理
::列出进程的核心信息,类似任务管理器
wmic process list brief
::新建notepad进程
wmic process call create notepad
::列出进程的信息
wmic process get caption,handle,commandline,executablepath
::结束进程
wmic process [handle/PID] delete
wmic process [handle/PID] call terminate
::结束svchost.exe进程,路径为非C:\WINDOWS\system32\svchost.exe的
wmic process where "name='svchost.exe' and ExecutablePath<>'C:\\WINDOWS\\system32\\svchost.exe'" call Terminate
::结束svchost.exe进程,路径为C:\WINDOWS\svchost.exe的(关键点:路径中的\一定要换成\\)
wmic process where "name='svchost.exe' and
获取 Windows *** 作系统版本信息的 C 程序 [zt]From:[url]http://kevin2296.blog.163.com/article/-aBzn-rfC7hw.html[/url]
[php]
// OSinfo.cpp : 定义控制台应用程序的入口点。
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
#include "winsock.h"
#include <string>
#include <iostream>
using std::coutusing std::stringusing std::iostream
using std::endlusing std::iosusing std::fstream
using std::ofstreamusing std::cin
#pragma comment( lib, "Ws2_32.lib" )
#define MAX_VALUE_NAME 256
//char osinfo[MAX_PATH][MAX_PATH]
char patchname[MAX_VALUE_NAME]
//全局变量
char *LocalIP="" //定义IP地址变量
//获取本机ip
bool GetLocalIp()
{
WSADATA wsaData
char name[255]//定义用于存放获得的主机名的变量
PHOSTENT hostinfo
//调用MAKEWORD()获得Winsock版本的正确值,用于加载Winsock库
if ( WSAStartup( MAKEWORD(2,2), &wsaData ) == 0 )
{
//现在是加载Winsock库,如果WSAStartup()函数返回值为0,说明加载成功,程序可以继续
if( gethostname ( name, sizeof(name)) == 0)
{
//如果成功地将本地主机名存放入由name参数指定的缓冲区中
if((hostinfo = gethostbyname(name)) != NULL)
{
//这是获取主机名,如果获得主机名成功的话,将返回一个指针,指向hostinfo,hostinfo
//为PHOSTENT型的变量,下面即将用到这个结构体
LocalIP = inet_ntoa (*(struct in_addr *)*hostinfo->h_addr_list)
//调用inet_ntoa()函数,将hostinfo结构变量中的h_addr_list转化为标准的点分表示的IP
//地址(如192.168.0.1)
// printf("the ip is:%s\n",LocalIP)//输出IP地址
}
}
WSACleanup( )//卸载Winsock库,并释放所有资源
}
return TRUE
}
//显示系统版本
bool DisplaySystemVesion(FILE *fp)
{
OSVERSIONINFOEX osvi
BOOL bOsVersionInfoEx
//利用OSVERSIONINFOEX结构调用GetVersionEx()函数
//如果调用失败,可尝试使用OSVERSIONINFO结构
ZeroMemory(&osvi,sizeof(OSVERSIONINFOEX))
osvi.dwOSVersionInfoSize=sizeof(OSVERSIONINFOEX)
if(!(bOsVersionInfoEx=GetVersionEx((OSVERSIONINFO*)&osvi)))
{
//
osvi.dwOSVersionInfoSize=sizeof(OSVERSIONINFO)
if(!GetVersionEx((OSVERSIONINFO*)&osvi))
return FALSE
}
switch(osvi.dwPlatformId)
{
case VER_PLATFORM_WIN32_NT:
//get os information
if ( osvi.dwMajorVersion == 5 &&osvi.dwMinorVersion == 2 )
{
printf("Microsoft Windows Server 2003 family ")
//fprintf( fp, "Microsoft Windows Server 2003 family ")
fprintf( fp, "WindowsServer2003")
// strcpy(osinfo[0],"Microsoft Windows Server 2003 family ")
}
if ( osvi.dwMajorVersion == 5 &&osvi.dwMinorVersion == 1 )
{
printf("Microsoft Windows XP ")
//fprintf( fp, "Microsoft Windows XP ")
fprintf( fp, "WindowsXP")
// strcpy(osinfo[0],"Microsoft Windows XP ")
}
if ( osvi.dwMajorVersion == 5 &&osvi.dwMinorVersion == 0 )
{
printf("Microsoft Windows 2000 ")
//fprintf( fp, "Microsoft Windows 2000 ")
fprintf( fp, "Windows2000")
// strcpy(osinfo[0],"Microsoft Windows 2000 ")
}
if ( osvi.dwMajorVersion <= 4 )
{
printf("Microsoft Windows NT ")
//fprintf( fp, "Microsoft Windows NT ")
fprintf( fp, "WindowsNT")
// strcpy(osinfo[0],"Microsoft Windows NT ")
}
//
if(bOsVersionInfoEx)
{
if(osvi.wProductType==VER_NT_WORKSTATION)
{
printf("Professional ")
// fprintf(fp,"Professional ")
}
if(osvi.wProductType==VER_NT_SERVER)
{
printf("Server ")
// fprintf(fp,"Server ")
}
//printf("\n")
fprintf(fp,"\n")
}
else
{
HKEY hKey
char szProductType[80]
DWORD dwBufLen
RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\ProductOptions",0,KEY_QUERY_VALUE,&hKey)
RegQueryValueEx(hKey,"ProductType",NULL,NULL,(LPBYTE)szProductType,&dwBufLen)
RegCloseKey(hKey)
if(lstrcmpi("WINNT",szProductType)==0)
{
printf("Workstation ")
// fprintf(fp,"Workstation ")
}
if(lstrcmpi("SERVERNT",szProductType)==0)
{
printf("Server ")
// fprintf(fp,"Server ")
}
//printf("\n")
fprintf(fp,"\n")
}
// Display service pack (if any) and build number.
if( osvi.dwMajorVersion == 4 &&
lstrcmpi( osvi.szCSDVersion, "Service Pack 6" ) == 0 )
{
HKEY hKey
LONG lRet
// Test for SP6 versus SP6a.
lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Hotfix\\Q246009",
0, KEY_QUERY_VALUE, &hKey )
if( lRet == ERROR_SUCCESS )
{
printf( "Service Pack 6a (Build %d)\n", osvi.dwBuildNumber &0xFFFF )
// fprintf( fp,"Service Pack 6a (Build %d)\n", osvi.dwBuildNumber &0xFFFF )
// fprintf( fp,"Service Pack 6a\n" )
fprintf( fp,"6a\n" )
}
else // Windows NT 4.0 prior to SP6a
{
printf( "%s (Build %d)",osvi.szCSDVersion,osvi.dwBuildNumber &0xFFFF)
/* printf( "%s (Build %d)\n",
osvi.szCSDVersion,
osvi.dwBuildNumber &0xFFFF)
*/
// fprintf( fp,"%s (Build %d)\n",
// osvi.szCSDVersion,
// osvi.dwBuildNumber &0xFFFF)
// fprintf( fp,"%s\n",osvi.szCSDVersion)
fprintf( fp,"%s\n",osvi.szCSDVersion+13) //去掉"Service Pack "共13个字节,只保留最后的号
}
RegCloseKey( hKey )
}
else // Windows NT 3.51 and earlier or Windows 2000 and later
{
printf( "%s (Build %d)",osvi.szCSDVersion,osvi.dwBuildNumber &0xFFFF)
/*printf( "%s (Build %d)\n",
osvi.szCSDVersion,
osvi.dwBuildNumber &0xFFFF)
*/
// fprintf( fp,"%s (Build %d)\n",
// osvi.szCSDVersion,
// osvi.dwBuildNumber &0xFFFF)
// fprintf( fp,"%s\n",osvi.szCSDVersion)
fprintf( fp,"%s\n",osvi.szCSDVersion+13) //去掉"Service Pack "共13个字节,只保留最后的号
}
break
case VER_PLATFORM_WIN32_WINDOWS:
if (osvi.dwMajorVersion == 4 &&osvi.dwMinorVersion == 0)
{
printf("Microsoft Windows 95 ")
fprintf(fp,"Microsoft Windows 95 ")
if ( osvi.szCSDVersion[1] == 'C' || osvi.szCSDVersion[1] == 'B' )
{
printf("OSR2")
fprintf(fp,"OSR2")
// strcat(osinfo[0], "OSR2" )
}
printf("\n")
fprintf(fp,"\n")
}
if (osvi.dwMajorVersion == 4 &&osvi.dwMinorVersion == 10)
{
printf("Microsoft Windows 98 ")
fprintf(fp,"Microsoft Windows 98 ")
if ( osvi.szCSDVersion[1] == 'A' )
{
printf("SE")
fprintf(fp,"SE")
}
printf("\n")
fprintf(fp,"\n")
}
if (osvi.dwMajorVersion == 4 &&osvi.dwMinorVersion == 90)
{
printf("Microsoft Windows Millennium Edition\n")
fprintf(fp,"Microsoft Windows Millennium Edition\n")
}
break
case VER_PLATFORM_WIN32s:
printf(" Microsoft Win32s\n")
fprintf(fp," Microsoft Win32s\n")
break
}
return TRUE
}
void DisplaySetupedPatch(FILE *fp)
{
HKEY hKey
// LONG lRet
// char Buf[80]
// char lpBuf[80]
DWORD i
DWORD retCode
// DWORD j
// DWORD retValue
DWORD dwxValueName=MAX_VALUE_NAME
LPCTSTR path="SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Hotfix"
LONG return0=RegOpenKeyEx(HKEY_LOCAL_MACHINE,path,0,KEY_READ,&hKey)
if(return0!=ERROR_SUCCESS)
{
printf("错误:无法打开有关的键!")
}
for(i=1,retCode=ERROR_SUCCESSretCode==ERROR_SUCCESSi++)
{
retCode=RegEnumKey(hKey,i,patchname,MAX_PATH)
if(retCode==ERROR_SUCCESS)
{
printf("%s\n",patchname)
fprintf(fp,"%s\n",patchname)
}
}
}
void main()
{
//写入文件
FILE *fp
GetLocalIp()
const char SaveReciveFilePath[]="f:\\"
string abPath(SaveReciveFilePath)
char Filename[512]=""
strcpy(Filename,LocalIP) //拷贝字符串
strcat(Filename,".txt") //连接字符串
abPath += Filename
fp=fopen(abPath.c_str(),"w")
while(fp==NULL)
// printf("the LocalIP is:%s\n",LocalIP)//输出IP地址
printf("本机IP地址:%s\n",LocalIP)//输出IP地址
// fprintf(fp,"本机IP:%s\n",LocalIP)
// fprintf(fp,"%s\n",LocalIP)
bool a=FALSE
printf("本机 *** 作系统版本是:")
// fprintf(fp,"本机 *** 作系统版本是:")
// *** 作系统版本信息
while (a!=TRUE)
{
a=DisplaySystemVesion(fp)
}
// *** 作系统语言信息
printf("语言:")
// fprintf(fp,"语言:")
/* WORD wLangPID = PRIMARYLANGID( GetSystemDefaultLangID() )
if( LANG_CHINESE == wLangPID )
{
printf("CHS\n")//中文
fprintf(fp,"CHN\n")
}
else
{
printf("ENG\n")//英文
fprintf(fp,"ENG\n")
}
if( NULL == wLangPID )
{
printf( "Failure!\n" )
}
*/
int LanguageID=GetSystemDefaultLangID() //返回 *** 作系统语言的ID号
switch(LanguageID)
{
case 0x0404:
printf("CHT\n")//Chinese Taiwan
fprintf(fp,"CHT\n")
break
case 0x0804:
printf("CHS\n")//Chinese PRC
fprintf(fp,"CHS\n")
break
case 0x0c04:
printf("ZHH\n")//Chinese Hong Kong SAR
fprintf(fp,"ZHH\n")
break
case 0x1004:
printf("ZHH\n")//Chinese Singapore
fprintf(fp,"ZHH\n")
break
case 0x1404:
printf("ZHM\n")//Chinese Macau SAR
fprintf(fp,"ZHM\n")
break
case 0x0809:
printf("ENG\n")//English United Kingdom
fprintf(fp,"ENG\n")
break
case 0x0409:
printf("USA\n")//English United States
fprintf(fp,"USA\n")
break
default:
printf("Default\n")
fprintf(fp,"Default\n")
break
}
// printf("%d\n",id)
// *** 作系统已安装补丁信息
printf("系统已经安装的升级补丁有:\n")
// fprintf(fp,"系统已经安装的升级补丁有:\n")
DisplaySetupedPatch(fp)
fclose(fp)
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)