Solaris中查看硬件信息常用命令

 

1、如何查看cpu的狀態? 

# psrinfo -v

  1. # psrinfo -v Status of virtual processor 0 as of: 03/20/2012 17:16:26 on-line since 03/19/2012 13:37:54. The i386 processor operates at 3000 MHz, and has an i387 compatible floating point processor. Status of virtual processor 1 as of: 03/20/2012 17:16:26 on-line since 03/19/2012 13:37:59. The i386 processor operates at 3000 MHz, and has an i387 compatible floating point processor.


# mpstat 可以列出多cpu負載的狀態

  1. # mpstat 
  2. CPU minf mjf xcal  intr ithr  csw icsw migr smtx  srw syscl  usr sys  wt idl 
  3.   0   13   0    3   473  173  299    4   19    3    0  5095    1   0   0  99 
  4.   1   14   0    2   244   59  328    4   19    2    0  4851    1   0   0  99 

顯示cpu使用率最高的進程

  1. # ps -eo pid,pcpu,args | sort +1n 
  2.     0  0.0 sched 
  3.     1  0.0 /usr/sbin/init 
  4.     2  0.0 pageout 
  5.     3  0.0 fsflush 
  6.     5  0.0 zpool-rpool 
  7.     6  0.0 kmem_task 
  8.     7  0.0 intrd 
  9.     8  0.0 vmtasks 



顯示內存佔用率最高的進程

  1. # ps  -eo pid,vsz,args | sort +1n 
  2.     0    0 sched 
  3.     2    0 pageout 
  4.     3    0 fsflush 
  5.     5    0 zpool-rpool 
  6.     6    0 kmem_task 
  7.     7    0 intrd 
  8.     8    0 vmtasks 
  9.   184    0 zpool-myrpool 
  10.   878    0 nfs4cbd_kproc 
  11.   883    0 lockd_kproc 
  12.   PID  VSZ COMMAND 
  13.  2008    0 nfsd_kproc 
  14. ......... 

顯示當前的運行級別

  1. # who -rH 
  2. NAME       LINE         TIME          IDLE    PID  COMMENTS 
  3.    .       run-level 3  Mar  8 15:48     3      0  S 

# 獲得系統信息

  1. # uname -X 
  2. System = SunOS 
  3. Node = ${HOSTNAME} 
  4. Release = 5.11 
  5. KernelID = 11.1 
  6. Machine = sun4v 
  7. BusType = <unknown> 
  8. Serial = <unknown> 
  9. Users = <unknown> 
  10. OEM# = 0 
  11. Origin# = 1 
  12. NumCPU = 16 

