Commands

678 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
678
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
41
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Commands

  1. 1. Solaris Commands For SA-I & SA-II1SUN SOLARISSA-IS.No Commands Functions1 ls | ls –l To list the files at current location2 mkdir <name> To create a directory3 cd <name> | cd .. For logging in to a directory4 df | df –k To view disk free5 du To view disk usage6 cat > <file> Catenation – to create a file7 pwd To view current location8 rm <file>| rmdir | rm-r To remove file and directory9 cp <file> <new name> To copy a file10 mv <file> <path> To move a file and to rename11 touch <file> To create a file12 chmod < 777 > <file>chmod u+w,g-r,o+w <file>To set permission | rwxrwxrwx =777 | ownergroup & other | i.e. : r=4 w=2 x=1 by total 713 clear To clear the screen14 man <command> To view manual15 bc Binary count16 cal To view calculator17 banner <content> To view banner18 date To view date19 find / -name <file> To find a specific file20 grep <word> <file> To grep a word from a file21 getent <admin file> <value> To search using specific entry in admin file22 wc <file> To view word count23 sort <file> To sort the content of a file24 head -<100> <file> To list only the first <100> lines25 tail -<100> <file> To list only the last <100> lines26 ln <exist file> <new file> hard link – both file points the i-nodenumber, link count increases27 ln –s _ for soft link If source is lost entire content is lost, L willbe at the front of filename28 useradd –m –d <home dir><user name>| -u –g –GTo create a user account | u-user id, g-pri.group, G-sec. group, m-mk dir, d-path29 passwd <user name> To set password for an user30 usermod |userdel <user> To modify and to delete a user account31 groupadd –g <gid> <group> To create a new group |-o to reallocated gid32 /usr/sadm/bin/smuseradd -- -n <user name> -u <uid>-g <gid> -d <home dir> -s/bin/kshTo create a SM-User33 /usr/sadm/bin/smusermodify -- -n <old user> -N<new user> -d <home dir> -s/bin/kshTo modify a present user34 /usr/sadm/bin/smuserdelete -- -n <user name>To delete a present user35 smgroup | same as above 3 To create, modify and to delete a smgroup36 smc& To invoke the SMC tool in GUI mode37 umask <value 022> This value will make effect on permissioni.e “/etc/profile” | attains default – restarted38 vi <file> To open a file through VI-Editor
  2. 2. Solaris Commands For SA-I & SA-II239 Prtconf To view system config–memory, peripheral40 prstat –a To view the system process status41 Psrinfo –v To view information about the processor42 iostat -En |-xtc 5 To view the i/o device status43 Sdtprocess To view the current system process status44 sar <sec_1> <report_10> To view the system activity in average45 kill <process id> To kill a process which is listed in prstat46 Format To make slices in an hard disk47 devfsadm –v To identify the hardware changes48 devfsadm –C To invoke cleanup | then only –v fn works49 newfs /dev/rdsk/c#t#d#s# To make a new file system on the disk50 mount /dev/dsk/c#t#d#s#/<mount point>To mount the new disk for use51 Dmesg To view the diagnostic messages52 Eeprom To view the environment messages53 uname –m | -a To view the m/c name, version, archi. etc.,54 /usr/platform/”uname-m”/sbin/prtdiag –vTo view the entire system status includesmemory, cpu, patches, os-version, etc.,55 pkgadd –d <path> <pkgname> | -s spoolTo install a package | if –s spool is used inbtw_only copies the pkg to spool directory56 pkgchk <pkg name> To check for error in a particular package57 pkginfo <pkg name> To get info about package in local machine58 pkgrm <pkg name> To remove a package from local machine59 pkginfo |wc –l To check for number of packages installed60 fstyp –v /dev/rdsk/ctd#s# To check for the current “minfree” value61 tunefs –m #/dev/rdsk/ctdsTo set minfree value i.e #% with that of root62 fsck –o f,p /dev/rdsk/ctds# To run file system check | -o f, p for yes to all63 fsck –o b=# /dev/rdsk/ctds To restore backup sup. Block|#-sup. Block64 quot |-af root To view summarized FS ownership65 mountall To mount all FS which have entry at vfstab66 mountall –l To mount only the local FS listed in ‘vfstab’67 umount <mt pt> |/dev/dsk To unmount the mounted file system 1 by 168 umount -f ---do--- To unmount forcible | may affect data69 Umountall To unmount all mounted FS includes N/W70 umountall –l To unmount all locally mounted FS71 fuser <mount pt> | -c or –cu To view any process is accessing the FS72 fuser –ck <mt pt> To kill all process which access the FS73 Volcheck To check whether the floppy is ready or not74 /etc/init.d/volmgt start To start the volume mgt | to stop, give stop75 mount –F hsfs –o r0/dev/dsk/ct#d#s# /cdromTo mount a cdrom manually76 mount –F pcfs/dev/diskette/pcfsTo mount a floppy drive manually77 tar –xvf <file.tar> To uncompress a tar file78 patchadd <patch> | -d To install a patch |–d is for no rollback79 patchrm <patch> To uninstall and rollbacks the patch80 init 0 To OK prompt81 init 1 To single user mode82 init 2 To multi user without network83 init 3 To console – super user | multiuser with nfs84 init 5 To shutdown the server85 init 6 To restart the server86 init s To single user mode
  3. 3. Solaris Commands For SA-I & SA-II387 shutdown –y –g <#> -i <runlevel number> <Message>To shutdown the system |-y for interactivemode| # - grace time in seconds88 Halt To switch over to OK prompt suddenly89 poweroff | Reboot Alternate command to switch-off & restart90 who –r To view the current run level91 who | -a To view all logged-in users in the local sys92 who –m To view the current user name alone93 whoami | who I am To view effective user | To view actual user94 rusers –l To identify all users logged in through n/w95 finger |-m <username> To view the activity of the users96 last | <username> To view full details for all users | record97 last -n 5 reboot To view only the last five reboot activity98 chown root : sys/var/adm/loginlogTo activate loginlog entry i.e. to note thefailure login |you must create the directory99 su <username> | su -<usern> To switch into another user | home dir – acti100 chown <user> filename To change the ownership of a file|-R for dir101 chmod 1777 <dir name> Sticky bit permission | user can access dir102 chmod 4555 <exe file name> Users exe this file will get root privilege103 chmod 2555 <exe file name> Group exe this file will get root privilege104 lpadmin –d <prt name> To config a printer manually | -x to remove105 lpstat –d To view the systems default printer106 lp <file name> To give an print request107 reject <prt name> To stop the queuing printer request108 disable <prt name> To stop the printer109 enable <prt name> To activate the printer110 accept <prt name> To start the queuing printer request111 /usr/lib/lpsched | lpshut(or) /etc/init.d/lp start | stopTo start the LP printer service | To stopthe LP printer service112 lp –d <prtname> <filename> To divert your printing job to a new printer113 lpstat –a <prt name> To view the status of the printer114 lpmove <fault prt> <nw prt> To divert one prt job to another printer115 at <hh:mm> |at> job |ctrl d To assign job at AT schedule| ctrl d to close116 crontab –e |-r to remove job To assign a job in crontab – it opens a editor117 at -l & crontab –l To view the AT and crontab content118 ufsdump 0uf /dev/rmt/0n/dev/dsk/c#t#d#s#To perform backup | 0-full backup, uupdate{/etc/dump dates}, 0-drive or disknumber i.e for incremental, n-no rewind119 ufsrestore rvf /dev/rmt/0 To restore the backup120 ufsrestore i /dev/rmt/0 To view the list of files present in the tape121 mt status |rewind |offline To view the status| To rewind | To eject122 mt fsf count To move the tape forward count records123 fssnap –F ufs –obs=/var/tmp /export/homeTo perform a snapshot backup whichusually stores at /dev/fssnap/0124 fssnap –i To display a list of snapshot ct avail in sys.125 prtvtoc /dev/rdsk/ct0ds2 >/<file>To store the structure of the given hard diskto an file through prtvtoc126 fmthard –s /<file>/dev/rdsk/ct1ds2To copy the structure from /<file> and tomake available on the destiny hard disk
  4. 4. Solaris Commands For SA-I & SA-II4Vi Editor CommandsS.No Commands Functions1 vi <file name> To open vi editor for a specific file2 Esc h To move the cursor left - command mode3 Esc l To move the cursor right - command mode4 Esc j To move the cursor down - command mode5 Esc k To move the cursor up - command mode6 Esc i To Enter into Insertion mode7 Esc x | 4x To delete a character | deletes 4 character8 Esc X | 4X To delete left i.e. Back-Space9 Esc R To over-write a character10 Esc o To insert a line below the cursor11 Esc O To insert a line above the cursor12 Esc u Undo13 Esc G To move to the last line first character14 Esc w To move word by word right15 Esc b To move word by word left16 Esc H To move to the first line of the current page17 Esc M To move to the middle of the current page18 Esc L To move to the last line of current page19 Esc I To move to the beginning of the line &append20 Esc A To move to the end of the line & append21 Esc dw To delete a word to the right22 Esc dd To delete the current line completely23 Esc yy To copy the current line – yanking24 Esc p To paste the copied content25 Esc yw To copy a word – cursor must be at thestarting26 Esc J To join two separate line27 Esc ~ To change the case i.e. upper to lower & V-via28 Esc : wq To save & quit a file – EX-command mode29 Esc : wq! To save & quit a file forcibly30 Esc : !sh To go to shell temp. & type Exit to comeback31 Esc : r! <command> To add the output into the file32 Esc : r <file name> To add the content of <file> into the currentfile33 Esc : q To quit the file without saving34 Esc : q! To quit the file without saving – forcibly35 Esc : w To save the file and continue working36 Esc ZZ To save & quit the file37 Esc : set nu To assign the number for the lines38 Esc : set nonu To remove the assigned number for the lines39 ctrl f Page down40 ctrl b Page Up
  5. 5. Solaris Commands For SA-I & SA-II5OK Prompt CommandsS.No Commands Functions1 stop a To get into OK prompt2 stop d For extensive post diagnostics3 stop n To set default parameter |press until kbd ledflashes4 boot cdrom To boot from cdrom5 boot cdrom –s To boot and get into single user mode usingcdrom6 boot –r To reconfigure |config result will be at/reconfigure7 Boot To boot through the default configuration8 boot disk To boot via specified disk|devalias - entrymust exist9 boot –s To get into the single user mode10 boot –a For interactive booting11 boot –v Detailed device information to the console12 Help To get command details at OK prompt13 Printenv To print the environment detail14 setenv <prm> <val> To set environment for a specific parameter15 reset-all To save the changes and followed by reboot16 set-defaults To set the values to the manufacturerssetting17 set-defaults <param> To set the value for a specific parameteralone18 probe-scsi | -ide To check for internal scsi/ide status19 probe-scsi-all |-ide-all To check for internal & external scsi/idestatus20 probe-fcall-all To check for fiber optics status21 Devalias To view the alias name & to which itsmapped22 nvalias <alias> <add> To add the alias and its physical address tothe list23 nvunalias <alias> To remove an alias from the current list24 show-disks To see the physical add of all drives i.e. secstorage25 .version To view the version, Ethernet addressdetails etc.,26 .speed To view cpu speed, bus speed, etc.,27 .enet-addr To view only the Ethernet address28 Showdevs To view all the devices i.e. secondarystorage only29 Banner To view the ip, mac add, subnet mask etc30 watch-net To view the status of NIC card31 watch-net-all To view the status of NIC and network cable
  6. 6. Solaris Commands For SA-I & SA-II6AbbreviationS.No Abbreviation Expansion – Purpose1 Hme Network Interface Card2 Qfe Quad Fast Ethernet3 c0t0d0s0 Controller Target Disk Slice4 Sparc Scalable Process Architecture5 UFS Unix File System – for disk mgt6 HSFS | under ufs High Sierra FS – for SCSI cdrom’s7 PCFS | under ufs PC-DOS Formatted FS – for floopys8 NFS | under Distributed FS Network File System – for network9 TmpFS | under Pseudo FS Temp. FS – for avoid Overhead writing10 SwapFS | under Pseudo FS Swap FS – for Kernel use11 FDFS | under Pseudo FS File Descriptor FS – for explicit names12 Explicit Name It’s the representative of Directory’s13 ProcFS | under Pseudo FS Process FS –for currently running proc.14 MntFS | under Pseudo FS Mount FS – for locally mounted FSImportant LocationsS.No Important Locations Purpose / Usage1 /etc/profile umask value | profile during login2 /etc/path_to_inst Physical address mapping - for kernel3 /usr/bin/dmesg/usr/sbin/dmesgDiagnostic message will be here dmesg _shows the content of this files4 /etc/default/kbdkbd –I _ To initialization abovefilePut # before keyboard_abort=disable |this isforpreventing stop A in console5 /var/sadm/install/contents Contains details about installed packages6 /var/spool/pkg Default location for adding a package7 /var/sadm/pkg It has the currently installed package8 /etc/vfstab _ Manual Entry Entries for mounting FS during booting9 /etc/mnttab _ Auto Entry Entries for currently mounted FS10 /var/sadm/patch It has the currently installed patches11 /usr/bin Mostly all commands will be here12 /var/adm/utmpx Who command reads this location Alone13 /var/adm/wtmpx last -n command reads this location |in case root is full then clear this file.14 /var/adm/loginlog _ create it To view the failed login attempts15 /etc/default/su To view the switching attempts | For thisremove # in console= /dev/console and put #in more /var/adm/sulog16 /etc/default/login_ edit this filefor root logging restrictions |If PASSREQ=no then nullpassword for rootIf #console=/dev/console _ remoteroot login is allowed, if no # _ onlythrough single machine, ifconsole=<blankspace> then root cantbe logged anywhere17 /etc/ftpd/ftpusers Users listed here are not allowed for ftp18 /var/spool/lp It holds the request and the print Queue19 /var/lp/logs It holds the history of the printer jobs20 /etc/lp It has the LP server configuration21 /etc/hosts _ manual entry contains IP and hostnames of sys. In n/w22 /etc/cron.d/at.deny|cron.allow To restrict users from using AT & Cron
  7. 7. Solaris Commands For SA-I & SA-II7Hints & PurposesS.No Commands Functions1 Host Bus Adopter All harddisk will have a common HBA2 Max 7 Slices Only 7 slices are possible in a hard disk3 Slice S2 – Back Up Points entire disk – cant be changed or used4 SUNWCxall Entire Distribution with OEM support 64 bit5 SUNWCall Entire Distri 64 bit – no 3rd party support6 SUNWCprog Developer Sys Supp –only manuals & network7 SUNWCuser End User Sys Supp – limited network support8 SUNWCreg Core Sys Support – no network9 Web Installation 1st Installation CD then 1 of 2 CD & 2 of 2 CD10 JumpStart Installation Installing the OS through network11 Vi Editor – 3 Modes Command, Insert and Ex-Command Mode12 OE file system Disk based(ufs), Distributed(nfs) &Pseudo(swap)13 File Types – 4 types Regular, directories, symbolic link & device files14 Device naming Logical, physical(actual) & instance(kernal)name15 Sd n | dad n For scsi | ide n-number – instance name16 NV Ram – EEPROM Removable chip, inbuilt Lithium battery, host id17 # before any line in a file This makes that particular line or processinactive18 what happens during theBooting of SunSystemPost, generic devi ce drivers, loads config doneby admin, other default parameter, then OS files19 Backup Superblock It resides at several areas of disk| for restoration20 Cylinder group – size Default size is 16 cylinders per group21 Boot block – active for ‘/’ Boot strap program resides here – 15 disk sector22 Pointer types Direct Pointer and Indirect Pointer23 “Minfree” Value It’s the space utilized by the operating sys in root24 Preen During sys boot fsck runs at Non Intractive mode25 Vol Mgr -/etc/vold.conf Automatically mounts the cdrom and floopy26 105050-01 patch name 105050 is base code & 01 is the revision number27 sys wide & user environ While user logs this files get executed by shell28 Restoresymtable This is a image file of tape formed in hard disk29 /etc/hosts It is an link to /etc/inet/hosts30 /opt Common location for utilities and 3rd party tools31 RSC Remote System Console |consist of serial, n/wmgt port and modem32 LOM Light Out Management | consists of only serialport and not a part of OS.33 ALOM Advanced LOM | Consists of serial port and apart of OS and also an n/w mgt port.34 SCC System Controller Card | nvram data are storedhere its an removable card – resp’ble for booting35 KVM switch Keyboard Video Mouse switch |common unit36 Part Number Identity Number 300-4250 |product-exact no/.
  8. 8. Solaris Commands For SA-I & SA-II8Shell Sys-wideInitializationfilesPrimary userinitialization filesread at loginUser Initializationfiles read when anew shell is startedShell pathnameBourne /etc/profile $home/.profile /bin/shKorn /etc/profile $home/.profile$home/.kshrc$home/.kshrc /bin/kshC /etc/.login $home/.profile$home/.cshrc$home/.cshrc /bin/cshDefault User Initialization FileShell Initialization file templates User initialization filesBourne /etc/skel/local.profile $home/.profileKorn /etc/skel/local.profile $home/.profileC /etc/skel/local.cshrc/etc/skel/local.login$home/.cshrc$home/.loginSteps Involved In Restoring Root From Tapeok boot cdrom –s$ newfs /dev/rdsk/ c0t0d0s0$ mount /dev/dsk/ c0t0d0s0 /a$ cd /a$ ufsrestore rf /dev/rmt/0$ cd /usr/platform/”uname-m”/lib/fs/ufs$ installboot bootblk /dev/rdsk/c0t0d0s0$ umount /a$ fsck /dev/rdsk/c0t0d0s0usr/bin -> for all users usr/sbin -> only for root
  9. 9. Solaris Commands For SA-I & SA-II9SUN SOLARISSA-IIS.No Abbreviation Expansion – Purpose1 sys-unconfig _ sys restarts To get into the network config. Section2 ifconfig –a To view ip, mac add, subnet mask,etc status3 ifconfig hme0 <ip#> netmask<netmask#> upTo assign IP address, netmask and as wellasto make the network up4 ifconfig hme0 up | down To enable network interface | disable5 snoop <source ip> <dest. ip> To capture and inspect the network pkgs6 rpcinfo –p | <hostname> To list the registered RPC services7 rpcinfo –d <prog no> version| pkill-HUP inetdTo delete a RPC service registration| To reactivate your service again8 etc/init.d/init.wbem status| start | stopTo view the status of the SMC service |Tostart service | To stop service9 Smc To open SMC10 smc edit To open SMC toolbox editor11 pagesize | default is 8192 b To view the size of memory page12 /var/sadm/smc/toolboxes/smc/smc.tbx &/var/sadm/smc/toolboxes/this_computer/this_computer.tbxDefault location for SMC toolbarsmc edit command will make effect on thistwo filesIntroduction To IP - Version IV/etc/rcS.d/S30network.sh _solaris 8|/etc/rcS.d/S30rootusr.sh _sol 7 & belowDuring booting of sys these files get exe. This uses ifconfig utility & searchesetc/hostname.xxn to identify instance |xx _ hme/nic/etc/inet/hosts _ this can be used instead of DNS, NIS, NIS+. It contains ip,hostname, nickname, comments.Starting server processes : To start and stop any event at startingDuring the booting of system, the inetd daemon starts few services [ like NIS, TCP-IP,DNS, etc. ] which are not automatically start at boot time. We can view the list of servicesthat were started by inetd are at /etc/rc2.d/S72inetsvc. Apart from this file the inetdconsults the /etc/inetd.conf to find the service to activate.In order to stop any event init just put # before the service in the /etc/rc2.d/S72inetsvcand then execute pkill-HUP inetd command for instant effect.Six important files responsible for the networkFiles Pattern of Entry (or) content in the file/etc/nodename Hostname of the server eg: bomexport/etc/hostname.xxn Hostname of the service or server/etc/inet/hosts All IP address and hostname of other servers/etc/net/ticlts/hosts Hostname of the server twice – transport layer independent/etc/net/ticots/hosts Hostname of the server twice – transport layer independent/etc/net/ticotsord/hosts Hostname of the server twice – transport layer independentEither edit these files or else give sys-unconfig in order to configure the network
  10. 10. Solaris Commands For SA-I & SA-II10SWAP Expansion#swap –s _ to display the virtual swap area#swap –l _ to display the physical swap areaAdding swap space by slice:_ create a slice of required size in hard-disk_ add the entry for that slice in /etc/vfstab for an permanent effect_ swap –a /dev/dsk/c#t#d#S# | to activate the swap spaceAdding swap space by file:_ #mkfile <size#> <mount point>_ #swap –a /<path of above file> | to activate the swap file_ #also add an entry in the /etc/vfstab for an permanent effecte.g: export/swapfile -- -- swap -- no --Removing a swap space:_ #swap –d <path of swap area> _ this is to de-activate the swap area_ remove the entry from the /etc/vfstab_ delete the slice or file to free the utilized spaceCrash Dump#dumpadm _ its to activate the crash dump device for the fore-coming faultProcedure to read the crash message:_ cd /var/crash/”uname-n”/ -> log-into this location_ mdb unix.# vmcore.# | mdb or adbwhen you execute above command the prompt will change as below> |when prompt is as shown> ::status> $c> $q |to quit the promptwhen there is no prompt type $p>then you will get the prompt as >NFS - Network File System_ Allows the multiple computers to use the same file, to reduce storage cost,provide data consistency & reliability._ NFS daemon starts only when the system enters the run level 3S.No Command Operation1 /etc/init.d/nfs.server start | stop To start & stop the NFS service manually2 share –F nfs –o <ro/rw><path>To share a file for NFS service3 mount –F nfs <hostname>:<path> <mount point>To mount the shared file4 unshare –F nfs <path> To unshared a file from NFS service5 shareall -F nfs To share all resources listed in/etc/dfs/dfstab6 unshareall –F nfs To un-share all resources listed as above7 dfshares –F nfs <host> To display the currently shared NFS8 dfmounts -F nfs <host> To display the NFS mounted resources9 mountall -r -F nfs To mount all remote file resources10 umountall -r -F nfs To un-mount all remote file resourcesS.No Command Operation1 /etc/dfs/dfstab Local resources that as to share at boot time2 /etc/dfs/sharetab Currently shared local resources – auto entry3 /etc/dfs/fstypes Default file-system for remote file system4 /etc/rmtab FS that remotely mounted by NFS – auto entry5 /etc/dfs/nfslog.conf NFS logging configuration file6 /etc/default/nfslogd Configuration files for the nfslogd daemon
  11. 11. Solaris Commands For SA-I & SA-II11Syslog functions - configuring system messagingThe syslogd daemon and the input from /etc/syslog.conf files work together to facilitatethe syslog messaging for the OEIt can write message to the system log , centralized log host , messaging a user or atthe system console.For this put the entry in /etc/syslog.conf file. The entries are the type of error [ i.e.user.err ] and the action field [ i.e. /filename _ the target file, @host _ for specific host,user _ for specific user, * _ for all logged in users ]Daemons involved: /etc/rc2.d/S74 syslog# /etc/init.d/syslog start | stop _ this is to start and stop the daemon.Auto FS_ It provides an automatic mounting using NFS protocol_ Its an client side serviceComponents of auto-mount facility:Auto FS file system, Auto-mountd daemon, Auto-mount command , Auto FS file systemmount-point is defined in the auto-mount maps on the client system.Configuring Master Map:For all types of auto sharing methods the entry must be here. Hence this remains thebase entry for all sharing methods. Edit /etc/auto_master----------------------entries-------------------+auto_master # +_ indicates that consider automountd daemon/home auto_home -browse, (or) -nobrowse<mount point> <map name> <mount options>#- browse _ allow the users to view the mount-point--------------------------------------------------#automount _ reactivate the above file againThen shared resources get mounted below the /home/<auto_home – file mount point>Direct map entries:This map is only for general directory’s, and common sharing files (eg: softwares). Incase 1 server is down then it can be get from other. Edit /etc/auto_direct----------------------entries-------------------/usr/share/man -ro, soft ser1, ser2, ser3:/usr/share/man<local mnt pt> <permission> <hostname>:<path>#/- auto_direct -ro _ this entry in auto_master--------------------------------------------------#automount _ reactivate the above file againIndirect Map Entries:This mapping is for user home directories and for their files.Edit /etc/auto_home----------------------entries-------------------magi server_primary:/export/home/babu<local mnt pt> <hostname>:<home dir path>#/home auto_home -nobrowse _ this entry in auto_master--------------------------------------------------procedure:_ Create the account for the user in both the servers with same UID & GID_ Put the entry for auto_home as shown above for a desired user e.g. babu_ # passwd –h babu | in secondary server (/export/home/babu)? /home/magi | changethe home dir as desired_ # cd /home/magi |in sec server to enter into the pri servers home dir. After all this filesare edited just type #automount -t <time#> -v this is to activate the desired mountpoint.If time is mentioned in –t then upto that time the FS remains mounted when its not inuse.
  12. 12. Solaris Commands For SA-I & SA-II12After all this files are edited just type #automount -t <time#> -v this is to activate thedesired mountpoint. If time is mentioned in –t then upto that time the FS remainsmounted when its not in use.RBAC - Role Based Access ControlThis is to assign a specific role for a specific user. For these process four files comesinto picture. They are/etc/user_attr /etc/security/prof_attr/etc/security/exec_attr /etc/security/auth_attrExample: assign a role of shut down , for a specific user_ #roleadd –u 500 –g 10 –m –d /export/home/role_shut role_shut _create a role named roleshut_ vi /etc/security/prof_attrprofile_shut ::: able to shutdown the system_comment: |creating profile_ # rolemod -P profile_shut , all role_shut |adding profile to the role_ verify that the role is included in the etc/user_attr_ #useradd -u 200 -g 10 –m –d /export/home/user_shut –R role_shutuser_shut | this is to create a user and assigning the desired role_ #passwd user_shut_ #grep user_shut /etc/user_attr | to check the role attribute for the user_ #vi /etc/security/exec_attrprofile_shut : suser : cmd : : : /usr/sbin/shutdown : uid=0 |bold area is the location of theshutdown command this must be searched manually and entered here. | This is to assignthe shutdown command to the profile.This is how to assign a role for a specific user .How the user shutdown the system using this role:_ first login as the user_ $profiles | this is to list the various RBAC profiles that he associated_ $role | this is to list the various roles that he associated_ $su role_shut_ $/usr/sbin/shutdown –i 5 –g 0 |now the system will go downName ServerName service switching files LocationLocal files /etc/nsswitch.filesDNS /etc/nsswitch.dnsNIS /etc/nsswitch.nisNIS+ /etc/nsswitch.nisplusLDAP /etc/nsswitch.ldapDNS & LDAPDNS and LDAP configuration were similar to NIS only service activationcommand and configuration files vary.#ldapclient _ for ldap client activation |#ldapclient uninit_ un-configure ldap.
  13. 13. Solaris Commands For SA-I & SA-II13NISThe NIS maps are located at /var/yp/domainname/<host>.byname.pag |& .dirSimilarly /var/yp/domainname/<host>.byaddr.pag |& .dirDaemons used: ypserv, ypbind, rpc.yppasswdd, ypxfrd, rpc.updatedAll five are utilized by server and only first two by clients. Through NIS service a centralized user-account can be provided.Configuring a machine as the NIS master server :_ #cp /etc/nsswitch.nis / etc/nsswitch.conf_ #domainname accel.com_ #touch /etc/defaultdomain_ #domainname > /etc/defaultdomain_ #cd /etc_ #touch ethers bootparams locale timezone netgroup netmasks_ #ypinit -m _ To initialize the master server_ #/usr/lib/netsvc/yp/ypstart _ To start the NIS daemonsConfiguring a machine as the NIS client :The steps were same as above but instead of ypinit –m give ypinit –c to start client service and alsoput the server IP entry in the /etc/hosts.ACL - Access Control ListIt provides greater data access control for each file. Permission for a specific user is alsopossible using ACL.Syntax: setfacl {entry type : UID or GID : permission }owner [u] user name R,W,Xgroup [g] group nameother [o] uid/gidCommand Usagegetfacl < file name > To see the present FACL entrysetfacl –s <new entry> <existing file>setfacl –s u::rwx,g::rw-,o::r--,m:7 file1To set a permission for existing file |m_ to set mask valuegetfacl file1 | setfacl –f – file2 Copies file permission from f1-f2setfacl –d u:root:7 file1 To delete an entry from a filesetfacl –m u:root:7 file1 Adding one by one entry in a filesetfacl -r -m u:user:7 file1 rewrites mask in accordance to userRoot Mirroring_ create a slice of 50mb for state database ||let it be slice 7 i.e. s7_ #prtvtoc /dev/rdsk/c0t0d0s2 | fmthard –s - /dev/rdsk/c#t#d0s2_ #metadb -afc3 c0t0d0s7 c0t#d0s7 c#t#d0s7 || To create 3 replicas in each state db | 3 hard-diskbecause (n/2)+1 replicas_ #metadb -i ||To check for status_ #metainit -f d10 1 1 c0t0d0s0 ||To create primary sub-mirror_ #metastat_ #metainit -f d20 1 1 c0t#d0s0 ||To create secondary sub-mirror_ #metainit d50 -m d10 || mapping to main mirror_ #metaroot d50 ||To put an auto entry in vfs tab_ reboot the system now # init 6_ #metattach d50 d20 ||resynchronization starts nowReplacing the defective disk in case of failure :# metareplace <defective disk c#t#d#s#> <newly attached disk c#t#d#s#>Breaking the Mirror :_ #metadetach d50 d20 ||breaking secondary sub-mirror_ #metaroot /dev/dsk/c0t0d0s0 ||role-back the vfs entry_ #init 6_ #metaclear -r d50 ||removing main mirror_ #metaclear d20 ||removing secondary mirror_ #metadb -d -f c0t0d0s7 c0t#d0s7 c#t#d0s7 ||removing the replicas
  14. 14. Solaris Commands For SA-I & SA-II14Hot Spare with Mirror Meta DeviceIt’s not applicable for mounted file system i.e. for root. Consider c1 and c2are the two disks for this c3 be the hot spare let it be the scenario. In this if c1 & c2are in mirror if any one goes down then c3 will come into picture._ create a slice of 50mb for state database ||let it be slice 7 i.e. s7_ #metadb -afc3 c1t0d0s7 c2t0d0s7 c3t0d0s7 || To create 3 replicas_ #metahs -hsp001 c3t0d0s1 ||To create the hot spare_ #metainit d13 1 1 c1t0d0s1 ||To create primary sub-mirror_ #metainit d23 1 1 c2t0d0s1 ||To create secondary sub-mirror_ #metaparam -h hsp001 d13 ||Assigning hot spare to sub-mirror_ #metaparam -h hsp001 d23 ||Assigning hot spare to sub-mirror_ #metainit d150 -m d13 ||Mapping to main mirror_ #metattach d150 d23 ||To synchronize the sub mirrors_ #newfs /dev/md/rdsk/d150 ||Making new file system_ #mkdir /mirror ||Create a directory for mounting_ #mount /dev/md/rdsk/d150 /mirror ||mount the partitionLet us consider c2 goes down in above scenario so hot spare (c3) will be there in the role or c2then replace the disk c2 by new one and follow the procedure_ #metareplace -e d150 c2t0d0s1 ||To switch back hard-disk from c3 to c2_ #metahs -e c3t0d0s4 || To re-enable the hot-spare c3 once againRAID – 5 With Hot SpareLet c1, c2 & c3 be the 3 disk in which s1 of all disk are under raid-5. The s3 of disk c2 & c3 be thehot-spare which acts during the failure of s1. Let it be the scenario._ create a slice of 50mb for state database ||let it be slice 7 i.e. s7_ #metadb -afc2 c1t0d0s7 c2t0d0s7 c3t0d0s7 || To create 2 replicas_ #metahs -a -hsp009 c2t0d0s3 c3t0d0s3 ||To create the hot spare_ #metainit d101 -r c1t0d0s1 c2t0d0s1 c3t0d0s1_ #metaparam -h hsp009 d101_ #newfs /dev/md/dsk/d101 ||Making new file system_ #mkdir /raid5dir ||Create a directory for mounting_ #mount /dev/md/rdsk/d101 /raid5dir ||mount the partitionIn case if any disk fails & hot-spare comes into picture then replace the disk, then_ #metareplace -e d <the disk that has replaced c#t#d#s#>_ #metahs -e <hot spare disk that has to be reactivated c#t#d#s#>Disk Set -- adding Soft SlicesMaximum of 128 soft slices can be created in a disk set. To change the defaultnumber of soft slice edit “md.conf” & then change the value to “nmd=128”Steps Involved in creating a soft slice :_ metaset -s <share name> -a c#t1d# c#t3d#| adding share name for storage_ metaset -s <share name> -a -h <node name>|assigning system to storage_ metaset -s <share name> <replica_d500> 1 1 /dev/dsk/ c#t1d#s#|replica_ metaset -s <share name> <replica_d501> 1 1 /dev/dsk/ c#t3d#s#|replica_ newfs /dev/md/<share name>/rdsk/<d500> | similarly for d501_ metainit -s <share name> <soft_slice_d555> -p <d500> <size_gb>| onlythis command is for the soft slice rest is only to create a disk-set.Steps Involved in creating a Disk-Set :Repeat the above steps one by one the only changes are add the another serversnode name also at the end of second command. If soft slice required then providethe last command or else leave it.When the control of diskset is need by the other node server the type this systemfrom the system which is requesting for service,# metaset -s <share name> -r |this is for request# metaset -s <share name> -t |this is when the another node is down# metaset -s <share name> -t -f |takes the control forcibly this can be givenwhen the next system is up but after this the main node will go to a panic state
  15. 15. Solaris Commands For SA-I & SA-II15Steps Jump Start Installation1 Configure the NIS master sever first#cp /etc/nsswitch.nis / etc/nsswitch.conf#domainname accel.com#touch /etc/defaultdomain#domainname > /etc/defaultdomain#cd /etc#touch ethers bootparams locale timezone netgroup netmasks#ypinit -m -> To initialize the master server#/usr/lib/netsvc/yp/ypstart -> To start the NIS daemons2 Edit /etc/ethers and add the following entries#vi /etc/ethers--------------------entry---------------------< MAC add of destination sys_8:0:20:95:f0:d0:> <server host name>-------------------------------------------------3 Edit /etc/hosts and add the following entries#vi /etc/hosts--------------------entry---------------------200.100.50.1 accel.com loghost timehost200.100.50.2 <host name>200.100.50.3 <host name>-------------------------------------------------4 Edit /etc/netmasks and add the following entries#vi /etc/netmasks--------------------entry---------------------200.100.50.0 255.255.255.0-------------------------------------------------5 Edit /etc/timezone and add the following entries#vi /etc/timezone--------------------entry---------------------US/mountain accel.com-------------------------------------------------6 Edit /etc/locale and add the following entries#vi /etc/locale--------------------entry---------------------accel.com en-us-------------------------------------------------7 Update the NIS maps#cd /var/yp#usr/ccs/bin/make8 #mkdir /jump ||create a directory to copy jump start files – size 2gb9 Insert Solaris CD - 1/2#cd /cdrom/cdrom0/s0/Solaris_8/Tools#./setup_install_server /jump10 Insert Solaris CD - 2/2#cd /cdrom/cdrom0/Solaris_8/Tools#./setup_install_server /jump11 Copy the sample jumpstart scripts from Solaris CD – 1/2 to /jump#cd /cdrom/cdrom0/s0/Solaris_8/Misc/jumpstart_sample#cp -r * /jump12 Create system identification details#cd /jump#mkdir sysidcfg-dir#cd sysidcfg-dir#mkdir <hostname of system to which we have to run jump start>
  16. 16. Solaris Commands For SA-I & SA-II16#cd <hostname of system to which we have to run jump start>#vi sysidcfg-------------------------entries-----------------------------system_locale=en_UStimezone=US/Centralterminal=xtermsname_service=NONEtimeservice=<servers IP 200.100.50.1>security_policy=NONEnetwork_interface=hme0{hostname=<host name of destination> ip_address=<destini IP>netmask=<destini mask> protocol_ipv6=no}-----------------------------------------------------------13 Create the profile file# cd /jump# vi .profile--------------------------entry----------------------------install_type initial_installsystem_type serverpartitioning explicitfilesys c0t0d0s0 3000 /filesys c0t0d0s1 750 swap(note: you can create other slices if required)geo N_Americacluster SUNWCall (entire distribution)(optional: you can add additional packages if required using the command:package <packagename> add-----------------------------------------------------------14 Add the entry in rules file# cd /jump# vi rules-------------------------entry-----------------------------any - - .profile –-----------------------------------------------------------15 Validate the rules.ok file# ./check16 Add the client# cd /jump/Solaris_8/Tools# ./add_install_client –c <destination server hostname>:/jump –p<destination server hostname>:/jump/sysidcfg-dir/e450 e450 sun4u17 Edit the /etc/dfs/dfstab file# vi /etc/dfs/dfstab-------------------------entry-----------------------------share –F nfs –o ro,anon=0 /jump-----------------------------------------------------------18 Update the NIS maps once again# cd /var/yp# /usr/ccs/bin/make19 19. To start the jumpstart installationGo to destination server and from there you just give the followingcommand form OK: prompt20 Ok : boot net – install
  17. 17. Solaris Commands For SA-I & SA-II17Remote AccessPut a “+” or “user name” in the “.rhost” file at home directory or else in /etc location so that usersfrom other system can login to the local system remotely.Command Functionrcp <host name>:<path> <destiny> Remote copyrlogin Remote login lllar to telnetrsh <host name> mt staus To utilize the other system h/w |tapeHints PurposeWell-known ports Ranges upto 1024 _ located at /etc/inet/servicesDynamic ports From 1025 to 65535_ at /etc/inet/servicesVeritas Volume ManagerInstallation :Insert Veritas cd & goto the package location and give pkgadd –d . ,after adding the package justgive #vxinstall this is to start installation of the veritas. Then it will ask few question giveappropriate answer for it. At any-cost don’t do the encapsulation this process is to add the roothard disk under veritas.Daemons Used : vxconfigd , vxiod – i/o operation, vxrelocd – hot relocationDisk Group : Collection of physical disk which were under veritasVolume (V) : Collection of disk is said to be as a volume.Plux (Pl) : Volumes were subdivided into pluxes. Maximum 32 plux in a volume & at least 1 pluxper volume.Subdisk (Sd) : Each and ever Plux is subdivided into a subdisk. All subdiskwithin a volume must fall under a same Disk Group.Commands FunctionsVxprint To view the status of VxVMVxdiskadm To view the Vx menu |press q – quitvxassist make <con1> <size>newfs /dev/vx/rdsk/<con1>To create concatenation | con1 is thename of concate | mount & use itvxvol stop <con1>vxedit -rf rm <con1>To remove the concatenation |-rf rm –remove forcibely, remove volume.vxassist make <str1> <size>layout=stripeTo create stripe of desired size | runnewfs and mount the devicevxvol stop <str1>vxedit -rf rm <str1>To remove the stripe |-rf rm – removeforcibely, remove volume.vxassist mirror rootvolvxassist mirror swapvolTo create root mirror|don’t run newfs|run encapsulation here – vxdiskadmvxplex -o –rm dis <rootvol-02>vxplex -o –rm dis <swapvol-02>/etc/vx/bin/vxunrootTo break the root mirror | don’t give<rootvol-01> at any-cost it will crashthe systemvxassist make <mirror> <size>layout=mirrorTo create a data mirror | run newfsand mount the devicevxvol stop <mirror>vxplex -o –rm dis <mirror>To break the data mirrorvxassist make <raid5> <size>layout=raid5To create disk space for Raid 5vxvol stop <raid5>vxplex -o –rm dis <raid5>To break the Raid 5vxdctl stopvxiod -f set0init 6To stop the VxVm daemonTo terminate the i/o operationRestart & uninstall veritas using cd
  18. 18. Solaris Commands For SA-I & SA-II18SUN CLUSTERRequired Components:Terminal Concentrator, Cluster host, Storage array, Public network, Administrative workstation –sun cluster console software SUNWccon It won’t support multiple connections from a sameserver to a single storage box.Topologies: Clustered Pair Topology, N+1 Topology, Pair + N topology. Clustered PairTopology : If two are more pairs of nodes operating under a single cluster administrativeframework. In this the Nodes are configured in pairs-two, four, six or eightnodesN+1 Topology : This is providing one system to act as the back-up for the other system inthe group.Pair + N topology : It is adding or including a pair of cluster in an existing cluster paironly for the purpose of storage sharing. In this there is no direct connection between them.NOTE:Once cluster is installed the init command won’t work to shutdown the system use# scshutdown -y g <grace period in minuter ##>Configuration steps of sun cluster 3.0Steps involved :_ Install Disk Suit_ Change SCSI Initiator ID_ Initial Installation - Sun Cluster Software Installation_ Configuring Quorum device_ Disk Set using Disk Suit_ Data Service ConfigurationChanging SCSI Initiator ID : { do this steps only in any one server node }Ok: probe-scsi-all | To view the physical disk path of the hard disk | note this for disk setOk: nvedit0: probe-all install-console banner1: cd < physical path or external hard disk_@1f,2000/scsi@1>2: 6 “ scsi-initiator-id” integer-property3: device-end4: cd < physical path or external hard disk_@1f,2000/scsi@1>5: 6 “ scsi-initiator-id” integer-property6: device-end7: banner < to save press ctrl c >Ok: nvstoreOk: setenv use-nvramrc? trueOk: setenv auto-boot? trueOk: reset-allOk: cd < physical path or external hard disk_@1f,2000/scsi@1>Ok: .properties | This is to view the changed SCSI initiator IDCreating Slices : { do this step in all the servers/nodes }For an sun cluster 4 slices are important they are root, swap, /globaldevices, 50mb for replica.Edit /etc/host : { do this step in all the servers/nodes }-----------------------entry-----------------------<server ip address> <host name><server ip address> <host name><service/logical ip address> <service/logical name_nfs-server> | its virtual IP----------------------------------------------------Assigning Logical or Virtual IP Address For the Service : { do in all servers/nodes }# ifconfig hme0:1 plumb# ifconfig hme0:1 <service ip address> netmask <netmask> up# init6 | restart all the nodes in a same instantCluster Installation : { do in all servers/nodes }# cd /cdrom/cdrom0/SunCluster_3.0/Tools
  19. 19. Solaris Commands For SA-I & SA-II19# ./scinstall | A installation menu will appear in that provide all the detailsCreate and Edit /.rhosts : { do in all servers/nodes }-----------------------entry-----------------------<server’s node name><server’s node name>----------------------------------------------------(or)Add root users to the sysadmin group i.e. /etc/group { do in all servers/nodes }Entry : sysadmin::14::root | add this entry in /etc/groupInstall the required patches such as 110648-33,111488-08,112108-07and RestartEdit /etc/profile : add following entry { do in all servers/nodes }-----------------------entry-----------------------PATH=/usr/bin::/usr/sbin::/usr/cluster/bin export PATHMANPATH=/usr/cluster/man export MANPATH----------------------------------------------------Configure the Quorum Device : { do in any one servers/node } | for voting purpose# scdidadm -L | to see the DID instance name on the storage box# scsetupcontinue (y/n) :yQuorum device : <DID instancename>Add another quorum device (y/n) :nReset installmode (y/n) :yOr# scconf -a -q globaldev=d9# scconf -c -q reset# scstat -q | to see statusDisk Set Configuration Steps : { do in all servers/node }Install Disk Suit from Solaris 2 of 2 CD and then create state db replica.# metaset -s <disk set name> -a -h <host name_ser1> <host name_ser2># metaset -s <disk set name> -a /dev/did/rdisk/<DID instance name>Creating Concate / Stribes : { do in all servers/node }# metainit -s <disk set name> <d99> 1 1 /dev/did/rdsk/<DID instance name>s0# newfs /dev/md/<disk set name>/rdsk/<d99># mkdir /global/nfs# mount -g /dev/md/<disk set name>/dsk/<d99> /global/nfsEdit /etc/vfstab : for permanent entry { do in all servers/node }/dev/md/<disk set name>/dsk/<d99> /dev/md/<disk set name>/rdsk/<d99>/global/nfs ufs 2 yes global,logging | 2 is for no-run fsck at bootNAFO – Network Adaptor Fail Over - for public n/w managementIn case of failure of the network adaptor which is responsible for public networkthen due to this also the public can’t able to access the server, in order to avoid that wecan provide a standby adaptor and that has to be configured in NAFO to take charge.# pnmstat -l | To view the status# pnmset | To creat NAFOcontinue (y/n) :yNumber NAFO backup groups : 1Group Number :0 | i.e nafo0Enter adaptor names : <hme0 hme1>
  20. 20. Solaris Commands For SA-I & SA-II20Data Service Configuration : Services like apache, oracle, dns, iws etc., Insert suncluster 2nd CD & give ./scinstall and then choose 4 for adding support for data service.In case of nfs select it and quit and then add required patched for the service eg. 111555-07 and then restart the system by scshutdown -y -g0Resource Group Manager (RGM) : { do in any one servers/node }Responsible for controlling the starting and stoping of resource group on selectednodes of the cluster.# cd /global/nfs# mkdir admin data# cd admin# mkdir SUNW.nfs# cd SUNW.nfs# touch dfstab.<resource group name># chmod 777 /global/nfs/dataEdit dfstab.<resource group name>-----------------------entry-----------------------share -F nfs -o rw /global/nfs/data----------------------------------------------------Register the Appropriate Resource type (NFS) :# scrgadm -a -t SUNW.nfs# scrgadm -a -g <resource group name_nfs-server-rg> -h <all node name> -y pathprefix=/global/nfs/admin# scrgadm -a -L -j <resource name_ nfs-server-rf> -g < resource group name_nfsserver-rg > -l <logical add_nfs-server># scrgadm -a -j <resource name_ nfs-server-rf> -g < resource group name_nfs-server-rg> -t SUNW.nfsEnabling & Bringing Resources Online :# scswitch -Z -g nfs-server-rg# scrgadm -a -L -g < resource group name_nfs-server-rg > -l <logical name_nfs-server>-n <nafo0@e450, nafo1@e250> | To associate pubic n/w mgt with resource groupDisabling nfs resources :# scswitch -n -M -j <resource name_ nfs-server-rf>Enabling nfs resources :# scswitch -e -M -j <resource name_ nfs-server-rf># scstat -g | To view the status# scrgadm -p | To view the resource type, group, installed resources etc.,In Client Side :_ Create a mount point # mkdir suncluster_ Mount the directory # mount <logical host_nfs-server>:/global/nfs/data/suncluster_ Edit /etc/hosts _ entry is <logical ip address> <logical name>To Manually switch the service from one node to the another :# scswitch -z -h <node which has to made active> -g <resource group name>
  21. 21. Solaris Commands For SA-I & SA-II21FLASH InstallationFlash installation is getting and saving the network configuration & setting of your system toan existing extra disk. In case of any failure in your system you put the extra disk in someother machine and restore the configuration by locating it while reinstallation of OS on yoursystem.#flarcreate -n <archive_name> -a <author name> -R / -x </var/tmp></flashdisk/file.archive – path in the destiny disk> _ To create a flash archive.Installing Explorer & Getting Explorer Output_ Get the SUNWexplo from CD or online_ Install it by placing it in /opt location_ To get the explorer output goto /opt/SUNWexplo/bin & give explorer -i_ Then output of explorer will be in the same location or in output directory.The file name will be explorer.<host id>.<hostname>-<date>.tar.gz_ If you want to read the content execute suncheckup for further details.

×