239笔记
1-11章节。
Module 1 Introducing the SolarisTM OE Directory Hierarchy
Module 2 Managing Local Disk Devices
slide 看磁盘结构.
Slice Name Function
0 / The root directory’s system files
1 swap Swap area
2 Entire disk
5 /opt Optional software
6 /usr System executables and programs
7 /export/home User files and directories
Disk Slice Naming Convention
Controller number : Identifies the host bus adapter (HBA), which controls communications between the system and disk unit. The HBA takes care of sending and receiving both commands and data to the device. The controller number is assigned in sequential order, such as c0, c1, c2, and so on.
Target number : Target numbers, such as t0, t1, t2, and t3,correspond to a unique hardware address that is assigned to each disk, tape, or CD-ROM. Some
external disk drives have an address switch located on the rear panel. Some internal disks have address pins that are jumpered to assign that disk’s target number.
Disk number : The disk number is also known as the logical unit number (LUN). This number reflects the number of disks at the target location.
Slice number : A slice number ranging from 0 to 7.
见 SCSI 与 IDE 两种架构 图
Introducing Solaris OE Device Naming Conventions
Logical device names /dev/dsk and /dev/rdsk
Physical device names /devices
Instance names for example : sdn dadn
# ls /dev/dsk
# ls -l /dev/dsk/c0t0d0s0
Instance names are abbreviated names assigned by the kernel for each device on the system.
Listing a System’s Devices
Using the /etc/path_to_inst file
Using the prtconf command
Using the format command
different bus architecture.
more /etc/path_to_inst
peripheral component interconnect (PCI) 外围组件接口
Sun System bus (SBus).
# prtconf | grep -v not To view a list of only attached devices on the system,
# format
Reconfiguring Devices
Performing a Reconfiguration Boot
1.#touch /reconfigure
2# init 5
3. Turn off the power to all external devices.
4. Install the peripheral device.
5. Turn on the power to all external devices.
6. Turn on the power to the system.
7. Verify that the peripheral device has been added by issuing either the prtconf or format command.
boot -r.
(If the /reconfigure file was not created before the system was shut down,)
Using the devfsadm Command
The devfsadm command performs the device reconfiguration process and updates the /etc/path_to_inst file and the /dev and /devices directories during reconfiguration events.(7*24小时)
devfsadm or devfsadm -c device_class disk, tape, port, audio, and pseudo.
# devfsadm -c disk
# devfsadm -c disk -c tape -c audio
devfsadm -i driver_name
# devfsadm -i sd
Disk Labels(the volume table of contents (VTOC).)
The format utility also works with a file called /etc/format.dat,
To label a disk means to write slice information onto the disk。
Partition Table Terms and Usage
format>键入”?” ,可以查看可输入的值列表
Saving a Partition Table to the /etc/format.dat File
partition> name
format> save
partition> select
partition> label
format> verify
format>modify 测试OK All Free Hog slice(该分区大小为剩余空间).
format> verify
备份恢复分区表
# prtvtoc /dev/rdsk/c1t0d0s2
To save a disk’s VTOC to a file
# prtvtoc /dev/rdsk/c1t0d0s2 > /vtoc/c1t0d0
fmthard -s datafile /dev/rdsk/c#t#d#s2
-s datafile必须是另一个盘的文件。
模拟测试,prtvtoc 备份分区文件,dd删除.……fmthard恢复…….
# dd if=/dev/zero f=/dev/rdsk/c1t0d0s2 bs=512 count=1
……
Module 3 Managing the Solaris OE File System
Disk-based File Systems
ufs – The UNIX file system
hsfs – The High Sierra file system
pcfs – The PC file system
udfs – The Universal Disk Format file system
Distributed File Systems
NFS – The network file system
Pseudo File Systems
Pseudo file systems are memory based.
tmpfs – The temporary file system
swapfs – The swap file system
fdfs – The file descriptor file system
procfs – The process file system
mntfs – The mount file system
To create a ufs file system newfs 比 mkfs 好用多了。
/usr/sbin/newfs
# newfs /dev/rdsk/c1t3d0s0
The newfs command reserves between 1 and 10 percent of the file system space for maintenance of the file system.
To show the value of minfree on a file system,
# fstyp -v /dev/rdsk/c0t0d0s0 | head -10
# tunefs -m 1 /dev/rdsk/c1t3d0s0
fsck Command
Never run the fsck command on a mounted file system.
When the state flag is “clean,” “stable,” or “logging,” file system scans are not run.
clean表示文件系统umount后无人用,stable表示文件系统用过,但却是完整的,好的。而出一大堆的话,还有什么fragment %什么的的那都表示文件系统上有乱的地方,那么就应该进入系统后使用fsck来整理
# fsck /dev/rdsk/c0t0d0s7
# fsck -o f,p /dev/rdsk/c0t0d0s5 #。强制检查,非交互
Every file system has an alternative backup superblock at block number 32
# fsck -o b=32 /dev/rdsk/c1t3d0s0
# du -sk /opt
# quot -f /dev/dsk/c1t0d0s5
/dev/rdsk/c1t0d0s5:
3220 69 root
number of blocks owned, the count of number of files,and the user name
newfs -N 显示所有备份的超级块。(dd命令破坏超级块,然后用fsck修复,磁盘应是从0开始计数)
Newfs 选择i参数不同值,纪录对比结果如下, newfs –i xxxxx /dev/rdsk/c#t#d0s3
Cylinder groups:363 330
Cylinders per group:10 11
Inodes per group:6016 3328
Module 4: Performing Mounts and Unmounts
# more /etc/mnttab
# mount
# mount /dev/dsk/c0t0d0s7 /export/home
mount默认的选项,read/write,nologging等……
/etc/default/fs 本地默认
/etc/dfs/fstypes 远程默认
# fstyp /dev/rdsk/c0t0d0s7
# mount -F hsfs -o ro /dev/dsk/c0t6d0s0 /cdrom
# umountall
# umountall –l (local)
Unmounting a Busy File System
fuser command .Lists all of the processes that are accessing the file system and kills them if necessary 测试
umount -f command
Repairing Important Files if Boot Fails
ok boot cdrom –s
# fsck /dev/rdsk/c0t0d0s0
# mount /dev/dsk/c0t0d0s0 /a
# TERM=sun (显示设备变了,选vt100了吧)
# export TERM
# vi /a/etc/vfstab
# cd /
# umount /a
# init 6
Accessing Mounted Diskettes and CD-ROMs
If a CD-ROM fails to eject from the drive,
# /etc/init.d/volmgt stop
or as a last resort:
# pkill -9 vold
Push the button on the system to eject the CD-ROM.
# /etc/init.d/volmgt start
Wait a few seconds, and then push the CD-ROM tray back into the drive.
# mount -F hsfs -o ro /dev/dsk/c0t6d0s0 /cdrom
# mkdir /pcfs
# mount -F pcfs /dev/diskette /pcfs
Module 5 Installing the Solaris™9 Operating Environment
l Solaris suninstall program
l Solaris™ Web Start Installation software
l Custom JumpStart™ procedure
The JumpStart procedure is a command-line interface that enables you to incorporate
shell scripts.
l Solaris Web Start Flash installation
l Standard upgrade
l Solaris™ Live Upgrade method
l Software packages
l Software clusters
l Software groups
以上三项为部分整体关系
which cluster configuration has been installed
# cat /var/sadm/system/admin/CLUSTER
Core Software Group (SUNWCreq)
End User System Support Software Group (SUNWCuser)
Developer System Support Software Group (SUNWCprog)
Entire Distribution Software Group (SUNWCall)
Entire Distribution Plus OEM Support Software Group (SUNWCXall)
测试了V120安装:
sun机器lom口―终端服务器(10.86.3.30 10007)―PC(2000):
windows2000 telnet 10.86.3.30 10007 àok>boot cdrom
安装日志:/var/sadm/install_data/install_log file.
Module 6: Performing Solaris 9 OE Package Administration
To view information about packages that are located on Solaris 9 Software
1 of 2 CD-ROM
# pkginfo -d /cdrom/cdrom0/s0/Solaris_9/Product |more
The pkgadd command, by default,
looks in the /var/spool/pkg directory for any packages specified on the
command line.
# pkgadd -d /cdrom/cdrom0/s0/Solaris_9/Product -s spool SUNWensqr.u
# ls -al /var/spool/pkg
# pkgrm -s spool SUNWensqr.u
for example:
# pkginfo | grep anual
# pkginfo -l SUNWman
# pkginfo -d /cdrom/cdrom0/Solaris_9/Product -l SUNWman
# pkgrm SUNWman
# pkginfo SUNWman
# man ls
No manual entry for ls.
# pkgadd -d /cdrom/cdrom0/Solaris_9/Product SUNWman
# man ls
# pkgrm SUNWdoc
# pkgadd -d /cdrom/cdrom0/s0/Solaris_9/Product -s spool SUNWdoc
# pkginfo -d spool SUNWdoc
# pkginfo -d /var/spool/pkg -l SUNWdoc
# pkgadd SUNWdoc
# pkgrm -s spool SUNWdoc
# pkginfo -d spool SUNWdoc
ERROR: information for "SUNWdoc" was not found
# pkginfo -l SUNWdoc
Module 7 Managing SoftwarePatcheson the Solaris 9 OE
A patch contains a collection of files and directories.
以后用VIP账号测试下载
/pub/patches directory.
Use your complete email address as a password.
Solaris9.PatchReport
9_Recommended.README
Only install the recommended patches, security patches, and those required to fix problems specific to your site
for example
# mkdir /var/tmp/patch
# cd /var/tmp/patch
# ftp sunsolve.sun.com
Name (sunsolve:usera): anonymous
ftp> cd /pub/patches
ftp> get Solaris9.PatchReport
ftp> mget 112605*
会提示很多次,To disable interactive prompting
ftp -i sitename or use the
prompt command at the ftp> prompt.
ftp> bye
# /usr/bin/zcat 105050-01.tar.Z | tar xvf -
Installing and Removing Patches
patchadd
patchrm
you install cluster patches by using the install_cluster command
# cd /var/tmp/patch
# patchadd 105050-01
patchadd Command Error Codes Table 7-2 p302
Removing a Patch
# patchrm 105050-01
Installing Patch Clusters
By default, the cluster installation procedure saves the base objects being
patched.
# ls /var/sadm/patch 验证是空的,安装完后去看看里面的readme文件
# cd patch_cluster_directory
# ./install_cluster
4. Read each individual patch README file to determine if any additional steps are required to fully install any individual patch.
5. Check the log file if more detail is needed. /var/sadm/install_data/solaris_9_Recommended_Patch_Cluster_log
6. Reboot the system for all patches to take effect.
for example
# patchadd –p (Displays a list of the patches currently applied.)
Module 8 Executing BootPROMCommands Boot PROM
Commands
include the boot commands, diagnostics commands, and commands to modify the default configuration.
/usr/platform/‘uname -m‘/sbin/prtdiag –v #‘ 反引号
# prtdiag –v
NVRAM
POST
Stop-D key sequence :switches to diagnostic mode. The OpenBoot PROM variable diag-switch? is set to true. The Stop-D key sequence is not available on a serial port terminal.
Stop-N key sequence
set the NVRAM parameters to the default values.
Stop-A key sequence
nterrupt any program that is running at the time these keys are pressed and to put the system into the command entry mode for the OpenBoot PROM.
Stop-A key sequence can cause Solaris OE file system corruption which can be difficult to repair.
Disabling the Abort Sequence
OS运行的时候禁止Abort,the system allows Stop-A key sequence only during the boot process.
#vi /etc/default/kbd
KEYBOARD_ABORT=disable
The ok prompt indicates that the Solaris OE is currently not running.
Table 8-1 Typical Commands Used at the ok Prompt
reset-all Resets the entire system; similar to a power cycle
set-defaults Resets all parameter values to the factory defaults
probe-ide
probe-scsi
probe-scsi-all
sifting text Displays the FORTH commands containing text
#set-defaults
#set-default auto-boot?
#sifting set
Booting the System
ok boot -s
ok boot cdrom –s
ok boot –a Boots the system interactively.
ok boot –r Performs a reconfiguration boot. to find a newly attached device
ok reset-all The reset-all command halts the system, clears all buffers and registers, and performs a software simulated power-off/power-on of the system.
如果.registers 显示都是空,就可以不用reset-all
Identifying the System’s Boot Device
The OpenBoot firmware builds the device tree from information gathered at the POST. The device tree is loaded into memory and is used by the kernel during the boot process to identify all configured devices.
The top of the device tree is the root device node. Following the root device node is a bus nexus node. Connected to a bus nexus node is a leaf node, typically a controller for an attached device.
Figure 8-6解释了设备树 ,间图。
driver-name@unit-address:device arguments.。可参考 Device Mapping on Sun Servers.doc
ok show-devs view the entire device tree.
show-ttys, show-displays, show-nets, show-disks, and show-tapes.
ok devalias To identify the current boot device alias for the system
Creating and Removing Custom Device Aliases
ok> show-disks
ok> nvalias mydisk /pci@1f,0/pci@1/scsi@8/disk@0,0
ok> devalias
ok> setenv boot-device mydisk
boot-device = mydisk
测试成功
ok> nvunalias mydisk
Viewing and Changing NVRAM Parameters From the Shell
/usr/sbin/eeprom
# eeprom
# eeprom boot-device
# eeprom boot-device=disk2
# eeprom auto-boot?=true
/usr/sbin/eeprom | grep boot-device
一般为disk1
example
eeprom boot-device=disk1
Aborting an Unresponsive System
1. Attempt a remote login on the unresponsive system to locate and kill the offending process.
2. Attempt to reboot the unresponsive system gracefully.
3. Hold down the Stop-A key sequence on the keyboard of the unresponsive system. The system is placed at the ok prompt.
4. Manually synchronize the file systems by using the OpenBoot PROM
sync command.
ok> sync
Module 9 Performing Boot and Shutdown Procedures Solaris OE Run Levels
# who -r
shutdown, halt, reboot, and poweroff
The entire boot process is described by four distinct phases:
l The boot PROM phase
l The boot programs phase
l The kernel initialization phase (configuration file /etc/system)
l The init phase
The boot PROM phase
The boot programs phase
The kernel Initialization Phase
The kernel reads its configuration file, called /etc/system.
The kernel initializes itself and begins loading modules.
The kernel starts the /etc/init process.
核心位于 /platform/‘uname -m‘/kernel/sparcv9 (64-bit)
The SunOS™ kernel is a small static core, consisting of genunix and unix and many dynamically loadable kernel modules.
The /etc/system file is divided into five distinct sections:
moddir: Sets the search path for default loadable kernel modules.
root device and root file system configuration:
exclude:
forceload: Forces the kernel modules to be loaded during kernel set:
set:
The init Phase
The init daemon is a general process spawner. Its primary role is to create processes from information stored in the file /etc/inittab.
The inittab file defines three important items for the init process:
l The system’s default run level
l What actions to take when the system enters a new run level
l What processes to start, monitor, or restart if terminated
id:rstate:action:process
Controlling Boot Processes
Each run level has an associated rc script. located in the /sbin directory.
The rc scripts rc0, rc5, and rc6 are hard-linked to each other.
# cd /sbin
# ls -i rc*
Run Control Scripts and Their Functions 374
Start Run Control Scripts
The files that begin with S are run to start a system process.
S##name-of-script (注意有.sh和没.sh的区别)
Stop Run Control Scripts
K##name-of-script
(注意有.sh和没.sh的区别,无sh将添加参数start,stop)
To disable a script, rename it with the appropriate lowercase letter.
轉自:http://ora110.itpub.net/post/33978/441667
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8203880/viewspace-330992/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/8203880/viewspace-330992/