# 網卡的信息

  1. # netstat -np 
  2. Net to Media Table: IPv4 
  3. Device   IP Address               Mask      Flags      Phys Addr 
  4. ------ -------------------- --------------- -------- --------------- 
  5. net0   10.113.193.238       255.255.255.255 SPLA     00:14:4f:2a:97:e0 
  6. net0   10.113.193.227       255.255.255.255          00:03:ba:51:b6:59 
  7. net0   10.113.193.231       255.255.255.255          00:14:4f:2a:cc:42 
  8. net0   10.113.193.221       255.255.255.255          00:14:4f:1f:cf:04 
  9. net0   10.113.193.211       255.255.255.255          00:1e:68:04:43:ee 
  10. net0   10.113.193.202       255.255.255.255          00:c0:9f:49:d8:ee 
  11. net0   10.113.193.32        255.255.255.255          00:09:3d:13:c1:ec 
  12. net0   10.113.193.33        255.255.255.255          00:23:8b:76:e9:92 
  13. net0   10.113.193.29        255.255.255.255          00:14:4f:3e:98:6f 
  14. net0   10.113.193.2         255.255.255.255          00:d0:00:65:ec:00 
  15. net0   10.113.193.3         255.255.255.255          00:d0:02:d4:30:00 
  16. net0   10.113.193.1         255.255.255.255          00:00:0c:07:ac:c1 
  17. net0   10.113.193.75        255.255.255.255          00:0c:29:88:c6:74 
  1. kstat -c net|grep name 
  2. name:   chipid                          class:    net 
  3. name:   driverinfo                      class:    net 
  4. name:   phydata                         class:    net 
  5. name:   phys                            class:    net 
  6. name:   statistics                      class:    net 
  7. name:   chipid                          class:    net 
  8. name:   driverinfo                      class:    net 
  9. name:   phydata                         class:    net 
  10. name:   phys                            class:    net 
  11. name:   statistics                      class:    net 
  12. name:   chipid                          class:    net 
  13. name:   driverinfo                      class:    net 
  14. name:   phydata                         class:    net 
  15. name:   phys                            class:    net 
  16. name:   statistics                      class:    net 
  17. name:   chipid                          class:    net 
  18. name:   driverinfo                      class:    net 
  19. name:   phydata                         class:    net 
  20. name:   phys                            class:    net 
  21. name:   statistics                      class:    net 
  22. name:   mac_rx_hwlane0                  class:    net 
  23. name:   mac_rx_ring0                    class:    net 
  24. name:   mac_rx_hwlane0                  class:    net 
  25. name:   mac_rx_ring0                    class:    net 
  26. name:   mac_rx_hwlane0                  class:    net 
  27. name:   mac_rx_hwlane1                  class:    net 
  28. name:   mac_rx_hwlane2                  class:    net 
  29. name:   mac_rx_hwlane3                  class:    net 
  30. name:   mac_rx_ring0                    class:    net 
  31. name:   mac_rx_ring1                    class:    net 
  32. name:   mac_rx_ring2                    class:    net 
  33. name:   mac_rx_ring3                    class:    net 
  34. name:   mac_rx_hwlane0                  class:    net 
  35. name:   mac_rx_hwlane1                  class:    net 
  36. name:   mac_rx_hwlane2                  class:    net 
  37. name:   mac_rx_hwlane3                  class:    net 
  38. name:   mac_rx_ring0                    class:    net 
  39. name:   mac_rx_ring1                    class:    net 
  40. name:   mac_rx_ring2                    class:    net 
  41. name:   mac_rx_ring3                    class:    net 
  42. name:   ip6stat                         class:    net 
  43. name:   ipdrop                          class:    net 
  44. name:   ipsec_stat                      class:    net 
  45. name:   ipstat                          class:    net 
  46. name:   inbound                         class:    net 
  47. name:   outbound                        class:    net 
  48. name:   ah_stat                         class:    net 
  49. name:   esp_stat                        class:    net 
  50. name:   net0                            class:    net 
  51. name:   net1                            class:    net 
  52. name:   net2                            class:    net 
  53. name:   net3                            class:    net 
  54. name:   net4                            class:    net 
  55. name:   lo0                             class:    net 
  56. name:   link                            class:    net 
  57. name:   link                            class:    net 
  58. name:   link                            class:    net 
  59. name:   link                            class:    net 
  60. name:   sctpstat                        class:    net 
  61. name:   sdpstat                         class:    net 
  62. name:   strstat                         class:    net 
  63. name:   tcpstat                         class:    net 
  64. name:   tcpstat_g                       class:    net 
  65. name:   udpstat                         class:    net 
  66. name:   phys                            class:    net 
  67. name:   link                            class:    net 


2、如何查看內存? 

# prtconf | grep 'Memory' 可以查看內存的多少.

  1. # prtconf | grep 'Memory' 
  2. Memory size: 3932 Megabytes 


