1、如何查看cpu的狀態?
# psrinfo -v
- # 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負載的狀態
- # mpstat
- CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
- 0 13 0 3 473 173 299 4 19 3 0 5095 1 0 0 99
- 1 14 0 2 244 59 328 4 19 2 0 4851 1 0 0 99
# 顯示cpu使用率最高的進程
- # ps -eo pid,pcpu,args | sort +1n
- 0 0.0 sched
- 1 0.0 /usr/sbin/init
- 2 0.0 pageout
- 3 0.0 fsflush
- 5 0.0 zpool-rpool
- 6 0.0 kmem_task
- 7 0.0 intrd
- 8 0.0 vmtasks
# 顯示內存佔用率最高的進程
- # ps -eo pid,vsz,args | sort +1n
- 0 0 sched
- 2 0 pageout
- 3 0 fsflush
- 5 0 zpool-rpool
- 6 0 kmem_task
- 7 0 intrd
- 8 0 vmtasks
- 184 0 zpool-myrpool
- 878 0 nfs4cbd_kproc
- 883 0 lockd_kproc
- PID VSZ COMMAND
- 2008 0 nfsd_kproc
- .........
# 顯示當前的運行級別
- # who -rH
- NAME LINE TIME IDLE PID COMMENTS
- . run-level 3 Mar 8 15:48 3 0 S
# 獲得系統信息
- # uname -X
- System = SunOS
- Node = ${HOSTNAME}
- Release = 5.11
- KernelID = 11.1
- Machine = sun4v
- BusType = <unknown>
- Serial = <unknown>
- Users = <unknown>
- OEM# = 0
- Origin# = 1
- NumCPU = 16
# 網卡的信息
- # netstat -np
- Net to Media Table: IPv4
- Device IP Address Mask Flags Phys Addr
- ------ -------------------- --------------- -------- ---------------
- net0 10.113.193.238 255.255.255.255 SPLA 00:14:4f:2a:97:e0
- net0 10.113.193.227 255.255.255.255 00:03:ba:51:b6:59
- net0 10.113.193.231 255.255.255.255 00:14:4f:2a:cc:42
- net0 10.113.193.221 255.255.255.255 00:14:4f:1f:cf:04
- net0 10.113.193.211 255.255.255.255 00:1e:68:04:43:ee
- net0 10.113.193.202 255.255.255.255 00:c0:9f:49:d8:ee
- net0 10.113.193.32 255.255.255.255 00:09:3d:13:c1:ec
- net0 10.113.193.33 255.255.255.255 00:23:8b:76:e9:92
- net0 10.113.193.29 255.255.255.255 00:14:4f:3e:98:6f
- net0 10.113.193.2 255.255.255.255 00:d0:00:65:ec:00
- net0 10.113.193.3 255.255.255.255 00:d0:02:d4:30:00
- net0 10.113.193.1 255.255.255.255 00:00:0c:07:ac:c1
- net0 10.113.193.75 255.255.255.255 00:0c:29:88:c6:74
- kstat -c net|grep name
- name: chipid class: net
- name: driverinfo class: net
- name: phydata class: net
- name: phys class: net
- name: statistics class: net
- name: chipid class: net
- name: driverinfo class: net
- name: phydata class: net
- name: phys class: net
- name: statistics class: net
- name: chipid class: net
- name: driverinfo class: net
- name: phydata class: net
- name: phys class: net
- name: statistics class: net
- name: chipid class: net
- name: driverinfo class: net
- name: phydata class: net
- name: phys class: net
- name: statistics class: net
- name: mac_rx_hwlane0 class: net
- name: mac_rx_ring0 class: net
- name: mac_rx_hwlane0 class: net
- name: mac_rx_ring0 class: net
- name: mac_rx_hwlane0 class: net
- name: mac_rx_hwlane1 class: net
- name: mac_rx_hwlane2 class: net
- name: mac_rx_hwlane3 class: net
- name: mac_rx_ring0 class: net
- name: mac_rx_ring1 class: net
- name: mac_rx_ring2 class: net
- name: mac_rx_ring3 class: net
- name: mac_rx_hwlane0 class: net
- name: mac_rx_hwlane1 class: net
- name: mac_rx_hwlane2 class: net
- name: mac_rx_hwlane3 class: net
- name: mac_rx_ring0 class: net
- name: mac_rx_ring1 class: net
- name: mac_rx_ring2 class: net
- name: mac_rx_ring3 class: net
- name: ip6stat class: net
- name: ipdrop class: net
- name: ipsec_stat class: net
- name: ipstat class: net
- name: inbound class: net
- name: outbound class: net
- name: ah_stat class: net
- name: esp_stat class: net
- name: net0 class: net
- name: net1 class: net
- name: net2 class: net
- name: net3 class: net
- name: net4 class: net
- name: lo0 class: net
- name: link class: net
- name: link class: net
- name: link class: net
- name: link class: net
- name: sctpstat class: net
- name: sdpstat class: net
- name: strstat class: net
- name: tcpstat class: net
- name: tcpstat_g class: net
- name: udpstat class: net
- name: phys class: net
- name: link class: net
2、如何查看內存?
# prtconf | grep 'Memory' 可以查看內存的多少.
- # prtconf | grep 'Memory'
- Memory size: 3932 Megabytes
# /usr/platform/sun4v/sbin/prtdiag | grep 'Memory'
- # /usr/platform/sun4v/sbin/prtdiag
- System Configuration: Oracle Corporation sun4v Sun Fire(TM) T1000
- Memory size: 1852 Megabytes
- ================================ Virtual CPUs ================================
- CPU ID Frequency Implementation Status
- ------ --------- ---------------------- -------
- 0 1000 MHz SUNW,UltraSPARC-T1 on-line
- 1 1000 MHz SUNW,UltraSPARC-T1 on-line
- 2 1000 MHz SUNW,UltraSPARC-T1 on-line
- 3 1000 MHz SUNW,UltraSPARC-T1 on-line
- 4 1000 MHz SUNW,UltraSPARC-T1 on-line
- 5 1000 MHz SUNW,UltraSPARC-T1 on-line
- 6 1000 MHz SUNW,UltraSPARC-T1 on-line
- 7 1000 MHz SUNW,UltraSPARC-T1 on-line
- 8 1000 MHz SUNW,UltraSPARC-T1 on-line
- 9 1000 MHz SUNW,UltraSPARC-T1 on-line
- 10 1000 MHz SUNW,UltraSPARC-T1 on-line
- 11 1000 MHz SUNW,UltraSPARC-T1 on-line
- 12 1000 MHz SUNW,UltraSPARC-T1 on-line
- 13 1000 MHz SUNW,UltraSPARC-T1 on-line
- 14 1000 MHz SUNW,UltraSPARC-T1 on-line
- 15 1000 MHz SUNW,UltraSPARC-T1 on-line
- ========================= IO Configuration =========================
- IO
- Location Type Slot Path Name Model
- ----------- ----- ---- --------------------------------------------- ------------------------- ----------
- MB/NET0 PCIE MB /pci@7c0/pci@0/network@4 network-pci14e4,1668
- MB/NET1 PCIE MB /pci@7c0/pci@0/network@4,1 network-pci14e4,1668
- MB/NET2 PCIX MB /pci@7c0/pci@0/pci@8/network@1 network-pci108e,1648
- MB/NET3 PCIX MB /pci@7c0/pci@0/pci@8/network@1,1 network-pci108e,1648
- 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
- # dmesg | grep link
- .[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 這個命令也可以查看硬盤的類型和分區的詳細情況
- # format
- Searching for disks...done
- AVAILABLE DISK SELECTIONS:
- 0. c2t0d0 <SUN80G cyl 65533 alt 2 hd 16 sec 149>
- /pci@7c0/pci@0/pci@8/scsi@2/sd@0,0
# iostat -E 看硬盤的大小和型號
- # iostat -E
- sd1 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
- Vendor: ATA Product: HITACHI HDS7280S Revision: A6CA Serial No:
- Size: 80.03GB <80026361856 bytes>
- Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
- Illegal Request: 295 Predictive Failure Analysis: 0
# prtvtoc /dev/rdsk/c0t0d0s0 顯示某個磁盤的分區狀況
- # prtvtoc /dev/dsk/c2t0d0s0
- * /dev/dsk/c2t0d0s0 partition map
- *
- * Dimensions:
- * 512 bytes/sector
- * 149 sectors/track
- * 16 tracks/cylinder
- * 2384 sectors/cylinder
- * 65535 cylinders
- * 65533 accessible cylinders
- *
- * Flags:
- * 1: unmountable
- * 10: read-only
- *
- * Unallocated space:
- * First Sector Last
- * Sector Count Sector
- * 0 2384 2383
- *
- * First Sector Last
- * Partition Tag Flags Sector Count Sector Mount Directory
- 0 2 00 2384 156228288 156230671
- 2 5 01 0 156230672 156230671
10、查看系統內核命令。
# isainfo 看內核的bit,
# isainfo -kv 調整內核
# modinfo 顯示可載入的模組
# prtconf 顯示系統硬件配置(周邊設備)
#sysdef 顯示可載入的模組,硬件配置與一些可以調整的核心參考值
#ulimit -a
11、打印當前的OBP版本號
# prtconf -V
- # prtconf -V
- OBP 4.27.7 2007/10/24 08:23
# /usr/platform/sun4v/sbin/prtdiag –v | grep OBP
- # /usr/platform/sun4v/sbin/prtdiag -v | grep OBP
- 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
- # grep network /etc/path_to_inst
- "/pci@7c0/pci@0/pci@8/network@1" 2 "bge"
- "/pci@7c0/pci@0/pci@8/network@1,1" 3 "bge"
- "/pci@7c0/pci@0/network@4" 0 "bge"
- "/pci@7c0/pci@0/network@4,1" 1 "bge"
- "/virtual-devices@100/channel-devices@200/virtual-network-switch@0" 0 "vsw"