RHEL6基础三十九之服务器硬件信息查看

CPU信息:

CPU型号:

[root@localhost ~]# cat /proc/cpuinfo |grep name|awk -F ':' '{print $2}'|uniq -c
      8  Intel(R) Xeon(R) CPU           X5650  @ 2.67GHz
[root@localhost ~]# cat /proc/cpuinfo |grep name|cut -d ':' -f 2|uniq -c
      8  Intel(R) Xeon(R) CPU           X5650  @ 2.67GHz
[root@localhost ~]#

查看逻辑CPU的个数

[root@localhost logs]# cat /proc/cpuinfo| grep "processor"| wc -l
8
[root@localhost logs]#

查看每个物理CPU中core的个数(即核数)

[root@localhost logs]# cat /proc/cpuinfo| grep "cpu cores"| uniq
cpu cores	: 4
[root@localhost logs]#

物理CPU个数:

[root@localhost ~]# cat /proc/cpuinfo |grep physical|sort|uniq -c
      8 address sizes   : 40 bits physical, 48 bits virtual
      4 physical id : 0
      4 physical id : 1
[root@localhost ~]#

2个4核CPU

总核数 = 物理CPU个数 X 每颗物理CPU的核数 

总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数

运行位数:

[root@localhost ~]# getconf LONG_BIT
64
[root@localhost ~]#

当前CPU工作在64位模式下(即操作系统是64位的),如果显示的是32并不表示CPU一定是32位的(64位的也可以当32位的来用),要查看cpu是否支持64bit,方法如下:

[root@localhost ~]# cat /proc/cpuinfo |grep flags|grep "lm"|wc -l
8
[root@localhost ~]#

如果flags中有lm,则表示支持64位,lm的意思是long mode
即如结果大于0, 说明支持64bit处理模式,64位的CPU必须运行在64位的操作系统下,才能实现64位的运算模式。

服务器型号查询:

[root@BETA6 yum.repos.d]# dmidecode |grep -i "product name"
	Product Name: PowerEdge R620
	Product Name: 0D2D5F
[root@localhost ~]# dmidecode |grep "System Information" -A9|egrep  "Manufacturer|Product|Serial" 
    Manufacturer: Dell Inc.
    Product Name: PowerEdge R620
    Serial Number: HS2CKZ1
[root@localhost ~]#

查看主板型号

[root@localhost ~]#  dmidecode |grep -A16 "System Information$" 
System Information
    Manufacturer: Dell Inc.
    Product Name: PowerEdge R620
    Version: Not Specified
    Serial Number: HS2CKZ1
    UUID: 4C4C4544-0053-3210-8043-C8C04F4B5A31
    Wake-up Type: Power Switch
    SKU Number: SKU=NotProvided;ModelName=PowerEdge R620
    Family: Not Specified

Handle 0x0200, DMI type 2, 9 bytes
Base Board Information
    Manufacturer: Dell Inc.
    Product Name: 0D2D5F
    Version: A06
    Serial Number: ..CN7475139L0119.
    Asset Tag: Not Specified
[root@localhost ~]#

查看BIOS信息

[root@localhost ~]# dmidecode -t bios
# dmidecode 2.12
SMBIOS 2.7 present.

Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
    Vendor: Dell Inc.
    Version: 2.0.19
    Release Date: 08/29/2013
    Address: 0xF0000
    Runtime Size: 64 kB
    ROM Size: 8192 kB
    Characteristics:
        ISA is supported
        PCI is supported
        PNP is supported
        BIOS is upgradeable
        BIOS shadowing is allowed
        Boot from CD is supported
        Selectable boot is supported
        EDD is supported
        Japanese floppy for Toshiba 1.2 MB is supported (int 13h)
        5.25"/360 kB floppy services are supported (int 13h)
        5.25"/1.2 MB floppy services are supported (int 13h)
        3.5"/720 kB floppy services are supported (int 13h)
        8042 keyboard services are supported (int 9h)
        Serial services are supported (int 14h)
        CGA/mono video services are supported (int 10h)
        ACPI is supported
        USB legacy is supported
        BIOS boot specification is supported
        Function key-initiated network boot is supported
        Targeted content distribution is supported
        UEFI is supported
    BIOS Revision: 2.0

Handle 0x0D00, DMI type 13, 22 bytes
BIOS Language Information
    Language Description Format: Long
    Installable Languages: 1
        en|US|iso8859-1
    Currently Installed Language: en|US|iso8859-1