# /usr/platform/sun4v/sbin/prtdiag | grep 'Memory'

  1. #  /usr/platform/sun4v/sbin/prtdiag  
  2. System Configuration:  Oracle Corporation  sun4v Sun Fire(TM) T1000 
  3. Memory size: 1852 Megabytes 
  4.  
  5. ================================ Virtual CPUs ================================ 
  6.  
  7.  
  8. CPU ID Frequency Implementation         Status 
  9. ------ --------- ---------------------- ------- 
  10. 0      1000 MHz  SUNW,UltraSPARC-T1     on-line   
  11. 1      1000 MHz  SUNW,UltraSPARC-T1     on-line   
  12. 2      1000 MHz  SUNW,UltraSPARC-T1     on-line   
  13. 3      1000 MHz  SUNW,UltraSPARC-T1     on-line   
  14. 4      1000 MHz  SUNW,UltraSPARC-T1     on-line   
  15. 5      1000 MHz  SUNW,UltraSPARC-T1     on-line   
  16. 6      1000 MHz  SUNW,UltraSPARC-T1     on-line   
  17. 7      1000 MHz  SUNW,UltraSPARC-T1     on-line   
  18. 8      1000 MHz  SUNW,UltraSPARC-T1     on-line   
  19. 9      1000 MHz  SUNW,UltraSPARC-T1     on-line   
  20. 10     1000 MHz  SUNW,UltraSPARC-T1     on-line   
  21. 11     1000 MHz  SUNW,UltraSPARC-T1     on-line   
  22. 12     1000 MHz  SUNW,UltraSPARC-T1     on-line   
  23. 13     1000 MHz  SUNW,UltraSPARC-T1     on-line   
  24. 14     1000 MHz  SUNW,UltraSPARC-T1     on-line   
  25. 15     1000 MHz  SUNW,UltraSPARC-T1     on-line   
  26.  
  27. ========================= IO Configuration ========================= 
  28.  
  29.             IO                                                                                            
  30. Location    Type  Slot Path                                          Name                      Model      
  31. ----------- ----- ---- --------------------------------------------- ------------------------- ---------- 
  32. MB/NET0    PCIE     MB                      /pci@7c0/pci@0/network@4      network-pci14e4,1668            
  33. MB/NET1    PCIE     MB                    /pci@7c0/pci@0/network@4,1      network-pci14e4,1668            
  34. MB/NET2    PCIX     MB                /pci@7c0/pci@0/pci@8/network@1      network-pci108e,1648            
  35. MB/NET3    PCIX     MB              /pci@7c0/pci@0/pci@8/network@1,1      network-pci108e,1648            
  36. MB/PCIX    PCIX     MB                   /pci@7c0/pci@0/pci@8/scsi@2           scsi-pci1000,50   LSI,1064 


3、如何動態添加swap分區?

# $su - root ----- 成爲超級用戶
# mkfile 100m /home/swapfile ----- 創建100m的Swap文件
# /usr/sbin/swap -a /path/filename ----- 激活Swap文件
# /usr/sbin/swap -l ----- 驗證swap文件
# /usr/sbin/swap -d /path/filename ----- 取消swap文件
# rm -rf /home/swapfile ----- 刪除swap文件

4、如何查看當前網卡是以何種速率起來的?

# dmesg |grep link

  1. # dmesg | grep link 
  2. .[ID 435574 kern.info] NOTICE: e1000g0 link up, 100 Mbps, full duplex 


6、如何使用光、軟驅?

一般情況下用:
# /etc/init.d/volmgt start
# volcheck
以上方法不行,用:
# /etc/init.d/volmgt stop
# mount -F hsfs -o ro /dev/dsk/c0t6d0s0 /cdrom --掛接光驅
# mount -F pcfs /dev/diskette0 /floppy --掛接軟驅
solaris定義系統磁盤文件系統說明:
ufs – UNIX文件系統。
zfs -  是Solaris缺省的文件系統。
hsfs – 高密度CD-ROM文件系統,是隻讀文件系統。
pcfs – PC文件系統,支持DOS格式化的軟盤

7、SCSI設備的命名規則是什麼?

帶有總線控制器的硬盤的使用,下面列出了總線控制器的硬盤命名習慣:
cWtXdYsZ
c Logical controller number
t Physical bus target number
d Drive number
s Slice (or partition) number (0 to 7)
例如:
/dev/rdsk/c0t0d0s0 該原始接口對應第一個控制器的第一個SCSI目標地址的第一個硬盤的第一片(根)
/dev/rdsk/c0t0d0s2 該原始接口對應第一個控制器的第一個SCSI目標地址上的第一個硬盤的第三片(表示

整上硬盤)

8、如何查看硬盤的使用情況? 


# df -k    可以看到已安裝的文件系統的空間大小及剩餘空間大小。
# quota -v  查看用戶的磁盤空間信息,如果你用quota限制了用戶空間大小的話。
# du -sk *    查看目錄的使用情況
# du -k | sort -n 可以迅速發現那個目錄是最大的。

9、如何查看硬盤物理信息?

# format 這個命令也可以查看硬盤的類型和分區的詳細情況

  1. # format   
  2. Searching for disks...done  
  3.   
  4.   
  5. AVAILABLE DISK SELECTIONS:  
  6.        0. c2t0d0 <SUN80G cyl 65533 alt 2 hd 16 sec 149>  
  7.           /pci@7c0/pci@0/pci@8/scsi@2/sd@0,0  


# iostat -E  看硬盤的大小和型號

  1. # iostat -E 
  2. sd1       Soft Errors: 0 Hard Errors: 0 Transport Errors: 0  
  3. Vendor: ATA      Product: HITACHI HDS7280S Revision: A6CA Serial No:   
  4. Size: 80.03GB <80026361856 bytes> 
  5. Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0  
  6. Illegal Request: 295 Predictive Failure Analysis: 0  


