239筆記

shilei1發表於2011-12-19

239筆記

111章節。

Module 1Introducing the SolarisTMOE Directory Hierarchy

Module 2Managing Local Disk Devices

slide看磁碟結構.

Slice NameFunction

0/The root directory’s system files

1swapSwap area

2Entire disk

5/optOptional software

6/usrSystem executables and programs

7/export/homeUser 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 asc0,c1,c2,and so on.

Target number :Target numbers, such ast0,t1,t2,andt3,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.

SCSIIDE兩種架構

Introducing Solaris OE Device Naming Conventions

Logical device names/dev/dskand/dev/rdsk

Physical device names/devices

Instance namesfor example :sdndadn

#ls /dev/dsk

#ls -l /dev/dsk/c0t0d0s0

Instance names are abbreviated names assigned by thekernelfor each device on the system.

Listing a System’s Devices

Using the/etc/path_to_instfile

Using theprtconfcommand

Using theformatcommand

different bus architecture.

more /etc/path_to_inst

peripheral component interconnect (PCI)外圍元件介面

Sun System bus (SBus).

#prtconf | grep -v notTo 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 theprtconforformatcommand.

boot -r.

(If the/reconfigurefile was not created before the system was shut down,)

Using thedevfsadmCommand

Thedevfsadmcommand performs the device reconfiguration process and updates the/etc/path_to_instfile and the/devand/devicesdirectories during reconfiguration events.7*24小時)

devfsadmor devfsadm -c device_class disk,tape,port,audio, andpseudo.

#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).)

Theformatutility 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.datFile

partition>name

format>save

partition>select

partition>label

format>verify

format>modify測試OKAll 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 3Managing 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 aufsfile systemnewfsmkfs好用多了

/usr/sbin/newfs

#newfs /dev/rdsk/c1t3d0s0

Thenewfscommand reserves between 1 and 10 percent of the file system space for maintenance of the file system.

To show the value ofminfreeon a file system,

#fstyp -v /dev/rdsk/c0t0d0s0 | head -10

#tunefs -m 1 /dev/rdsk/c1t3d0s0

fsckCommand

Never run thefsckcommand 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:

322069root

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:363330

Cylinders per group:1011

Inodes per group:60163328

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

fusercommand .Lists all of the processes that are accessing the file system and kills them if necessary測試

umount -fcommand

Repairing Important Files if Boot Fails

okboot 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

lSolarissuninstallprogram

lSolaris™ Web Start Installation software

lCustom JumpStart™ procedure

The JumpStart procedure is a command-line interface that enables you to incorporate

shell scripts.

lSolaris Web Start Flash installation

lStandard upgrade

lSolaris™ Live Upgrade method

lSoftware packages

lSoftware clusters

lSoftware 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_logfile.

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

Thepkgaddcommand, by default,

looks in the/var/spool/pkgdirectory 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/patchesdirectory.

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 sitenameor use the

promptcommand at theftp>prompt.

ftp>bye

#/usr/bin/zcat 105050-01.tar.Z | tar xvf -

Installing and Removing Patches

patchadd

patchrm

you install cluster patches by using theinstall_clustercommand

#cd /var/tmp/patch

#patchadd 105050-01

patchaddCommand Error CodesTable 7-2p302

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 patchREADMEfile 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-Dkey sequenceswitches to diagnostic mode. The OpenBoot PROM variablediag-switch?is set totrue. The Stop-D key sequence is not available on a serial port terminal.

Stop-Nkey sequence

set the NVRAM parameters to the default values.

Stop-Akey 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執行的時候禁止Abortthe system allows Stop-A key sequence only during the boot process.

#vi/etc/default/kbd

KEYBOARD_ABORT=disable

Theokprompt indicates that the Solaris OE is currently not running.

Table 8-1Typical Commands Used at theokPrompt

reset-allResets the entire system; similar to a power cycle

set-defaultsResets all parameter values to the factory defaults

probe-ide

probe-scsi

probe-scsi-all

siftingtextDisplays the FORTH commands containingtext

#set-defaults

#set-default auto-boot?

#sifting set

Booting the System

okboot -s

okboot cdrom –s

okboot –aBoots the system interactively.

okboot –rPerforms a reconfiguration boot. to find a newly attached device

okreset-allThereset-allcommand 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 thekernelduring 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

okshow-devsview the entire device tree.

show-ttys,show-displays,show-nets,show-disks, andshow-tapes.

okdevaliasTo 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 theokprompt.

4. Manually synchronize the file systems by using the OpenBoot PROM

synccommand.

ok>sync

Module 9Performing Boot and Shutdown Procedures Solaris OE Run Levels

# who -r

shutdown,halt,reboot, andpoweroff

The entire boot process is described by four distinct phases:

lThe boot PROM phase

lThe boot programs phase

lThekernelinitialization phase(configuration file/etc/system)

lTheinitphase

The boot PROM phase

The boot programs phase

ThekernelInitialization Phase

Thekernelreads its configuration file, called/etc/system.

Thekernelinitializes itself and begins loading modules.

Thekernelstarts the/etc/initprocess.

核心位於/platform/‘uname -m‘/kernel/sparcv9(64-bit)

The SunOS™kernelis a small static core, consisting ofgenunixandunixand many dynamically loadablekernelmodules.

The/etc/systemfileis divided into five distinct sections:

moddir: Sets the search path for default loadablekernelmodules.

root device and root file system configuration:

exclude:

forceload:Forces thekernelmodules to be loaded duringkernel set:

set:

TheinitPhase

Theinitdaemon is a general process spawner. Its primary role is to create processes from information stored in the file/etc/inittab.

Theinittabfile defines three important items for theinitprocess:

lThe system’s default run level

lWhat actions to take when the system enters a new run level

lWhat processes to start, monitor, or restart if terminated

id:rstate:action:process

Controlling Boot Processes

Each run level has an associatedrcscript. located in the/sbindirectory.

Thercscriptsrc0,rc5, andrc6are hard-linked to each other.

#cd /sbin

#ls -i rc*

Run Control Scripts and Their Functions374

Start Run Control Scripts

The files that begin withSare 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/196700/viewspace-713561/,如需轉載,請註明出處,否則將追究法律責任。