[root@localhost ~]#


查看linux主机是否虚拟机还是物理机:

[root@Port_Forward ~]# lspci -b|grep -i vmware
00:07.7 System peripheral: VMware Virtual Machine Communication Interface (rev 10)
00:0f.0 VGA compatible controller: VMware SVGA II Adapter
00:11.0 PCI bridge: VMware PCI bridge (rev 02)
00:15.0 PCI bridge: VMware PCI Express Root Port (rev 01)
[root@Port_Forward ~]# dmidecode |grep -i vmware
	Manufacturer: VMware, Inc.
	Product Name: VMware Virtual Platform
	Serial Number: VMware-42 0b 96 a0 da dd 91 17-d8 3d 89 e8 56 f4 5e c1
	Description: VMware SVGA II
[root@Port_Forward ~]#

lspci:显示外围设备总线/总览。dmidecode:桌面管理接口。


内存信息:

[root@localhost ~]# cat /proc/meminfo |grep -i mem
MemTotal:        8061068 kB
MemFree:         7136744 kB
Shmem:               388 kB
[root@localhost ~]# cat /proc/meminfo |grep Swap
SwapCached:            0 kB
SwapTotal:       2097144 kB
SwapFree:        2097144 kB
[root@localhost ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          7872       1069       6802          0         56        376
-/+ buffers/cache:        637       7234
Swap:         2047          0       2047
[root@localhost ~]# dmidecode -t memory | more
# dmidecode 2.12
SMBIOS 2.7 present.

Handle 0x1000, DMI type 16, 23 bytes
Physical Memory Array
    Location: System Board Or Motherboard
    Use: System Memory
    Error Correction Type: Multi-bit ECC
    Maximum Capacity: 1536 GB
    Error Information Handle: Not Provided
    Number Of Devices: 24

Handle 0x1100, DMI type 17, 34 bytes
Memory Device
    Array Handle: 0x1000
    Error Information Handle: Not Provided
    Total Width: 72 bits
    Data Width: 64 bits
    Size: 8192 MB
    Form Factor: DIMM
    Set: 1
    Locator: DIMM_A1 
    Bank Locator: Not Specified
    Type: DDR3
    Type Detail: Synchronous Registered (Buffered)
    Speed: 1333 MHz
    Manufacturer: 02FE00B302FE
    Serial Number: 2B11D8D9
    Asset Tag: 4A122863
    Part Number: EBJ81RF4ECFA-DJ-F 
    Rank: 2
    Configured Clock Speed: 1333 MHz
[root@localhost ~]# dmidecode|grep -P 'Maximum\s+Capacity'      最大支持多少内存
    Maximum Capacity: 1536 GB
[root@localhost ~]# dmidecode |grep -A5 -i "memory device"|grep -i size|grep -v range             查看内存的插槽数,已经使用多少插槽.每条内存多大:
    Size: 8192 MB
    Size: 8192 MB
    Size: 8192 MB
    Size: 8192 MB
    Size: No Module Installed
    Size: No Module Installed
    Size: No Module Installed
    Size: No Module Installed
    Size: No Module Installed
    Size: No Module Installed
    Size: No Module Installed
    Size: No Module Installed
    Size: 8192 MB
    Size: 8192 MB
    Size: 8192 MB
    Size: 8192 MB
    Size: No Module Installed
    Size: No Module Installed
    Size: No Module Installed
    Size: No Module Installed
    Size: No Module Installed
    Size: No Module Installed
    Size: No Module Installed
    Size: No Module Installed
[root@localhost ~]# dmidecode|grep -A16 "Memory Device"|grep 'Speed'   内存的频率
    Speed: 1333 MHz
    Speed: 1600 MHz
    Speed: 1600 MHz
    Speed: 1600 MHz
    Speed: Unknown
    Speed: Unknown
    Speed: Unknown
    Speed: Unknown
    Speed: Unknown
    Speed: Unknown
    Speed: Unknown
    Speed: Unknown
    Speed: 1333 MHz
    Speed: 1600 MHz
    Speed: 1600 MHz
    Speed: 1600 MHz
    Speed: Unknown
    Speed: Unknown
    Speed: Unknown
    Speed: Unknown
    Speed: Unknown
    Speed: Unknown
    Speed: Unknown
    Speed: Unknown
[root@localhost ~]#

从上图中可看到当前系统内存总大小为7872(单位是k)已经使用1069,剩余6802。其实真正剩余并不是这个6802,而是第二行的7234,真正使用的也是第二行的637。这是因为系统初始化时,就已经分配出很大一部分内存给缓存,这部分缓存用来随时提供给程序使用,如果程序不用,那这部分内存就空闲。所以,查看内存使用多少,剩余多少请看第二行的数据。另外你还可以加-m 或者-g选项分别以M或G为单位打印内存使用状况。


硬盘信息:

[root@localhost ~]# fdisk -l
Disk /dev/sda: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0000e824
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      102400   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              13         274     2097152   82  Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3             274        2089    14576640   83  Linux
[root@justin ~]# df -T
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
/dev/sda2     ext4    10321208   4635280   5161640  48% /
tmpfs        tmpfs      515396         0    515396   0% /dev/shm
/dev/sda1     ext4      198337     26679    161418  15% /boot
/dev/sda5     ext4     8053168    149244   7494836   2% /home
/dev/sdb5     ext3      505572     10543    468927   3% /newdisk
[root@justin ~]# df -Th
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sda2     ext4    9.9G  4.5G  5.0G  48% /
tmpfs        tmpfs    504M     0  504M   0% /dev/shm
/dev/sda1     ext4    194M   27M  158M  15% /boot
/dev/sda5     ext4    7.7G  146M  7.2G   2% /home
/dev/sdb5     ext3    494M   11M  458M   3% /newdisk
[root@justin ~]#

测试硬盘写入速度:

[root@localhost ~]# dd if=/dev/zero of=/tmp/output.img bs=1M count=256
256+0 records in
256+0 records out
268435456 bytes (268 MB) copied, 8.56778 s, 31.3 MB/s
[root@localhost ~]#

测试硬盘读取速度:

[root@localhost ~]# hdparm -Tt /dev/sda

/dev/sda:
 Timing cached reads:   6652 MB in  2.00 seconds = 3327.09 MB/sec
 Timing buffered disk reads:  80 MB in  3.05 seconds =  26.26 MB/sec
[root@localhost ~]#

获取文本的md5 hash:

[root@localhost ~]# echo -n "justin"|md5sum 
53dd9c6005f3cdfc5a69c5c07388016d  -
[root@localhost ~]#

Swap分区信息:

[root@localhost ~]# swapon -s
Filename                Type        Size    Used    Priority
/dev/sda2                               partition   2097144 0   -1
[root@localhost ~]# cat /proc/swaps
Filename                Type        Size    Used    Priority
/dev/sda2                               partition   2097144 0   -1
[root@localhost ~]#

UUID:

[root@localhost ~]# blkid
/dev/sda3: UUID="eee214fe-4b64-44b6-8b3c-ed0f8e63e32a" TYPE="ext4"
/dev/sda1: UUID="fc233792-7e59-487c-8359-a464b7b66097" TYPE="ext4"
/dev/sda2: UUID="680ec16a-b4e9-4dc8-8bee-aaf45587e173" TYPE="swap"
[root@localhost ~]# ls -l /dev/disk/by-uuid/
total 0
lrwxrwxrwx. 1 root root 10 Dec  6 09:48 680ec16a-b4e9-4dc8-8bee-aaf45587e173 -> ../../sda2
lrwxrwxrwx. 1 root root 10 Dec  6 09:48 eee214fe-4b64-44b6-8b3c-ed0f8e63e32a -> ../../sda3
lrwxrwxrwx. 1 root root 10 Dec  6 09:48 fc233792-7e59-487c-8359-a464b7b66097 -> ../../sda1

补:查看某一文件(夹)大小

[root@localhost src]# du -sh nagios-plugins-1.4.16.tar.gz
2.0M    nagios-plugins-1.4.16.tar.gz
[root@localhost src]#

查看当前系统安装的软件包数量

[root@justin home]# cat -n /root/install.log|wc -l
1099
[root@justin home]#

网卡信息:

[root@localhost ~]# dmesg |grep -i eth
e1000 0000:02:00.0: eth0: (PCI:66MHz:32-bit) 00:50:56:be:47:3b
e1000 0000:02:00.0: eth0: Intel(R) PRO/1000 Network Connection
e1000 0000:02:02.0: eth1: (PCI:66MHz:32-bit) 00:50:56:96:37:60
e1000 0000:02:02.0: eth1: Intel(R) PRO/1000 Network Connection
e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
ADDRCONF(NETDEV_UP): eth0: link is not ready
ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
e1000: eth1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
eth0: no IPv6 routers present
eth1: no IPv6 routers present
[root@localhost ~]#


判断网卡速率

ethtool ethx 查看支持的速率

blob.png

网卡的最大速率可以看Speed: 1000Mb/s,Duple:Full 全双工;实际网卡速率和网线,交换机端口速率有关,Auto-negotiation on表示开启自动协商,插上网线后会两端会自动协商一个都支持的速率

Link detected yes 表示网卡插好网线了(亮了),插好网线激活网卡(ifup ethx, 其实是二层up)才会yes

查看网卡驱动 ethtool -i ethx

[root@localhost ~]# ethtool -i ens33
driver: e1000
version: 7.3.21-k8-NAPI
firmware-version: 
expansion-rom-version: 
bus-info: 0000:02:01.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: no
[root@localhost ~]# lspci -vv | grep Eth   查看网卡型号
02:01.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
[root@localhost ~]# lspci | grep Eth   查看网卡型号
02:01.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
[root@localhost ~]#



机器型号:

[root@localhost ~]# dmidecode |grep -i "product name"
    Product Name: VMware Virtual Platform
    Product Name: 440BX Desktop Reference Platform
[root@localhost ~]#

内核信息:

[root@localhost ~]# uname -r
2.6.32-431.el6.x86_64
[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# uname -i
x86_64
[root@localhost ~]#

系统版本信息:

[root@justin ~]# cat /etc/issue
Red Hat Enterprise Linux Server release 6.3 (Santiago)
Kernel \r on an \m
[root@justin ~]#
[root@justin ~]# cat /etc/*release
Red Hat Enterprise Linux Server release 6.3 (Santiago)
Red Hat Enterprise Linux Server release 6.3 (Santiago)
[root@justin ~]#
[root@justin ~]# cat /etc/*release|sort|uniq -c
      2 Red Hat Enterprise Linux Server release 6.3 (Santiago)
[root@justin ~]#
[root@justin ~]# lsb_release -a
LSB Version:    :core-4.0-ia32:core-4.0-noarch:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description:    Red Hat Enterprise Linux Server release 6.3 (Santiago)
Release:    6.3
Codename:   Santiago
[root@justin ~]#
[root@justin ~]# cat /proc/version
Linux version 2.6.32-279.el6.i686 (mockbuild@x86-010.build.bos.redhat.com) (gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) ) #1 SMP Wed Jun 13 18:23:32 EDT 2012
[root@justin ~]#
[root@justin ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.3 (Santiago)
[root@justin ~]#
[root@justin ~]# rpm -q centos-release
package centos-release is not installed
[root@justin ~]#

系统支持的文件系统类型:

[root@justin ~]# cat /etc/filesystems
ext4
ext3
ext2
nodev proc
nodev devpts
iso9660
vfat
hfs
hfsplus
[root@justin ~]#


内核模块信息

显示已加载的模块

[root@Port_Forward ~]# lsmod 
[root@Port_Forward ~]# lsmod |grep bridge

加载RAID1阵列级别模块

[root@Port_Forward ~]# modprobe raid1

 删除RAID1阵列级别模块

[root@Port_Forward ~]# modprobe -r raid1

modprobe命令在加载模块时会自动解决依赖的模块。当加载的模块需依赖另一个模块时,系统会自动将此模块加载。而当用户使用insmod命令加载模块时,则不会自动解决相对应的依赖模块。modprobe命令中的"-r"参数表示删除指定模块,"-c"参数表示显示/etc/modprobe.conf配置文件的参数,"-C"参数表示指定内核配置文件,"-f"表示覆盖,"-l"表示显示模块的绝对路径。



  • 查看系统安装时间

[root@localhost webserver]# df -Th
Filesystem     Type     Size  Used Avail Use% Mounted on
/dev/sda3      ext4     280G  115G  151G  44% /
tmpfs          tmpfs    3.9G     0  3.9G   0% /dev/shm
/dev/sda1      ext4     194M   27M  158M  15% /boot
/dev/sr0       iso9660  4.2G  4.2G     0 100% /mnt
/dev/sr0       iso9660  4.2G  4.2G     0 100% /media
[root@localhost webserver]# tune2fs -l /dev/sda1 | grep create
Filesystem created:       Thu May 14 17:24:48 2015
[root@localhost webserver]# passwd -S zabbix
zabbix LK 2015-07-15 0 99999 7 -1 (Password locked.)
You have new mail in /var/spool/mail/root
[root@localhost webserver]#



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值