# prtvtoc /dev/rdsk/c0t0d0s0 顯示某個磁盤的分區狀況

  1. # prtvtoc /dev/dsk/c2t0d0s0  
  2. * /dev/dsk/c2t0d0s0 partition map  
  3. *  
  4. * Dimensions:  
  5. *     512 bytes/sector  
  6. *     149 sectors/track  
  7. *      16 tracks/cylinder  
  8. *    2384 sectors/cylinder  
  9. *   65535 cylinders  
  10. *   65533 accessible cylinders  
  11. *  
  12. * Flags:  
  13. *   1: unmountable  
  14. *  10: read-only  
  15. *  
  16. * Unallocated space:  
  17. *   First     Sector    Last  
  18. *   Sector     Count    Sector   
  19. *           0      2384      2383  
  20. *  
  21. *                          First     Sector    Last  
  22. * Partition  Tag  Flags    Sector     Count    Sector  Mount Directory  
  23.        0      2    00       2384 156228288 156230671  
  24.        2      5    01          0 156230672 156230671  



10、查看系統內核命令。 

# isainfo 看內核的bit,
# isainfo -kv 調整內核
# modinfo 顯示可載入的模組
# prtconf 顯示系統硬件配置(周邊設備)
#sysdef 顯示可載入的模組,硬件配置與一些可以調整的核心參考值
#ulimit -a

11、打印當前的OBP版本號

# prtconf -V

  1. # prtconf -V 
  2. OBP 4.27.7 2007/10/24 08:23 


# /usr/platform/sun4v/sbin/prtdiag –v | grep OBP

  1. # /usr/platform/sun4v/sbin/prtdiag -v | grep OBP 
  2. OBP 4.27.7 2007/10/24 08:23 


12、查看及啓動系統的64位內核模式

64位模式
# isalist –v
sparcv9+vis sparcv9 sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc
# isainfo –v
64-bit sparcv9 applications
32-bit sparc applications
# isainfo –b
64

14、如何配置網卡ip?

# ifconfig -a --查看網卡,例如是hme0
# ifconfig hme0 unplumb --停止網卡
# ifconfig hme0 plumb --起用網卡
# ifconfig hme0 inet 192.168.2.3 netmask 255.255.255.0 up --添加ip、子網掩碼
# vi /etc/defaultrouter 添加默認路由的ip
# vi /etc/hostname.hme0 添加主機名
# vi /etc/nodename 添加主機名
# vi /etc/resolv.conf
domain china.com 你的域名
nameserver 202.106.0.20 你使用的nds ip
# vi /etc/nsswitch.conf 更改 hosts:file dns
# vi /etc/hosts
# getent hosts $HOSTNAME

15、 PROM狀態命令與參數


格式: OK> 指令
命令 說明
banner 顯示當前機器配置狀況,CPU,內存,hostid,EtherNet
probe-scsi 顯示內部SCSI通道所掛接設備
probe-scsi-all 顯示所有SCSI通道及所掛接設備
probe-ide 顯示所有IDE通道及所掛接設備(針對U10,U5)
devalias 顯示設備別名,如 cdrom,disk,disk0,disk1等
printenv 無參數,顯示環境變量或
參數爲環境變量名 如: printenv auto-boot?
setenv 設置環境變量,如: setenv auto-boot? false
set-default 恢復環境變量預定值 如:set-default auto-boot?
set-defaults 恢復所有環境變量預定值
boot device option 啓動主機
設備別名: cdrom 或 disk
設備名: /pci@1f,4000/scsi@3,1/disk@6,0:f
option -r 設備配置
-s 單用戶
eject cdrom|floppy 彈出cdrom或floppy
reset 復位
test net
watch-net-all
show-devs

16、查找網卡名稱及接口個數


# grep network /etc/path_to_inst

  1. # grep network /etc/path_to_inst 
  2. "/pci@7c0/pci@0/pci@8/network@1" 2 "bge" 
  3. "/pci@7c0/pci@0/pci@8/network@1,1" 3 "bge" 
  4. "/pci@7c0/pci@0/network@4" 0 "bge" 
  5. "/pci@7c0/pci@0/network@4,1" 1 "bge" 
  6. "/virtual-devices@100/channel-devices@200/virtual-network-switch@0" 0 "vsw" 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章