reconfigure command
some time for an long time without rebooting solaris system or important hardware changes need reboot important for proper working . The following steps
bash #> touch reconfigure
using touch command to create empty directory .
directory name should be reconfigure .(compulsory)
after creating
bash # > ./reconfigure
bash # > init 6
system reboot .
after login and finally reconfigure directory deleted automatically by solaris OS . all new drivers attached successfully ..
solaris 10 basic and administration commands,useful for doing certification in solaris 10 System administration . SCSA 200 and SCSA 202 exam material included with clear explanation
Devfsadm command to reconfigure hardware Devices without rebooting and path_to_instance
Most of real time application runs 24 / 7 . Hence no need to power off machine in case of new hardware adding like RAM , Hard disk . Hot plug-able devices
solaris 10 use following command
devfsadm ---------- command to reconfigure new attached devices.
devfsadm -C command to write new changes in library files ..
most of the hardware files associated with
bash > etc/path_to_instance
contains all hardware devices with Instances names..
solaris 10 use following command
devfsadm ---------- command to reconfigure new attached devices.
devfsadm -C command to write new changes in library files ..
most of the hardware files associated with
bash > etc/path_to_instance
contains all hardware devices with Instances names..
Zones concepts in detail Explination with real time
Solaris Zones
Features:
1. Virtualization - i.e. VMWare
2. Solaris Zones can host only instances of Solaris. Not other OSs.
3. Limit of 8192 zones per Solaris host
4. Primary zone(global) has access to ALL zones
5. Non-global zones, do NOT have access to other non-global zones
6. Default non-global zones derive packages from global zone
7. Program isolation - zone1(Apache), zone2(MySQL)
8. Provides 'z' commands to manage zones: zlogin, zonename, zoneadm,zonecfg
###Features of GLOBAL zone###
1. Solaris ALWAYS boots(cold/warm) to the global zone
2. Knows about ALL hardware devices attached to the system
3. Knows about ALL non-global zones
###Features of NON-GLOBAL zones###
1. Installed at a location on the filesystem of the GLOBAL zone 'zone root path' /export/home/zones/{zone1,zone2,zone3,...}
2. Share packages with GLOBAL zone
3. Manage distinct hostname and tables files
4. Cannot communicate with other non-global zones by default. NIC must be used, which means, use standard network API(TCP)
5. GLOBAL zone admin. can delegate non-global zone administration
###Zone Configuration###
Use: zonecfg - to configure zones
Note: zonecfg can be run: interactively, non-interactively, command-file modes
Requirements for non-global zones:
1. hostname
2. zone root path. i.e. /export/home/zones/testzone1
3. IP address - bound to logical or physical interface
Zone Types:
1. Sparse Root Zones - share key files with global zone
2. Whole Root Zones - require more storage
Steps for configuring non-global zone:
1. mkdir /export/home/zones/testzone1 && chmod 700 /export/home/zones/testzone1
2. zonecfg -z testzone1
3. create
4. set zonepath=/export/home/zones/testzone1 - sets root of zone
5. add net ; set address=192.168.1.60
6. set physical=e1000g0
7. (optional) set autoboot=true - testzone1 will be started when system boots
8. (optional) add attr ; set name=comment; set type=string; set value="TestZone1"
9. verify zone - verifies zone for errors
10. commit changes - commit
11. Zone Installation - zoneadm -z testzone1 install - places zone, 'testzone1' into 'installed' state. NOT ready for production
12. zoneadm -z testzone1 boot - boots the zone, changing its state
###Zlogin - is used to login to zones###
Note: each non-global zone maintains a console. Use 'zlogin -C zonename' after installing zone to complete zone configuration
Note: Zlogin permits login to non-global zone via the following:
1. Interactive - i.e. zlogin -l username zonename
2. Non-interactive - zlogin options command
3. Console mode - zlogin -C zonename
4. Safe mode - zlogin -S
zoneadm -z testzone1 reboot - reboots the zone
zlogin testzone1 shutdown
Features:
1. Virtualization - i.e. VMWare
2. Solaris Zones can host only instances of Solaris. Not other OSs.
3. Limit of 8192 zones per Solaris host
4. Primary zone(global) has access to ALL zones
5. Non-global zones, do NOT have access to other non-global zones
6. Default non-global zones derive packages from global zone
7. Program isolation - zone1(Apache), zone2(MySQL)
8. Provides 'z' commands to manage zones: zlogin, zonename, zoneadm,zonecfg
###Features of GLOBAL zone###
1. Solaris ALWAYS boots(cold/warm) to the global zone
2. Knows about ALL hardware devices attached to the system
3. Knows about ALL non-global zones
###Features of NON-GLOBAL zones###
1. Installed at a location on the filesystem of the GLOBAL zone 'zone root path' /export/home/zones/{zone1,zone2,zone3,...}
2. Share packages with GLOBAL zone
3. Manage distinct hostname and tables files
4. Cannot communicate with other non-global zones by default. NIC must be used, which means, use standard network API(TCP)
5. GLOBAL zone admin. can delegate non-global zone administration
###Zone Configuration###
Use: zonecfg - to configure zones
Note: zonecfg can be run: interactively, non-interactively, command-file modes
Requirements for non-global zones:
1. hostname
2. zone root path. i.e. /export/home/zones/testzone1
3. IP address - bound to logical or physical interface
Zone Types:
1. Sparse Root Zones - share key files with global zone
2. Whole Root Zones - require more storage
Steps for configuring non-global zone:
1. mkdir /export/home/zones/testzone1 && chmod 700 /export/home/zones/testzone1
2. zonecfg -z testzone1
3. create
4. set zonepath=/export/home/zones/testzone1 - sets root of zone
5. add net ; set address=192.168.1.60
6. set physical=e1000g0
7. (optional) set autoboot=true - testzone1 will be started when system boots
8. (optional) add attr ; set name=comment; set type=string; set value="TestZone1"
9. verify zone - verifies zone for errors
10. commit changes - commit
11. Zone Installation - zoneadm -z testzone1 install - places zone, 'testzone1' into 'installed' state. NOT ready for production
12. zoneadm -z testzone1 boot - boots the zone, changing its state
###Zlogin - is used to login to zones###
Note: each non-global zone maintains a console. Use 'zlogin -C zonename' after installing zone to complete zone configuration
Note: Zlogin permits login to non-global zone via the following:
1. Interactive - i.e. zlogin -l username zonename
2. Non-interactive - zlogin options command
3. Console mode - zlogin -C zonename
4. Safe mode - zlogin -S
zoneadm -z testzone1 reboot - reboots the zone
zlogin testzone1 shutdown
Explination about RAID levels in solaris 10
Describing RAID and Solaris™ Volume Manager Software
The Solaris Volume Manager software can be run from the command line or a graphical user interface (GUI) tool to simplify system administration tasks on storage devices.
The Solaris Volume Manager software lets you manage large numbers of disks and the data on those disks.
Logical Volume
The Solaris Volume Manager software uses virtual disks called logical volumes to manage physical disks and their associated data.
Historically, a logical volume is functionally identical to a physical slice.
However, a logical volume can span multiple disk members.
The Solaris Volume Manager software converts I/O requests directed at a volume into I/O requests to the underlying member disks.
You can create the Solaris Volume Manager software volumes from slices (disk partitions)
To create more storage capacity as a single volume, you can use the Solaris
Volume Manager software to make the system treat a collection of many small slices as one large slice or device.
After creating a large volume from these slices, you can immediately begin by using it just as any other slice or device.
Note – In earlier versions of the Solaris OS, the Solaris Volume Manager
software was known as Solstice DiskSuite™ software, and logical volumes were known as metadevices. Most of the associated command-line tools begin with the prefix meta. Logical devices are located under the /dev/md directory.
The State Database
Before creating volumes, state database replicas must exist on the Solaris Volume Manager software system.
The state database stores information on disk about the state of the Solaris Volume Manager software configuration.
The state database records and tracks changes made to your configuration.
The Solaris Volume Manager software automatically updates the state database when a configuration or state change occurs.
For example, creating a new volume is a configuration change, while failure of a submirror is a state change.
The state database is a collection of multiple, replicated database copies.
Each copy (called a state database replica) ensures that the data in the
database is always valid.
The state database tracks the location and status of all known state database replicas.
During a state database update, each replica state database is updated.
The updates take place one at a time to protect against corrupting all updates if the system crashes.
If a system loses a state database replica, Solaris Volume Manager must determine which state database replicas still contain non-corrupted data.
It determines this information by a majority consensus algorithm.
This algorithm requires that a majority (half + 1) of the state database replicas be available and in agreement with each other before any of them are
considered non-corrupt.
Because of the majority consensus algorithm, you should create at least 3 state database replicas when you set up your disk configuration.
A consensus can be reached as long as at least two of the three state database replicas are available.
If a state database replica becomes corrupt because its underlying slice encountered an error, you must repair or replace the slice, and then recreate the replica.
If all state database replicas are lost, you could lose all data that is stored on your Solaris Volume Manager software volumes.
You should create enough state database replicas on separate drives and across controllers to prevent complete data loss.
Recommendations for State Database Replicas
To avoid single points-of-failure, you should distribute state database replicas across slices, drives, and controllers.
A majority of replicas must survive a single component failure.
When working with state database replicas, consider the following:
You should create state database replicas on a dedicated slice of at
least 4 Mbytes per replica.
You can put replicas on unused slices, and then use them on RAID-0,
RAID 1, or RAID 5 volumes.
You cannot create state database replicas on any slices in use.
A minimum of 3 state database replicas are recommended.
The following guidelines are recommended:
For a system with only a single drive: put all three replicas in
one slice.
For a system with two to four drives: put two replicas on each
drive.
For a system with five or more drives: put one replica on each
drive.
Make sure that you have at least two extra replicas per mirror.
You can add additional state database replicas to the system at any
time. The additional state database replicas help to ensure the Solaris
Volume Manager software’s availability.
Hot spares and hot spare pools provide additional physical slices for automatic recovery from RAID 1 mirror or RAID 5 volume failures.
Hot Spares
A hot spare is a slice (not a volume) that is functional and available, but
not in use.
A hot spare is on reserve to substitute for a failed slice in a submirror or RAID 5 volume.
A hot spare must be ready for immediate use in the event of a slice failure in the volume with which it is associated.
Hot Spare Pools
A hot spare pool is a collection of slices.
Note – Hot spares do not apply to RAID 0 volumes or to one-way mirrors.
For automatic substitution to work, redundant data must be available.
Rloe Based access control in solaris 10
The authorizations, roles, rights profiles, and privileged commands are defined in four files.
# cat /etc/user_attr ==> lists rights profiles & authorizations
associated with users and roles
# cat /etc/security/prof_attr ==> to view the rights profile names and
descriptions
# cat /etc/security/policy.conf
# cat /etc/security/exec_attr file
Assigning Rights Profiles To Users
# cat /etc/security/prof_attr ==> to view the rights profile names and
descriptions
All:::Execute any command as the user or role:help=RtAll.html
Log Management:::Manage log files:help=RtLogMngmnt.html
Media Backup:::Backup files and file systems:help=RtMediaBkup.html
Media Restore:::Restore files and file systems from
backups:help=RtMediaRestore.html
First column: Right profile name
Fourth column: Comment
Last column: Pointer to a help file
Help files exist in the /usr/lib/help/auths/locale/C directory
The /etc/security/exec_attr file holds the execution attributes.
An execution attribute is associated with a rights profile name.
# cat /etc/security/exec_attr
Printer Management:suser:cmd:::/usr/bin/lpstat:euid=0
Printer Management:suser:cmd:::/usr/lib/lp/local/accept:uid=lp
# useradd -md /export/home/john -s /bin/ksh john
# profiles john ==> to view the default profiles assigned to every
new user account
To assign a profile while creating a user
# useradd -md /export/home/paul -s /bin/ksh -P "Printer Management" paul
# profiles paul ==> to list the rights profiles assigned to a user
# su - paul
$ profiles
# usermod -P "Printer Management" chris ==> to assign rights profiles to a
user account
This automatically updates the /etc/user_attr file
# cat /etc/user_attr
# usermod -P "Service Operator,Printer Management" username
# profiles -l chris ==> to view the contents of a rights profile
# usermod -P "" username ==> to remove the rights profiles
Assigning Rights Profiles To Roles
If a large number of user accounts require the same configuration and management of rights profiles, it can be easier to assign the rights profiles to a role and give the users access to the role.
Creating a Role
The roleadd command creates a role entry in the /etc/passwd, /etc/shadow, and /etc/user_attr files
-c comment A text string that provides a short description of
the role.
-d dir Specifies the home directory of the new role.
-m Creates the new role’s home directory if it does
not already exist.
-P profile Assigns rights profiles to the role. Use commas (,)
to separate multiple rights profiles.
To create a role
# roleadd -m -d /export/home/level1 -c "Level One Support" \
-P "Printer Management,Media Backup,Media Restore" level1
# passwd level1
The role cannot be used until a password is applied to it
# grep level1 /etc/passwd
level1:x:102:1:Level One Support:/export/home/level1:/bin/pfsh
# grep level1 /etc/shadow
level1:CUs8aQ64vTrZ.:12713::::::
# grep level1 /etc/user_attr
level1::::type=role;profiles=Printer Management,Media Backup,Media Restore
Modifying a Role
-e expire Specifies the expiration date for a role.
-l new_logname Specifies the new login name for the role.
-P profile Specifies one or more comma-separated rights
profiles, as defined in the /etc/security/prof_attr file.
-s shell Specifies the full path name of the program that
is used as the role’s shell when logging in.
These shells are special versions of the Bourne
shell (sh), C shell (csh), and Korn shell (ksh).
# rolemod -P "profile1,profile2" -s /usr/bin/pfksh level1
# rolemod -P "Printer Management,Service Operator" level1
# rolemod -P "" level1 ==> to remove the rights profiles assigned to a role
The profile shells are pfsh, pfcsh, and pfksh. These profile shells correspond to Bourne shell (sh), C shell (csh), and Korn shell (ksh), respectively.
# roledel -r rolename ==> to delete a role
Assigning Roles To Users
A user can have access to many roles
To assign roles to a user
# useradd -m -d /export/home/paul -s /bin/ksh -R level1 paul
# passwd paul
# roles username ==> to list the roles of a user account
# usermod -R rolename username ==> to add roles to an existing user account
# usermod -R "" username ==> to remove all role access from a user
account
Using Roles
It is not possible to log into a role account.
Log in as a regular user first.
The roles command shows the roles available to the account.
$ id
$ roles
Switch the user to the role account with the su command
$ su - level1
$ id
$ profiles
# cat /etc/user_attr ==> lists rights profiles & authorizations
associated with users and roles
# cat /etc/security/prof_attr ==> to view the rights profile names and
descriptions
# cat /etc/security/policy.conf
# cat /etc/security/exec_attr file
Assigning Rights Profiles To Users
# cat /etc/security/prof_attr ==> to view the rights profile names and
descriptions
All:::Execute any command as the user or role:help=RtAll.html
Log Management:::Manage log files:help=RtLogMngmnt.html
Media Backup:::Backup files and file systems:help=RtMediaBkup.html
Media Restore:::Restore files and file systems from
backups:help=RtMediaRestore.html
First column: Right profile name
Fourth column: Comment
Last column: Pointer to a help file
Help files exist in the /usr/lib/help/auths/locale/C directory
The /etc/security/exec_attr file holds the execution attributes.
An execution attribute is associated with a rights profile name.
# cat /etc/security/exec_attr
Printer Management:suser:cmd:::/usr/bin/lpstat:euid=0
Printer Management:suser:cmd:::/usr/lib/lp/local/accept:uid=lp
# useradd -md /export/home/john -s /bin/ksh john
# profiles john ==> to view the default profiles assigned to every
new user account
To assign a profile while creating a user
# useradd -md /export/home/paul -s /bin/ksh -P "Printer Management" paul
# profiles paul ==> to list the rights profiles assigned to a user
# su - paul
$ profiles
# usermod -P "Printer Management" chris ==> to assign rights profiles to a
user account
This automatically updates the /etc/user_attr file
# cat /etc/user_attr
# usermod -P "Service Operator,Printer Management" username
# profiles -l chris ==> to view the contents of a rights profile
# usermod -P "" username ==> to remove the rights profiles
Assigning Rights Profiles To Roles
If a large number of user accounts require the same configuration and management of rights profiles, it can be easier to assign the rights profiles to a role and give the users access to the role.
Creating a Role
The roleadd command creates a role entry in the /etc/passwd, /etc/shadow, and /etc/user_attr files
-c comment A text string that provides a short description of
the role.
-d dir Specifies the home directory of the new role.
-m Creates the new role’s home directory if it does
not already exist.
-P profile Assigns rights profiles to the role. Use commas (,)
to separate multiple rights profiles.
To create a role
# roleadd -m -d /export/home/level1 -c "Level One Support" \
-P "Printer Management,Media Backup,Media Restore" level1
# passwd level1
The role cannot be used until a password is applied to it
# grep level1 /etc/passwd
level1:x:102:1:Level One Support:/export/home/level1:/bin/pfsh
# grep level1 /etc/shadow
level1:CUs8aQ64vTrZ.:12713::::::
# grep level1 /etc/user_attr
level1::::type=role;profiles=Printer Management,Media Backup,Media Restore
Modifying a Role
-e expire Specifies the expiration date for a role.
-l new_logname Specifies the new login name for the role.
-P profile Specifies one or more comma-separated rights
profiles, as defined in the /etc/security/prof_attr file.
-s shell Specifies the full path name of the program that
is used as the role’s shell when logging in.
These shells are special versions of the Bourne
shell (sh), C shell (csh), and Korn shell (ksh).
# rolemod -P "profile1,profile2" -s /usr/bin/pfksh level1
# rolemod -P "Printer Management,Service Operator" level1
# rolemod -P "" level1 ==> to remove the rights profiles assigned to a role
The profile shells are pfsh, pfcsh, and pfksh. These profile shells correspond to Bourne shell (sh), C shell (csh), and Korn shell (ksh), respectively.
# roledel -r rolename ==> to delete a role
Assigning Roles To Users
A user can have access to many roles
To assign roles to a user
# useradd -m -d /export/home/paul -s /bin/ksh -R level1 paul
# passwd paul
# roles username ==> to list the roles of a user account
# usermod -R rolename username ==> to add roles to an existing user account
# usermod -R "" username ==> to remove all role access from a user
account
Using Roles
It is not possible to log into a role account.
Log in as a regular user first.
The roles command shows the roles available to the account.
$ id
$ roles
Switch the user to the role account with the su command
$ su - level1
$ id
$ profiles
Configuring Network File System in detail
The Network File System (NFS) is a client-server service that lets users view, store, and update files on a remote computer as though they were on their own local computer.
# vi /etc/dfs/dfstab ==> to share local resources
# share [-F fstype] [ -o options] [-d "<text>"] <pathname> [resource]
# .e.g,
# share -F nfs -o rw=engineering -d "home dirs" /export/home2
share -F nfs -o ro -d "Shared data files" /usr/local/data
share -F nfs -o rw,root=sys-01 -d "Database files" /rdbms_files
Note – If svc:/network/nfs/server service does not find any share commands in the /etc/dfs/dfstab file, it does not start the NFS server daemons.
# cat /etc/dfs/sharetab ==> to view local resources currently shared
# cat /etc/dfs/fstypes ==> to view a system’s distributed file
system types
# cat /etc/rmtab ==> to view file systems remotely mounted by
NFS clients
sys-03:/usr/local/data
sys-02:/export/config
#ys-02:/export/config
Managing the NFS Server Daemons
# svcadm enable svc:/network/nfs/server ==> to start the NFS server
daemons
Note – If the svc:/network/nfs/server service does not find any share commands in the /etc/dfs/dfstab file, it does not start the NFS server daemons.
# svcadm disable svc:/network/nfs/server ==> to stop the NFS server
daemons
NFS Server Commands
share Makes a local directory on an NFS server available for mounting. It also displays the contents of the /etc/dfs/sharetab file.
unshare Makes a previously available directory unavailable for client side mount operations.
shareall Reads and executes share statements in the /etc/dfs/dfstab file.
unshareall Makes previously shared resources unavailable.
dfshares Lists available shared resources from a remote or local NFS server.
dfmounts Displays a list of NFS server directories that are currently mounted.
Configuringthe NFS Server for Sharing Resources
syntax: share [ -F nfs ] [ -o options ] [ -d description ] [ pathname ]
# share -o ro /usr/local/data ==> to share a file resource
# share -F nfs -o ro directory ==> restricts access to NFS-mounted
resources to read-only access
# share -F nfs -o ro,rw=client1 directory ==> Restricts access to NFS
mounted resources to read-only
access; however, the NFS server
accepts read & write requests
from client named client1.
# share -F nfs -o root=client2 directory ==> Allows the root user on the
client named client2 to have
superuser access to the NFS
mounted resources
This command shares the directory to the four named hosts only. The hosts, client1 and client2, have read-only access. The hosts client3 and client4 have read-write access. The root user from host client4 has root privilege access to the shared directory and its contents.
# share -F nfs -o ro=client1:client2,rw=client3:client4,root=client4 directory
# share ==> to display a list of all currently shared file resources
Making File Resources Unavailable for Mounting
syntax: unshare [ -F nfs ] pathname
# unshare /usr/local/data ==> to make the /usr/local/data directory
unavailable for client-side mount
operations
Sharing and Unsharing All NFS Resources
shareall [ -F nfs ]
unshareall [ -F nfs ]
# shareall ==> to share all resources listed in /etc/dfs/dfstab file
# unshareall ==> to unshare currently shared file resources listed in
/etc/dfs/sharetab file
Displaying Currently Shared NFS Resources
dfshares [ -F nfs ] [ host ]
# dfshares ==> to display the resources currently being shared by the
local server
# dfshares sys-01 ==> to display resources shared by another server
# share ==> to display a list of all currently shared file resources
Displaying NFS Mounted Resources
dfmounts [ -F nfs ] [ server ]
# dfmounts ==> to display remotely mounted NFS resource information
RESOURCE SERVER PATHNAME CLIENTS
- sys-02 /usr/local/data sys-03
Managing the NFS Client
Managing the NFS Client Daemons
# svcadm restart svc:/network/nfs/client ==> to start NFS client
daemons
NFS Client Commands
# dfshares servername
# mount
# umount
# mountall
# umountall
Configuring the NFS Client for Mounting Resources
# dfshares sys-01 ==> to list the resources of an NFS server
Mounting a remote file resource
mount [ -F nfs ] [ -o options ] server:pathname mount_point
# mount sys-02:/rdbms_files /mnt ==> to mount a remote file resource
# mount -o ro sys-45,sys-43,sys-41:/multi_homed_data /remote_shared_data
In the above example, if sys-45 server is unavailable, the request passes to
the next server on the list, sys-43, and then to the sys-41 server. This process works if the resource mounted from all of the servers is the same.
Unmounting a remote file resource
umount server:pathname or mount_point
# umount /rdbms_files ==> to unmount a remote file resource
Mounting & Unmounting remote file resources only (resources listed in the
/etc/vfstab file with a mount at boot value of yes)
mountall -r [ -F nfs ]
umountall -r [ -F nfs ]
# mountall -r ==> to mount all remote file resources only
# umountall -r ==> to unmount all remote file resuources only
Note – Use the -F FSType with the mountall and umountall commands to specify FSType as the file system type. You do not have to specify the -F nfs option, because NFS is listed as the default remote file system type.
Mounting Remote Resources at Boot Time
Enter appropriate entries in the client’s /etc/vfstab file to mount remote file resources at boot time
# vi /etc/vfstab
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
sys-02:/usr/local/data - /usr/remote_data nfs - yes soft,bg
bg|fg During an NFS mount request, if the first mount attempt fails, retry in the background or foreground.
The default is to retry in the foreground.
soft|hard When the number of retransmissions has reached the number specified in the retrans=n option, a file system mounted with the soft option reports an error on the request, and stops trying. A file system mounted with the hard option prints a warning message and continues to try to process the request.
The default is a hard mount.
Although the soft option and the bg option are not the default settings, combining them usually results in the fastest client boot when NFS mounting problems occur.
Enabling NFS Server Logging
Note – Server logging is not supported in NFS version 4.
Create tag entries for each of the server’s shared resources.
The global tag defines the default values.
# cat /etc/nfs/nfslog.conf ==> to configure NFS log paths
# NFS server log configuration file.
#
# <tag> [ defaultdir=<dir_path> ] \
# [ log=<logfile_path> ] [ fhtable=<table_path> ] \
# [ buffer=<bufferfile_path> ] [ logformat=basic|extended ]
#
global defaultdir=/var/nfs \
log=nfslog fhtable=fhtable buffer=nfslog_workbuffer
To easily identify the log files for different shared resources, place them in
separate directories. For example:
# cat /etc/nfs/nfslog.conf
# NFS server log configuration file.
#
global defaultdir=/var/nfs \
log=nfslog fhtable=fhtable buffer=nfslog_workbuffer
public defaultdir=/var/nfs/public \
log=nfslog fhtable=fhtable buffer=nfslog_workbuffer
Note – Create /var/nfs/public directory before starting NFS server logging.
Initiating NFS Logging
1. Become superuser.
2. Optional: Change the file system configuration settings.
In the /etc/nfs/nfslog.conf file, either:
Edit the default settings for all file systems by changing the data
corresponding to the global tag.
Add a new tag for the specific file system.
If you do not need these changes, do not edit this file.
3. Edit the /etc/dfs/dfstab file to add an entry for file systems for which
you want to enable NFS server logging.
Either:
Use log option without specifying a tag - to use the global tag as
default.
Specify a tag - with the log=tag option
share -F nfs -olog /export/sys44_data
share -F nfs -olog=public /export/sys44_data
4. Check that the NFS service is running on the server, if not start it.
# svcadm enable svc:/network/nfs/server
5. Run the share command to verify that the correct options are listed.
# share
6. If you add additional entries to /etc/dfs/dfstab file, share the file
system by rebooting the system or entering the shareall command.
# shareall
# vi /etc/dfs/dfstab ==> to share local resources
# share [-F fstype] [ -o options] [-d "<text>"] <pathname> [resource]
# .e.g,
# share -F nfs -o rw=engineering -d "home dirs" /export/home2
share -F nfs -o ro -d "Shared data files" /usr/local/data
share -F nfs -o rw,root=sys-01 -d "Database files" /rdbms_files
Note – If svc:/network/nfs/server service does not find any share commands in the /etc/dfs/dfstab file, it does not start the NFS server daemons.
# cat /etc/dfs/sharetab ==> to view local resources currently shared
# cat /etc/dfs/fstypes ==> to view a system’s distributed file
system types
# cat /etc/rmtab ==> to view file systems remotely mounted by
NFS clients
sys-03:/usr/local/data
sys-02:/export/config
#ys-02:/export/config
Managing the NFS Server Daemons
# svcadm enable svc:/network/nfs/server ==> to start the NFS server
daemons
Note – If the svc:/network/nfs/server service does not find any share commands in the /etc/dfs/dfstab file, it does not start the NFS server daemons.
# svcadm disable svc:/network/nfs/server ==> to stop the NFS server
daemons
NFS Server Commands
share Makes a local directory on an NFS server available for mounting. It also displays the contents of the /etc/dfs/sharetab file.
unshare Makes a previously available directory unavailable for client side mount operations.
shareall Reads and executes share statements in the /etc/dfs/dfstab file.
unshareall Makes previously shared resources unavailable.
dfshares Lists available shared resources from a remote or local NFS server.
dfmounts Displays a list of NFS server directories that are currently mounted.
Configuringthe NFS Server for Sharing Resources
syntax: share [ -F nfs ] [ -o options ] [ -d description ] [ pathname ]
# share -o ro /usr/local/data ==> to share a file resource
# share -F nfs -o ro directory ==> restricts access to NFS-mounted
resources to read-only access
# share -F nfs -o ro,rw=client1 directory ==> Restricts access to NFS
mounted resources to read-only
access; however, the NFS server
accepts read & write requests
from client named client1.
# share -F nfs -o root=client2 directory ==> Allows the root user on the
client named client2 to have
superuser access to the NFS
mounted resources
This command shares the directory to the four named hosts only. The hosts, client1 and client2, have read-only access. The hosts client3 and client4 have read-write access. The root user from host client4 has root privilege access to the shared directory and its contents.
# share -F nfs -o ro=client1:client2,rw=client3:client4,root=client4 directory
# share ==> to display a list of all currently shared file resources
Making File Resources Unavailable for Mounting
syntax: unshare [ -F nfs ] pathname
# unshare /usr/local/data ==> to make the /usr/local/data directory
unavailable for client-side mount
operations
Sharing and Unsharing All NFS Resources
shareall [ -F nfs ]
unshareall [ -F nfs ]
# shareall ==> to share all resources listed in /etc/dfs/dfstab file
# unshareall ==> to unshare currently shared file resources listed in
/etc/dfs/sharetab file
Displaying Currently Shared NFS Resources
dfshares [ -F nfs ] [ host ]
# dfshares ==> to display the resources currently being shared by the
local server
# dfshares sys-01 ==> to display resources shared by another server
# share ==> to display a list of all currently shared file resources
Displaying NFS Mounted Resources
dfmounts [ -F nfs ] [ server ]
# dfmounts ==> to display remotely mounted NFS resource information
RESOURCE SERVER PATHNAME CLIENTS
- sys-02 /usr/local/data sys-03
Managing the NFS Client
Managing the NFS Client Daemons
# svcadm restart svc:/network/nfs/client ==> to start NFS client
daemons
NFS Client Commands
# dfshares servername
# mount
# umount
# mountall
# umountall
Configuring the NFS Client for Mounting Resources
# dfshares sys-01 ==> to list the resources of an NFS server
Mounting a remote file resource
mount [ -F nfs ] [ -o options ] server:pathname mount_point
# mount sys-02:/rdbms_files /mnt ==> to mount a remote file resource
# mount -o ro sys-45,sys-43,sys-41:/multi_homed_data /remote_shared_data
In the above example, if sys-45 server is unavailable, the request passes to
the next server on the list, sys-43, and then to the sys-41 server. This process works if the resource mounted from all of the servers is the same.
Unmounting a remote file resource
umount server:pathname or mount_point
# umount /rdbms_files ==> to unmount a remote file resource
Mounting & Unmounting remote file resources only (resources listed in the
/etc/vfstab file with a mount at boot value of yes)
mountall -r [ -F nfs ]
umountall -r [ -F nfs ]
# mountall -r ==> to mount all remote file resources only
# umountall -r ==> to unmount all remote file resuources only
Note – Use the -F FSType with the mountall and umountall commands to specify FSType as the file system type. You do not have to specify the -F nfs option, because NFS is listed as the default remote file system type.
Mounting Remote Resources at Boot Time
Enter appropriate entries in the client’s /etc/vfstab file to mount remote file resources at boot time
# vi /etc/vfstab
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
sys-02:/usr/local/data - /usr/remote_data nfs - yes soft,bg
bg|fg During an NFS mount request, if the first mount attempt fails, retry in the background or foreground.
The default is to retry in the foreground.
soft|hard When the number of retransmissions has reached the number specified in the retrans=n option, a file system mounted with the soft option reports an error on the request, and stops trying. A file system mounted with the hard option prints a warning message and continues to try to process the request.
The default is a hard mount.
Although the soft option and the bg option are not the default settings, combining them usually results in the fastest client boot when NFS mounting problems occur.
Enabling NFS Server Logging
Note – Server logging is not supported in NFS version 4.
Create tag entries for each of the server’s shared resources.
The global tag defines the default values.
# cat /etc/nfs/nfslog.conf ==> to configure NFS log paths
# NFS server log configuration file.
#
# <tag> [ defaultdir=<dir_path> ] \
# [ log=<logfile_path> ] [ fhtable=<table_path> ] \
# [ buffer=<bufferfile_path> ] [ logformat=basic|extended ]
#
global defaultdir=/var/nfs \
log=nfslog fhtable=fhtable buffer=nfslog_workbuffer
To easily identify the log files for different shared resources, place them in
separate directories. For example:
# cat /etc/nfs/nfslog.conf
# NFS server log configuration file.
#
global defaultdir=/var/nfs \
log=nfslog fhtable=fhtable buffer=nfslog_workbuffer
public defaultdir=/var/nfs/public \
log=nfslog fhtable=fhtable buffer=nfslog_workbuffer
Note – Create /var/nfs/public directory before starting NFS server logging.
Initiating NFS Logging
1. Become superuser.
2. Optional: Change the file system configuration settings.
In the /etc/nfs/nfslog.conf file, either:
Edit the default settings for all file systems by changing the data
corresponding to the global tag.
Add a new tag for the specific file system.
If you do not need these changes, do not edit this file.
3. Edit the /etc/dfs/dfstab file to add an entry for file systems for which
you want to enable NFS server logging.
Either:
Use log option without specifying a tag - to use the global tag as
default.
Specify a tag - with the log=tag option
share -F nfs -olog /export/sys44_data
share -F nfs -olog=public /export/sys44_data
4. Check that the NFS service is running on the server, if not start it.
# svcadm enable svc:/network/nfs/server
5. Run the share command to verify that the correct options are listed.
# share
6. If you add additional entries to /etc/dfs/dfstab file, share the file
system by rebooting the system or entering the shareall command.
# shareall
Swap space adding and removing in solaris 10
A system’s virtual memory is a combination of RAM and disk space.
Portions of the virtual memory are reserved as swap space.
Swap space can be defined as a temporary storage location that is used when the system’s memory requirements exceed the size of available RAM.
# swap -s ==> to list a summary of the system’s virtual swap space
# swap -l ==> to list the details of the system’s physical swap areas
Note – There can be a discrepancy in available and free swap space size
between the swap -s and swap -l outputs. The swap -s output does not take into account pre-allocated swap space that has not yet been used by a process.
Adding Swap Space
Adding Swap Slices
1. Edit the /etc/vfstab file to add information describing the swap slice
# vi /etc/vfstab
2. Add the following line to create the swap slice
/dev/dsk/c1d0s1 - - swap - no -
3. Use the swap -a command to add additional swap area
# swap -a /dev/dsk/c1d0s1
Note – When the system is subsequently rebooted, the new swap slice
/dev/dsk/c1t3d0s1 is automatically included as part of the swap space as a result of adding the entry to the /etc/vfstab file.
Adding Swap Files
1. Identify a file system that has adequate space to create an additional swap file, preferably on another drive.
2. Make a directory to hold the swap file.
# mkdir -p /usr/local/swap
3. Create a 20-Mbyte swap file named swapfile in /usr/local/swap directory.
# mkfile 20m /usr/local/swap/swapfile
4. Add the swap file to the system’s swap space.
# swap -a /usr/local/swap/swapfile
5. List the details of the modified system swap space.
# swap -l
6. List a summary of the modified system swap space.
# swap -s
7. To use a swap file when the system is subsequently rebooted, add an entry for the swap file in the /etc/vfstab file.
# vi /etc/vfstab
/usr/local/swap/swapfile - - swap - no -
Removing Swap Space
Removing Swap Slices
1. Delete a swap slice from the current swap configuration.
# swap -d /dev/dsk/c1d0s1
2. To prevent the swap slice from being configured as part of the swap configuration during a reboot or change of run level, edit the /etc/vfstab file, and remove the swap slice entry from the file.
Removing Swap Files
1. Delete a swap file from the current swap configuration.
# swap -d /usr/local/swap/swapfile
2. Remove the file to free the disk space that it is occupying.
# rm /usr/local/swap/swapfile
3. To prevent the swap file from being configured as part of the swap configuration during a reboot or change of run level, edit the /etc/vfstab file, and remove the swap file entry.
Note – The output of the df -h command shows the space used by the
swap file until it is removed.
Portions of the virtual memory are reserved as swap space.
Swap space can be defined as a temporary storage location that is used when the system’s memory requirements exceed the size of available RAM.
# swap -s ==> to list a summary of the system’s virtual swap space
# swap -l ==> to list the details of the system’s physical swap areas
Note – There can be a discrepancy in available and free swap space size
between the swap -s and swap -l outputs. The swap -s output does not take into account pre-allocated swap space that has not yet been used by a process.
Adding Swap Space
Adding Swap Slices
1. Edit the /etc/vfstab file to add information describing the swap slice
# vi /etc/vfstab
2. Add the following line to create the swap slice
/dev/dsk/c1d0s1 - - swap - no -
3. Use the swap -a command to add additional swap area
# swap -a /dev/dsk/c1d0s1
Note – When the system is subsequently rebooted, the new swap slice
/dev/dsk/c1t3d0s1 is automatically included as part of the swap space as a result of adding the entry to the /etc/vfstab file.
Adding Swap Files
1. Identify a file system that has adequate space to create an additional swap file, preferably on another drive.
2. Make a directory to hold the swap file.
# mkdir -p /usr/local/swap
3. Create a 20-Mbyte swap file named swapfile in /usr/local/swap directory.
# mkfile 20m /usr/local/swap/swapfile
4. Add the swap file to the system’s swap space.
# swap -a /usr/local/swap/swapfile
5. List the details of the modified system swap space.
# swap -l
6. List a summary of the modified system swap space.
# swap -s
7. To use a swap file when the system is subsequently rebooted, add an entry for the swap file in the /etc/vfstab file.
# vi /etc/vfstab
/usr/local/swap/swapfile - - swap - no -
Removing Swap Space
Removing Swap Slices
1. Delete a swap slice from the current swap configuration.
# swap -d /dev/dsk/c1d0s1
2. To prevent the swap slice from being configured as part of the swap configuration during a reboot or change of run level, edit the /etc/vfstab file, and remove the swap slice entry from the file.
Removing Swap Files
1. Delete a swap file from the current swap configuration.
# swap -d /usr/local/swap/swapfile
2. Remove the file to free the disk space that it is occupying.
# rm /usr/local/swap/swapfile
3. To prevent the swap file from being configured as part of the swap configuration during a reboot or change of run level, edit the /etc/vfstab file, and remove the swap file entry.
Note – The output of the df -h command shows the space used by the
swap file until it is removed.
RPC , HOSTS and inetadm commands in detail ( solaris 10 )
The client-server model describes the communication process between two computers or programs.
The client system makes a service request to the server system, then the server system fulfills the request.
Although programs can use the client-server model internally in a single computer, the model is more widely used across a network.
The client-server model provides a way to distribute services efficiently across multiple locations on a network.
The client-server model describes network services and the client programs of those services.
Client Processes
The client is a host or a process that uses services from another host or program, known as a server.
Server Processes
The server is a host or a process that provides services to another program
known as a client.
Client-server computing is a key factor in supporting network computing
Starting Server Processes
Internet Service Daemon (inetd)
The inetd daemon is a special network process that runs on each system and starts server processes that do not automatically start at boot time
The inetd daemon is the server process for both the standard Internet services and Sun Remote Procedure Call (Sun RPC) services
Network services can be independently enabled or disabled using the inetadm command.
# inetadm ==> to list the current state of all network facilities
Note – When a network service is affected, any related services are also affected. By disabling one service, a number of other services may become unavailable.
# inetadm | grep telnet ==> to view if telnet is enabled or not
# inetadm -d telnet ==> to disable the telnet facility
# inetadm | grep telnet
# inetadm -e telnet ==> to enable the telnet facility
# inetadm | grep telnet
# inetadm -l telnet ==> to list the details about telnet
Network Ports
Network ports help transport protocols to distinguish between multiple service requests arriving at a given host computer
The TCP and UDP transport protocols identify ports using a positive integer between 1 and 65535, which is called a port number.
Network ports can be divided into two categories, well-known ports and ephemeral (short-lived) ports.
If a port number is not pre-assigned, the operating system allows an application to choose an unused port number.
A client often communicates with a server through a well-known port.
Well-known ports are stored in the /etc/inet/services file.
# grep telnet /etc/inet/services ==> to view the well-known port of a
specific service
# grep mail /etc/inet/services
Starting RPC Services
RPC services are assigned a unique program number by the programmer when they are written.
The RPC services are not typically assigned to well-known ports.
RPC services started at boot time with startup scripts run on available ports above 32768.
The rpcbind process associates RPC program numbers with port numbers.
# grep rpcbind /etc/services
Listing Registered RPC Services
syntax: rpcinfo -p [ host ]
# rpcinfo -p ==> to list all services registered with rpcbind process
program vers proto port service
100000 4 tcp 111 rpcbind
100000 3 tcp 111 rpcbind
100000 3 udp 111 rpcbind
100000 2 udp 111 rpcbind
100232 10 udp 32772 sadmind
100083 1 tcp 32771
Deleting RPC Service Registration
syntax: rpcinfo -d prognum versnum
# rpcinfo -d 100012 1 ==> This command unregisters the RPC service with program number 100012 and version number 1.
The deleted RPC service that uses program number
100012 is sprayd.
To register the sprayd service again, restart the inetd daemon as follows:
# svcadm disable svc:/network/rpp/spray:udp
# svcadm enable svc:/network/rpp/spray:udp
Note – When using the rpcinfo -d command to unregister an RPC service, the RPC service can be identified using either the service name or the program number.
The client system makes a service request to the server system, then the server system fulfills the request.
Although programs can use the client-server model internally in a single computer, the model is more widely used across a network.
The client-server model provides a way to distribute services efficiently across multiple locations on a network.
The client-server model describes network services and the client programs of those services.
Client Processes
The client is a host or a process that uses services from another host or program, known as a server.
Server Processes
The server is a host or a process that provides services to another program
known as a client.
Client-server computing is a key factor in supporting network computing
Starting Server Processes
Internet Service Daemon (inetd)
The inetd daemon is a special network process that runs on each system and starts server processes that do not automatically start at boot time
The inetd daemon is the server process for both the standard Internet services and Sun Remote Procedure Call (Sun RPC) services
Network services can be independently enabled or disabled using the inetadm command.
# inetadm ==> to list the current state of all network facilities
Note – When a network service is affected, any related services are also affected. By disabling one service, a number of other services may become unavailable.
# inetadm | grep telnet ==> to view if telnet is enabled or not
# inetadm -d telnet ==> to disable the telnet facility
# inetadm | grep telnet
# inetadm -e telnet ==> to enable the telnet facility
# inetadm | grep telnet
# inetadm -l telnet ==> to list the details about telnet
Network Ports
Network ports help transport protocols to distinguish between multiple service requests arriving at a given host computer
The TCP and UDP transport protocols identify ports using a positive integer between 1 and 65535, which is called a port number.
Network ports can be divided into two categories, well-known ports and ephemeral (short-lived) ports.
If a port number is not pre-assigned, the operating system allows an application to choose an unused port number.
A client often communicates with a server through a well-known port.
Well-known ports are stored in the /etc/inet/services file.
# grep telnet /etc/inet/services ==> to view the well-known port of a
specific service
# grep mail /etc/inet/services
Starting RPC Services
RPC services are assigned a unique program number by the programmer when they are written.
The RPC services are not typically assigned to well-known ports.
RPC services started at boot time with startup scripts run on available ports above 32768.
The rpcbind process associates RPC program numbers with port numbers.
# grep rpcbind /etc/services
Listing Registered RPC Services
syntax: rpcinfo -p [ host ]
# rpcinfo -p ==> to list all services registered with rpcbind process
program vers proto port service
100000 4 tcp 111 rpcbind
100000 3 tcp 111 rpcbind
100000 3 udp 111 rpcbind
100000 2 udp 111 rpcbind
100232 10 udp 32772 sadmind
100083 1 tcp 32771
Deleting RPC Service Registration
syntax: rpcinfo -d prognum versnum
# rpcinfo -d 100012 1 ==> This command unregisters the RPC service with program number 100012 and version number 1.
The deleted RPC service that uses program number
100012 is sprayd.
To register the sprayd service again, restart the inetd daemon as follows:
# svcadm disable svc:/network/rpp/spray:udp
# svcadm enable svc:/network/rpp/spray:udp
Note – When using the rpcinfo -d command to unregister an RPC service, the RPC service can be identified using either the service name or the program number.
Describing Interface configuration ( assign IP address )
# ifconfig -a ==> to display the MAC address
# ifconfig -a ==> to display the configuration for all
network interfaces
# ifconfig rtls0 down ==> to mark an ethernet interface as down
# ifconfig -a
# ifconfig rtls0 up ==> to mark an ethernet interface as up
# ifconfig -a
# ifconfig rtls0 <ipaddr> up ==> to change ip address
# ifconfig rtls0 192.168.1.100 up
# vi /etc/inet/hosts
192.168.1.100 station100 loghost
:wq
Sending ICMP ECHO_REQUEST Packets
# ping station14 ==> to determine if you can contact another system
over the network
Capturing and Inspecting Network Packets
# snoop station12 station14 ==> to view network traffic between two
specific systems
Additional snoop options:
snoop Summary output
snoop -V Summary verbose output
snoop -v Detailed verbose output
snoop -o filename Redirects the snoop utility output to filename in summary mode
snoop -i filename Displays packets that were previously captured in filename
Note – Press Control-C to stop the snoop utility.
The Service Management Facility (SMF)
The SMF provides a centralized configuration structure for managing system services
The svc.startd daemon is the daemon which is responsible for maintaining the system services
A sub-component of the SMF, the Internet daemon processes are mostly managed using the inetadm command.
# inetadm ==> to list internet daemon processes
Configuring IPv4 Interfaces at Boot Time
The services and files are the following
The svc:/network/physical:default service
The /etc/hostname.xxn file
The /etc/inet/hosts file
The svc:/network/physical:default service calls /lib/svc/method/net-physical method script.
It is one of the startup scripts that runs each time you boot the system. This script uses the ifconfig utility to configure each interface with an IP address and other required network information.
The /etc/hostname.hme0 file contains either the host name or the IP address of the system that contains the hme0 interface.
The host name contained in the file must exist in the /etc/inet/hosts file so that it can be resolved to an IP address at system boot time
# cat /etc/hostname.hme0
sys41
or
# cat /etc/hostname.hme0
192.168.30.41
The /etc/inet/hosts file is a local database that associates the IP addresses of hosts with their names
# cat /etc/inet/hosts
127.0.0.1 localhost
192.168.30.41 sys41 loghost #connection to hme interface
192.168.4.1 sys41 #connection to qfe interface
Changing the System Host Name
The host name of a system is contained in three files on the system.
Modify all of these files, and perform a reboot, to successfully change a system’s host name.
The /etc/nodename file
The /etc/hostname.xxn file
The /etc/inet/hosts file
# cat /etc/nodename ==> to view a systems /etc/nodename file
sys41
# cat /etc/inet/ipnodes
# cat /etc/hosts
# ifconfig -a ==> to display the configuration for all
network interfaces
# ifconfig rtls0 down ==> to mark an ethernet interface as down
# ifconfig -a
# ifconfig rtls0 up ==> to mark an ethernet interface as up
# ifconfig -a
# ifconfig rtls0 <ipaddr> up ==> to change ip address
# ifconfig rtls0 192.168.1.100 up
# vi /etc/inet/hosts
192.168.1.100 station100 loghost
:wq
Sending ICMP ECHO_REQUEST Packets
# ping station14 ==> to determine if you can contact another system
over the network
Capturing and Inspecting Network Packets
# snoop station12 station14 ==> to view network traffic between two
specific systems
Additional snoop options:
snoop Summary output
snoop -V Summary verbose output
snoop -v Detailed verbose output
snoop -o filename Redirects the snoop utility output to filename in summary mode
snoop -i filename Displays packets that were previously captured in filename
Note – Press Control-C to stop the snoop utility.
The Service Management Facility (SMF)
The SMF provides a centralized configuration structure for managing system services
The svc.startd daemon is the daemon which is responsible for maintaining the system services
A sub-component of the SMF, the Internet daemon processes are mostly managed using the inetadm command.
# inetadm ==> to list internet daemon processes
Configuring IPv4 Interfaces at Boot Time
The services and files are the following
The svc:/network/physical:default service
The /etc/hostname.xxn file
The /etc/inet/hosts file
The svc:/network/physical:default service calls /lib/svc/method/net-physical method script.
It is one of the startup scripts that runs each time you boot the system. This script uses the ifconfig utility to configure each interface with an IP address and other required network information.
The /etc/hostname.hme0 file contains either the host name or the IP address of the system that contains the hme0 interface.
The host name contained in the file must exist in the /etc/inet/hosts file so that it can be resolved to an IP address at system boot time
# cat /etc/hostname.hme0
sys41
or
# cat /etc/hostname.hme0
192.168.30.41
The /etc/inet/hosts file is a local database that associates the IP addresses of hosts with their names
# cat /etc/inet/hosts
127.0.0.1 localhost
192.168.30.41 sys41 loghost #connection to hme interface
192.168.4.1 sys41 #connection to qfe interface
Changing the System Host Name
The host name of a system is contained in three files on the system.
Modify all of these files, and perform a reboot, to successfully change a system’s host name.
The /etc/nodename file
The /etc/hostname.xxn file
The /etc/inet/hosts file
# cat /etc/nodename ==> to view a systems /etc/nodename file
sys41
# cat /etc/inet/ipnodes
# cat /etc/hosts
Configuring printer services (add , remove,modify ) A - Z solaris 10
# svcs -a | grep ’print’ ==> to check the status of the print service
# svcadm enable svc:/application/print/server:default ==> to enable print
service
# svcadm disable svc:/application/print/server:default ==> to disable print
service
# svcs -a | grep ’print/server’
# /usr/sbin/printmgr & ==> to configure local or network printer
with Solaris OS Print Manager
Setting the System’s Default Printer
# lpadmin -d printername ==> to set a system’s default destination
printer
# lpstat -d ==> to verify if the system’s default destination printer
has been set
# lp <filename> ==> to send a print request
Removing a Client’s Printer Configuration
# lpadmin -x printername ==> to delete a printer from the system
Starting and Stopping the LP Print Service
The LP print service is started by the lpsched daemon and is shut down by the lpshut command.
# svcadm enable application/print/server ==> to start lpsched daemon
# svcadm disable print/server ==> to stop the print server service
# svcs -a | grep print
To submit a print job to the default printer or to another printer
Using lp
$ /usr/bin/lp filename
$ /usr/bin/lp -d printername filename
Using lpr
$ /usr/ucb/lpr filename
$ /usr/ucb/lpr -P printername filename
To submit a print request that uses the POSIX style
$ /usr/bin/lp -d hostname:printername filename ==> hostname - print server
name
$ /usr/ucb/lpr -P hostname:printername filename
LP Print Service Administration Commands
accept Permits print requests to be queued for the specific printers
reject Prevents print requests from being queued for the specific printers
enable Activates the specified printers
disable Deactivates the specified printers
lpmove Moves print requests from one printer destination to another
Accepting Print Jobs
# /usr/sbin/accept destination(s)
# accept printername ==> to permit print requests to be queued on the
specified printer
Rejecting Print Jobs
To prevent print requests from queuing & stop users from submitting requests to the printer queues
# /usr/sbin/reject -r “reason" destination(s)
# reject -r "Replacing Toner Cartridge" printername
Enabling Printers
To activate printers, which enables printing of requests submitted to the print queues
# /usr/bin/enable destination(s)
# enable printername
Disabling Printers
To deactivate specified printers, which disables them from printing print requests waiting in the print queues
# /usr/bin/disable -c | -W -r “reason” destination
# disable -W -r “Printer down for maintenance” printername
$ lpstat -a ==> to view the printer status by a user
$ lpstat -t ==> to view the printer status by a user
Moving Print Jobs
To move one or all print requests from one printer destination to another printer destination.
# /usr/sbin/lpmove source_destination target_destination
Example:
1. Become the root user on the print server.
2. Use the reject command to prevent any further print requests from
being sent to the print queue. This step notifies users that the printer
is not accepting requests.
# reject -r “PrinterC is down for repairs” printerC
destination “printerC” will no longer accept requests
3. Use the lpstat command to display the print queue to see how
many print requests are to be moved. This step is needed to identify
print request identification numbers (IDs) only if selected print
requests are going to be moved to another printer.
# lpstat -o
printerC-29 sys41!user1 61426 Jan 07 12:30
printerC-30 sys41!user1 9560 Jan 07 12:30
printerC-31 sys42!user2 845 Jan 07 12:30
printerC-32 sys42!user2 845 Jan 07 12:30
printerC-33 sys42!user2 845 Jan 07 12:30
4. Use the lpstat command to verify that the destination printer is
accepting print requests.
# lpstat -a printerA
printer printerA accepting requests since Tue Jan 1
5. Move the print requests.
a. For example, to move all print requests from printerC over to printerA
# lpmove printerC printerA
move in progress ...
total of 5 requests moved from printerC to printerA
b. For example, to move one or more individual print requests
from printerC to printerA
# lpmove printerC-32 printerC-33 printerA
total of 2 requests moved to printerA
6. If all print requests were moved from printerC, in step 5a,
printerC has a reject automatically applied to it. When
printerC is available again, use the accept command to allow print
jobs to queue to printerC.
# accept printerC
destination “printerC” now accepting requests
Removing a Server’s Printer Configuration
1. Log in as the root user on the print server on which the printer is
configured.
2. Stop queuing print requests on the printer.
# reject printername
3. Stop the printer.
# disable printername
4. Delete the printer from the print server.
# lpadmin -x printername
This action deletes configuration information for the printer from the print server’s /etc/lp/printers directory and /etc/printers.conf file.
CONFIGURING A PRINTER
The host name and IP address of the print server must exist in the local systems /etc/inet/hosts file.
1. Log in as the root user and open two terminal windows. In one of the windows, use the tty command to identify the pseudo-terminal device it uses. Use this device name as the port for the new printer.
# tty
2. In the other terminal window, run the Solaris OS print manager.
# /usr/sbin/printmgr &
3. In the Select Naming Service panel, verify that files is selected, and click OK. From the print manager menu, select the Show Command Line Console option. Position the Command Line Console in a convenient location.
4. From the Printer menu, select the New Attached Printer option.
5. Fill in the fields according to the Table. To name your printer, use a name different from that of your system.
Field Selection or Entry
Printer name Your choice.
Description Your choice.
Printer Port Select the Other option. Enter the device name of
the terminal window found in Step 1.
Printer Make Lexmark.
Printer Model Lexmark Optra E310.
Printer Driver Foomatic/Postscript (recommended).
Fault Notification Write to superuser.
Default Printer Select the box.
Always Print Banner Do not select the box.
User Access List No change.
6. Click OK when you are finished. Notice the command-line entries that appear on the console window.
7. Test your printer configuration by printing the /etc/inet/hosts file to the default printer. Observe the output on the other terminal window.
# lp /etc/inet/hosts
You should see the contents of the /etc/inet/hosts file converted to the format a Lexmark Optra E310 would expect, scroll through the other window.
8. From the Printer menu, select the Add Access to Printer option.
9. Fill in the fields according to the Table.
Field Selection or Entry
Printer name Enter the name of a printer on another system.
Printer server Enter the name of the system on which the
preceding printer is defined. Ensure this system
name and IP address are in your /etc/inet/hosts
file.
Description Your choice.
Default printer Do not select the box.
10. Click OK when you are finished.
Notice the command-line entries that appear in the console window.
11. Test your new configuration by printing the /etc/inet/hosts file to
the remote printer. Observe the output on the other system.
# lp -d printername2 /etc/inet/hosts
You should see the contents of the /etc/inet/hosts file converted to the format a Lexmark Optra E310 would expect, scrolling through the other window.
12. In an available terminal window, use the lpstat command to
display the current status information of the printers on your system.
# lpstat -t
13. Disable print output for your default printer.
# disable printername1
14. Send the following four files to your default printer:
/etc/inet/hosts, /etc/inittab, /etc/dfs/dfstab, and
/etc/skel/local.profile.
# lp /etc/inet/hosts
# lp /etc/inittab
# lp /etc/dfs/dfstab
# lp /etc/skel/local.profile
15. Check the print queue to find the request ID for each job.
# lpstat -o
The four print jobs should be listed with sequential numbers.
16. Use the request IDs to cancel two of the requests. Verify the result.
Use the following syntax to cancel the requests:
# cancel printername1-# printername1-#
# lpstat -o
Two of the print jobs should be gone.
17. Cancel the other two jobs by indicating the user who sent them.
Verify the result. For example:
# cancel -u root
# lpstat -o
18. Enable printing for your default printer.
# enable printername1
19. Set your default printer to reject requests, and display a reason for
doing so. For example:
# reject -r “Printer is down for maintenance” printername1
20. Attempt to send a job to the default printer. Observe the messages
displayed.
# lp /etc/inet/hosts
Your message should say printername1: Requests are not being accepted.
21. Use the lpstat command to display the reason that the printer is
not accepting requests. Use the following syntax:
# lpstat -a printername1
Your message should say printername1: your reason from step 20.
22. Set your default printer to again accept requests.
# accept printername1
23. Test your printer configuration by printing the /etc/inet/hosts
file to the default printer. Observe the output on the other terminal
window.
# lp /etc/inet/hosts
24. Before removing the printers, prevent any further print requests
from being queued:
# reject -r "removing printer" printername1
destination “printername1” will no longer accept requests
# reject -r "removing printer" printername2
destination “printername2” will no longer accept requests
25. Remove both printers.
# lpadmin -x printername1
# lpadmin -x printername2
# svcadm enable svc:/application/print/server:default ==> to enable print
service
# svcadm disable svc:/application/print/server:default ==> to disable print
service
# svcs -a | grep ’print/server’
# /usr/sbin/printmgr & ==> to configure local or network printer
with Solaris OS Print Manager
Setting the System’s Default Printer
# lpadmin -d printername ==> to set a system’s default destination
printer
# lpstat -d ==> to verify if the system’s default destination printer
has been set
# lp <filename> ==> to send a print request
Removing a Client’s Printer Configuration
# lpadmin -x printername ==> to delete a printer from the system
Starting and Stopping the LP Print Service
The LP print service is started by the lpsched daemon and is shut down by the lpshut command.
# svcadm enable application/print/server ==> to start lpsched daemon
# svcadm disable print/server ==> to stop the print server service
# svcs -a | grep print
To submit a print job to the default printer or to another printer
Using lp
$ /usr/bin/lp filename
$ /usr/bin/lp -d printername filename
Using lpr
$ /usr/ucb/lpr filename
$ /usr/ucb/lpr -P printername filename
To submit a print request that uses the POSIX style
$ /usr/bin/lp -d hostname:printername filename ==> hostname - print server
name
$ /usr/ucb/lpr -P hostname:printername filename
LP Print Service Administration Commands
accept Permits print requests to be queued for the specific printers
reject Prevents print requests from being queued for the specific printers
enable Activates the specified printers
disable Deactivates the specified printers
lpmove Moves print requests from one printer destination to another
Accepting Print Jobs
# /usr/sbin/accept destination(s)
# accept printername ==> to permit print requests to be queued on the
specified printer
Rejecting Print Jobs
To prevent print requests from queuing & stop users from submitting requests to the printer queues
# /usr/sbin/reject -r “reason" destination(s)
# reject -r "Replacing Toner Cartridge" printername
Enabling Printers
To activate printers, which enables printing of requests submitted to the print queues
# /usr/bin/enable destination(s)
# enable printername
Disabling Printers
To deactivate specified printers, which disables them from printing print requests waiting in the print queues
# /usr/bin/disable -c | -W -r “reason” destination
# disable -W -r “Printer down for maintenance” printername
$ lpstat -a ==> to view the printer status by a user
$ lpstat -t ==> to view the printer status by a user
Moving Print Jobs
To move one or all print requests from one printer destination to another printer destination.
# /usr/sbin/lpmove source_destination target_destination
Example:
1. Become the root user on the print server.
2. Use the reject command to prevent any further print requests from
being sent to the print queue. This step notifies users that the printer
is not accepting requests.
# reject -r “PrinterC is down for repairs” printerC
destination “printerC” will no longer accept requests
3. Use the lpstat command to display the print queue to see how
many print requests are to be moved. This step is needed to identify
print request identification numbers (IDs) only if selected print
requests are going to be moved to another printer.
# lpstat -o
printerC-29 sys41!user1 61426 Jan 07 12:30
printerC-30 sys41!user1 9560 Jan 07 12:30
printerC-31 sys42!user2 845 Jan 07 12:30
printerC-32 sys42!user2 845 Jan 07 12:30
printerC-33 sys42!user2 845 Jan 07 12:30
4. Use the lpstat command to verify that the destination printer is
accepting print requests.
# lpstat -a printerA
printer printerA accepting requests since Tue Jan 1
5. Move the print requests.
a. For example, to move all print requests from printerC over to printerA
# lpmove printerC printerA
move in progress ...
total of 5 requests moved from printerC to printerA
b. For example, to move one or more individual print requests
from printerC to printerA
# lpmove printerC-32 printerC-33 printerA
total of 2 requests moved to printerA
6. If all print requests were moved from printerC, in step 5a,
printerC has a reject automatically applied to it. When
printerC is available again, use the accept command to allow print
jobs to queue to printerC.
# accept printerC
destination “printerC” now accepting requests
Removing a Server’s Printer Configuration
1. Log in as the root user on the print server on which the printer is
configured.
2. Stop queuing print requests on the printer.
# reject printername
3. Stop the printer.
# disable printername
4. Delete the printer from the print server.
# lpadmin -x printername
This action deletes configuration information for the printer from the print server’s /etc/lp/printers directory and /etc/printers.conf file.
CONFIGURING A PRINTER
The host name and IP address of the print server must exist in the local systems /etc/inet/hosts file.
1. Log in as the root user and open two terminal windows. In one of the windows, use the tty command to identify the pseudo-terminal device it uses. Use this device name as the port for the new printer.
# tty
2. In the other terminal window, run the Solaris OS print manager.
# /usr/sbin/printmgr &
3. In the Select Naming Service panel, verify that files is selected, and click OK. From the print manager menu, select the Show Command Line Console option. Position the Command Line Console in a convenient location.
4. From the Printer menu, select the New Attached Printer option.
5. Fill in the fields according to the Table. To name your printer, use a name different from that of your system.
Field Selection or Entry
Printer name Your choice.
Description Your choice.
Printer Port Select the Other option. Enter the device name of
the terminal window found in Step 1.
Printer Make Lexmark.
Printer Model Lexmark Optra E310.
Printer Driver Foomatic/Postscript (recommended).
Fault Notification Write to superuser.
Default Printer Select the box.
Always Print Banner Do not select the box.
User Access List No change.
6. Click OK when you are finished. Notice the command-line entries that appear on the console window.
7. Test your printer configuration by printing the /etc/inet/hosts file to the default printer. Observe the output on the other terminal window.
# lp /etc/inet/hosts
You should see the contents of the /etc/inet/hosts file converted to the format a Lexmark Optra E310 would expect, scroll through the other window.
8. From the Printer menu, select the Add Access to Printer option.
9. Fill in the fields according to the Table.
Field Selection or Entry
Printer name Enter the name of a printer on another system.
Printer server Enter the name of the system on which the
preceding printer is defined. Ensure this system
name and IP address are in your /etc/inet/hosts
file.
Description Your choice.
Default printer Do not select the box.
10. Click OK when you are finished.
Notice the command-line entries that appear in the console window.
11. Test your new configuration by printing the /etc/inet/hosts file to
the remote printer. Observe the output on the other system.
# lp -d printername2 /etc/inet/hosts
You should see the contents of the /etc/inet/hosts file converted to the format a Lexmark Optra E310 would expect, scrolling through the other window.
12. In an available terminal window, use the lpstat command to
display the current status information of the printers on your system.
# lpstat -t
13. Disable print output for your default printer.
# disable printername1
14. Send the following four files to your default printer:
/etc/inet/hosts, /etc/inittab, /etc/dfs/dfstab, and
/etc/skel/local.profile.
# lp /etc/inet/hosts
# lp /etc/inittab
# lp /etc/dfs/dfstab
# lp /etc/skel/local.profile
15. Check the print queue to find the request ID for each job.
# lpstat -o
The four print jobs should be listed with sequential numbers.
16. Use the request IDs to cancel two of the requests. Verify the result.
Use the following syntax to cancel the requests:
# cancel printername1-# printername1-#
# lpstat -o
Two of the print jobs should be gone.
17. Cancel the other two jobs by indicating the user who sent them.
Verify the result. For example:
# cancel -u root
# lpstat -o
18. Enable printing for your default printer.
# enable printername1
19. Set your default printer to reject requests, and display a reason for
doing so. For example:
# reject -r “Printer is down for maintenance” printername1
20. Attempt to send a job to the default printer. Observe the messages
displayed.
# lp /etc/inet/hosts
Your message should say printername1: Requests are not being accepted.
21. Use the lpstat command to display the reason that the printer is
not accepting requests. Use the following syntax:
# lpstat -a printername1
Your message should say printername1: your reason from step 20.
22. Set your default printer to again accept requests.
# accept printername1
23. Test your printer configuration by printing the /etc/inet/hosts
file to the default printer. Observe the output on the other terminal
window.
# lp /etc/inet/hosts
24. Before removing the printers, prevent any further print requests
from being queued:
# reject -r "removing printer" printername1
destination “printername1” will no longer accept requests
# reject -r "removing printer" printername2
destination “printername2” will no longer accept requests
25. Remove both printers.
# lpadmin -x printername1
# lpadmin -x printername2
Backuping the mounted file system an UFS snapshot
Creating a UFS Snapshot
Use fssnap command to create, query, or delete temporary read-only snapshots of ufs file systems.
Syntax to create a UFS snapshot:
# fssnap -F ufs -o bs=backing_store_path /file-system
Note – The backing_store_path can be a raw device, the name of an existing directory, or the name of a file that does not already exist.
Example:
# fssnap -F ufs -o bs=/var/tmp /export/home ==> to create a snapshot of
/export/home file system
Limiting the Size of the Backing-Store File
To limit the backing-store file to 500 Mbytes
# fssnap -F ufs -o bs=/var/tmp,maxsize=500m /export/home
Displaying Information for a ufs File System Snapshot
# fssnap -i ==> to list all current UFS snapshots on the system
# /usr/lib/fs/ufs/fssnap -i /export/home ==> to display detailed
information for a specific UFS snapshot
Backing Up the UFS Snapshot File
Use the tar command or the ufsdump command to back up a UFS snapshot.
Using the tar Command to Back Up a Snapshot File
Mount the snapshot before backing it up
1. Create the mount point for the block virtual device.
# mkdir -p /backups/home.bkup
2. Mount the block virtual device to the mount point.
# mount -F ufs -o ro /dev/fssnap/0 /backups/home.bkup
3. Change directory to the mount point.
# cd /backups/home.bkup
4. Use the tar command to write the data to tape.
# tar cvf /dev/rmt/0 .
Using the ufsdump Command
Specify the raw virtual device during the backup
# ufsdump 0uf /dev/rmt/0 /dev/rfssnap/0
# ufsdump 0ufN /dev/rmt/0 /dev/rdsk/c0d1s7 /dev/rfssnap/0
Verify that the UFS snapshot is backed up.
# ufsrestore tf /dev/rmt/0 ==> t - to list the table of contents of the backup media
Performing an Incremental Backup Using a UFS Snapshot
To create an incremental backup of a snapshot
# ufsdump 1ufN /dev/rmt/0 /dev/rdsk/c0d1s7 /dev/rfssnap/0
Use the ufsdump command with the N option to create an incremental UFS snapshot, which writes the name of the device being backed up, rather than the name of the snapshot device to the /etc/dumpdates file.
Note – It is important to note the use of the N argument when backing up
a snapshot. This argument ensures proper updates to the /etc/dumpdates file.
To verify that the UFS snapshot is backed up to tape
# ufsrestore tf /dev/rmt/0
Performing incremental backups of snapshots
1. Create a snapshot of the /extra file system that is going to be
backed up while the file system is mounted.
# fssnap -o bs=/var/tmp /extra
2. Verify that the snapshot was successful, and view detailed
information about the snapshot.
# fssnap -i
# /usr/lib/fs/ufs/fssnap -i /extra
3. Make a directory that will be used to mount and view the snapshot
data.
# mkdir /extrasnap
4. Mount the snapshot to the new mount point, and compare the size of
the file system and the snapshot device.
# mount -o ro /dev/fssnap/0 /extrasnap
# df -k | grep extra
/dev/dsk/c0d1s3 1294023 9 1242254 1% /extra
/dev/fssnap/0 1294023 9 1242254 1% /extrasnap
5. Edit a file under the /extra directory and make it larger, and then
compare the size of the file system and the snapshot device.
# df -k |grep extra
/dev/dsk/c0d1s3 1294023 20 1242243 1% /extra
/dev/fssnap/0 1294023 9 1242254 1% /extrasnap
Observe that the file system grew in size while the snapshot file did not.
6. Perform a full backup with the N option of the ufsdump command.
# ufsdump 0ufN /dev/rmt/0 /dev/rdsk/c0d1s3 /dev/rfssnap/0
7. Verify the backup.
# ufsrestore tf /dev/rmt/0
8. Unmount the back up device and remove the snapshot & backing-store file.
# umount /extrasnap
# fssnap -d /extra
# rm /var/tmp/snapshot0
9. Make some changes to the /extra file system, such as copying some
files, and then re-create the snapshot.
# fssnap -o bs=/var/tmp /extra
10. Re-mount the snapshot device, and compare the size of the file
system and the snapshot device.
# mount -o ro /dev/fssnap/0 /extrasnap
# df -k | grep extra
/dev/dsk/c0d1s3 1294023 46 1242217 1% /extra
/dev/fssnap/0 1294023 46 1242217 1% /extrasnap
11. Perform an incremental backup with the N option of the ufsdump
command.
# ufsdump 1ufN /dev/rmt/0 /dev/rdsk/c0d1s3 /dev/rfssnap/0
12. Verify the backup.
# ufsrestore tf /dev/rmt/0
Notice that the backup of the snapshot contains only the files that were added since the previous Level 0 backup.
Restoring Data From a UFS Snapshot Backup
Data written to a tape by ufsdump is simply data, whether it is a snapshot or a file system.
Restore a UFS snapshot from a backup tape in the same manner as you would from the backup of an original file system.
Deleting a UFS Snapshot
1. First, unmount the snapshot device
2. Delete the snapshot
3. Finally remove the backing-store file.
# umount /dev/fssnap/0
# fssnap -d /export/home
# rm /backing_store_file
Performing File system Restore including incremental back up (solaris 10)
The ufsrestore command copies files to the disk, relative to the current
working directory, from backup tapes that were created by the ufsdump command.
The syntax for the ufsrestore command is:
ufsrestore option(s) argument(s) filesystem
The following procedure demonstrates how to use the ufsrestore command to restore the /export/home file system on the c0d1s7 slice.
1. Create the new file system structure.
# newfs /dev/rdsk/c0d1s7
2. Mount the file system to the /export/home directory, and change to that directory.
# mount /dev/dsk/c0d1s7 /export/home
# cd /export/home
3. Restore the entire /export/home file system from the backup tape.
# ufsrestore rf /dev/rmt/0
Note – Always restore a file system by starting with the Level 0 backup tape, continuing with the next-lower-level tape, and continuing through the highest-level tape.
4. Remove the restoresymtable file.
# rm restoresymtable
Remove the restoresymtable file when the restore is complete.
5. Unmount the new file system.
# cd /
# umount /export/home
6. Use the fsck command to check the restored file system.
# fsck /dev/rdsk/c0d1s7
7. Perform a full backup of the file system.
# ufsdump 0uf /dev/rmt/0 /dev/rdsk/c0d1s7
The ufsrestore command repositions the files and changes the inode allocation.
8. init 6
Using the ufsrestore Command to Restore a Critical File System
The following procedure demonstrates how to restore the /usr file system on Slice 6 of the boot disk.
1. Insert the Solaris 10 Software 1 CD-ROM or DVD, and boot from it with the single-user mode option.
ok boot cdrom -s
2. Create the new file system structure.
# newfs /dev/rdsk/c0t0d0s6
3. Mount the file system to the mount point /a, and change to that directory.
# mount /dev/dsk/c0t0d0s6 /a
# cd /a
4. Restore the entire /usr file system from the backup tape.
# ufsrestore rf /dev/rmt/0
5. Remove the restoresymtable file.
# rm restoresymtable
6. Unmount the new file system.
# cd /
# umount /a
7. Use the fsck command to check the restored file system.
# fsck /dev/rdsk/c0t0d0s6
8. Perform a full backup of the file system.
# ufsdump 0uf /dev/rmt/0 /dev/rdsk/c0t0d0s6
9. Reboot the system.
# init 6
Invoking an Interactive Restore
The following procedure demonstrates how to use the ufsrestore i command to extract individual files from a backup tape.
1. Become the root user, and change to the temporary directory that you want to receive the extracted files.
# cd /export/home/tmp
2. Perform the ufsrestore i command.
# ufsrestore ivf /dev/rmt/0
3. Display the contents of the directory structure on the backup tape.
ufsrestore > ls
.:
2 *./ 13 directory1 15 directory3 11 file2
2 *../ 14 directory2 10 file1 12 file3
4. Change to the target directory on the backup tape.
ufsrestore > cd directory1
ufsrestore > ls
./directory1:
3904 ./ 2 *../ 3905 file1 3906 file2 3907 file3
5. Add the files you want to restore to the extraction list.
ufsrestore > add file1 file2
Make node ./directory1
Files you want to restore are marked with an asterisk (*) for extraction.
If you extract a directory, all of the directory contents are marked for extraction.
In this example, two files are marked for extraction.
The ls command displays an asterisk in front of the selected file names, file1 and file2.
ufsrestore > ls
./directory1:
3904 *./ 2 *../ 3905 *file1 3906 *file2 3907 file3
6. To delete a file from the extraction list, use the delete command.
ufsrestore > delete file1
The ls command displays the file1 file without an asterisk.
ufsrestore > ls
./directory1:
3904 *./ 2 *../ 3905 file1 3906 *file2 3907 file3
7. To view the files and directories marked for extraction, use the marked
command.
ufsrestore > marked
./directory1:
3904 *./ 2 *../ 3906 *file2
8. To restore the selected files from the backup tape, perform the command:
ufsrestore > extract
Extract requested files
You have not read any volumes yet.
Unless you know which volume your file(s) are on you should start
with the last volume and work towards the first.
Specify next volume #: 1
extract file ./directory1/file2
Add links
Set directory mode, owner, and times.
set owner/mode for ‘.’? [yn] n
Answering y sets ownership and permissions of the temporary directory to those of the mount point on the tape.
9. To exit the interactive restore after the files are extracted, perform the
command:
ufsrestore> quit
10. Move the restored files to their original or permanent directory
location, and delete the files from the temporary directory.
# mv /export/home/tmp/directory1/file2 /export/home
# rm -r /export/home/tmp/directory1
Note – You can use the help command in an interactive restore to display a list of available commands.
Performing an Incremental Restore
The following procedure demonstrates how to restore the /export/home file system from incremental tapes.
Note – This procedure makes use of the interactive restore to assist in showing the concept of incremental restores. You would typically use a command, such as ufsrestore rf, for restoring entire file systems.
1. View the contents of the /etc/dumpdates file for information about
the /export/home file system.
# more /etc/dumpdates | grep c0t0d0s7
/dev/rdsk/c0t0d0s7 0 Wed Apr 07 09:55:34 2004
/dev/rdsk/c0t0d0s7 1 Web Apr 07 09:57:30 2004
2. Create the new file system structure for the /export/home file system.
# newfs /dev/rdsk/c0t0d0s7
3. Mount the file system and change to that directory.
# mount /dev/dsk/c0t0d0s7 /export/home
# cd /export/home
4. Insert the Level 0 backup tape.
5. Restore the /export/home file system from the backup tapes.
# ufsrestore rvf /dev/rmt/0
6. Load the next lower-level tape into the tape drive.
# ufsrestore rvf /dev/rmt/0
Alternative Steps
The following steps are an alternative to the previous Steps 5 and 6.
5. Restore the /export/home file system from the backup tapes. (This
example uses an interactive, verbose restore to provide more detailed
information.)
# ufsrestore ivf /dev/rmt/0
ufsrestore > ls
The system lists files from the last Level 0 backup.
ufsrestore > add *
ufsrestore > extract
Specify next volume #: 1
set owner/mode for ’.’? [yn] n
Directories already exist, set modes anyway? [yn] n
ufsrestore > q
#
6. The information in the /etc/dumpdates file shows an incremental
backup that was taken after the Level 0 backup. Load the next tape
and perform the incremental restore.
# ufsrestore ivf /dev/rmt/0
ufsrestore > ls
ufsrestore > add *
ufsrestore > extract
Specify next volume #: 1
set owner/mode for ’.’? [yn] n
ufsrestore > q
working directory, from backup tapes that were created by the ufsdump command.
The syntax for the ufsrestore command is:
ufsrestore option(s) argument(s) filesystem
The following procedure demonstrates how to use the ufsrestore command to restore the /export/home file system on the c0d1s7 slice.
1. Create the new file system structure.
# newfs /dev/rdsk/c0d1s7
2. Mount the file system to the /export/home directory, and change to that directory.
# mount /dev/dsk/c0d1s7 /export/home
# cd /export/home
3. Restore the entire /export/home file system from the backup tape.
# ufsrestore rf /dev/rmt/0
Note – Always restore a file system by starting with the Level 0 backup tape, continuing with the next-lower-level tape, and continuing through the highest-level tape.
4. Remove the restoresymtable file.
# rm restoresymtable
Remove the restoresymtable file when the restore is complete.
5. Unmount the new file system.
# cd /
# umount /export/home
6. Use the fsck command to check the restored file system.
# fsck /dev/rdsk/c0d1s7
7. Perform a full backup of the file system.
# ufsdump 0uf /dev/rmt/0 /dev/rdsk/c0d1s7
The ufsrestore command repositions the files and changes the inode allocation.
8. init 6
Using the ufsrestore Command to Restore a Critical File System
The following procedure demonstrates how to restore the /usr file system on Slice 6 of the boot disk.
1. Insert the Solaris 10 Software 1 CD-ROM or DVD, and boot from it with the single-user mode option.
ok boot cdrom -s
2. Create the new file system structure.
# newfs /dev/rdsk/c0t0d0s6
3. Mount the file system to the mount point /a, and change to that directory.
# mount /dev/dsk/c0t0d0s6 /a
# cd /a
4. Restore the entire /usr file system from the backup tape.
# ufsrestore rf /dev/rmt/0
5. Remove the restoresymtable file.
# rm restoresymtable
6. Unmount the new file system.
# cd /
# umount /a
7. Use the fsck command to check the restored file system.
# fsck /dev/rdsk/c0t0d0s6
8. Perform a full backup of the file system.
# ufsdump 0uf /dev/rmt/0 /dev/rdsk/c0t0d0s6
9. Reboot the system.
# init 6
Invoking an Interactive Restore
The following procedure demonstrates how to use the ufsrestore i command to extract individual files from a backup tape.
1. Become the root user, and change to the temporary directory that you want to receive the extracted files.
# cd /export/home/tmp
2. Perform the ufsrestore i command.
# ufsrestore ivf /dev/rmt/0
3. Display the contents of the directory structure on the backup tape.
ufsrestore > ls
.:
2 *./ 13 directory1 15 directory3 11 file2
2 *../ 14 directory2 10 file1 12 file3
4. Change to the target directory on the backup tape.
ufsrestore > cd directory1
ufsrestore > ls
./directory1:
3904 ./ 2 *../ 3905 file1 3906 file2 3907 file3
5. Add the files you want to restore to the extraction list.
ufsrestore > add file1 file2
Make node ./directory1
Files you want to restore are marked with an asterisk (*) for extraction.
If you extract a directory, all of the directory contents are marked for extraction.
In this example, two files are marked for extraction.
The ls command displays an asterisk in front of the selected file names, file1 and file2.
ufsrestore > ls
./directory1:
3904 *./ 2 *../ 3905 *file1 3906 *file2 3907 file3
6. To delete a file from the extraction list, use the delete command.
ufsrestore > delete file1
The ls command displays the file1 file without an asterisk.
ufsrestore > ls
./directory1:
3904 *./ 2 *../ 3905 file1 3906 *file2 3907 file3
7. To view the files and directories marked for extraction, use the marked
command.
ufsrestore > marked
./directory1:
3904 *./ 2 *../ 3906 *file2
8. To restore the selected files from the backup tape, perform the command:
ufsrestore > extract
Extract requested files
You have not read any volumes yet.
Unless you know which volume your file(s) are on you should start
with the last volume and work towards the first.
Specify next volume #: 1
extract file ./directory1/file2
Add links
Set directory mode, owner, and times.
set owner/mode for ‘.’? [yn] n
Answering y sets ownership and permissions of the temporary directory to those of the mount point on the tape.
9. To exit the interactive restore after the files are extracted, perform the
command:
ufsrestore> quit
10. Move the restored files to their original or permanent directory
location, and delete the files from the temporary directory.
# mv /export/home/tmp/directory1/file2 /export/home
# rm -r /export/home/tmp/directory1
Note – You can use the help command in an interactive restore to display a list of available commands.
Performing an Incremental Restore
The following procedure demonstrates how to restore the /export/home file system from incremental tapes.
Note – This procedure makes use of the interactive restore to assist in showing the concept of incremental restores. You would typically use a command, such as ufsrestore rf, for restoring entire file systems.
1. View the contents of the /etc/dumpdates file for information about
the /export/home file system.
# more /etc/dumpdates | grep c0t0d0s7
/dev/rdsk/c0t0d0s7 0 Wed Apr 07 09:55:34 2004
/dev/rdsk/c0t0d0s7 1 Web Apr 07 09:57:30 2004
2. Create the new file system structure for the /export/home file system.
# newfs /dev/rdsk/c0t0d0s7
3. Mount the file system and change to that directory.
# mount /dev/dsk/c0t0d0s7 /export/home
# cd /export/home
4. Insert the Level 0 backup tape.
5. Restore the /export/home file system from the backup tapes.
# ufsrestore rvf /dev/rmt/0
6. Load the next lower-level tape into the tape drive.
# ufsrestore rvf /dev/rmt/0
Alternative Steps
The following steps are an alternative to the previous Steps 5 and 6.
5. Restore the /export/home file system from the backup tapes. (This
example uses an interactive, verbose restore to provide more detailed
information.)
# ufsrestore ivf /dev/rmt/0
ufsrestore > ls
The system lists files from the last Level 0 backup.
ufsrestore > add *
ufsrestore > extract
Specify next volume #: 1
set owner/mode for ’.’? [yn] n
Directories already exist, set modes anyway? [yn] n
ufsrestore > q
#
6. The information in the /etc/dumpdates file shows an incremental
backup that was taken after the Level 0 backup. Load the next tape
and perform the incremental restore.
# ufsrestore ivf /dev/rmt/0
ufsrestore > ls
ufsrestore > add *
ufsrestore > extract
Specify next volume #: 1
set owner/mode for ’.’? [yn] n
ufsrestore > q
Performing File system Backup ( solaris 10 )
Strategies for Scheduled Backups
A full backup is a complete file system backup.
An incremental backup copies only files in the file system that have been added or modified since a previous lower-level backup.
Backups are often referred to as dumps.
Use dump level 0 to perform a full backup.
Use dump levels 1 through 9 to schedule incremental backups
# ufsdump 0S filesystem_name ==> to determine the size of the file system
to be backed up
or
# ufsdump 3S filesystem_name
S - size estimate
The /etc/dumpdates file records backups if the -u option is used with the ufsdump command.
# cat /etc/dumpdates
Backing Up an UNMOUNTED File System
/usr/sbin/ufsdump
The syntax for the ufsdump command is:
ufsdump option(s) argument(s) filesystem_name
Tape Back Ups
Perform the following steps to use the ufsdump command to start a tape backup:
1. Become the root user to change the system to single-user mode, and
unmount the file systems.
# /usr/sbin/shutdown -y -g300 “System is being shutdown for backup”
2. Verify that the /export/home file system was unmounted with the
shutdown command. If not, unmount it manually.
3. Check the integrity of the file system data with the fsck command.
# fsck /export/home
4. Perform a full (Level 0) backup of the /export/home file system.
# ufsdump 0uf /dev/rmt/0 /export/home
# ufsrestore tf /dev/rmt/0 ==> t - to list the table of contents of the backup media
# ufsrestore tvf /dev/rmt/0
Remote Backups to a Tape
To perform a backup on a remote tape device.
ufsdump options remotehost:tapedevice filesystem
To perform remote backups across the network, the system with the tape drive must have an entry in its /.rhosts file for every system that uses the tape drive.
The following example shows how to perform a full (Level 0) backup of the
/export/home file system on the host1 system, to the remote tape device on the host2 system.
# ufsdump 0uf host2:/dev/rmt/0 /export/home
User Creation and Remove commands in solaris 10
Creating User Accounts
To create a user account:
# useradd -u 100 -g other -d /export/home/newuser1 -m -s /bin/ksh -c
"Regular User Account" newuser1
# passwd newuser1
# /usr/sadm/bin/smuser add -- -n newuser2 -u 500 -g other -d
/export/home/newuser2 -c "Regular User Account 2" -s /bin/ksh -x
autohome=N
# passwd newuser2
Modifying User Accounts
To change the login name and home directory for newuser1 to usera.
# usermod -m -d /export/home/usera -l usera newuser1
To change the login name and home directory for newuser2 to userb.
# /usr/sadm/bin/smuser modify -- -n newuser2 -N userb -d /export/home/userb
Deleting User Accounts
# userdel usera ==> to remove the user account
# userdel -r usera ==> to remove both the users account & home directory
# /usr/sadm/bin/smuser delete -- -n userb ==> the users home directory should be deleted manually
Creating a Group Entry
# groupadd -g 301 class1
# /usr/sadm/bin/smgroup add -- -n workgroup -g 123 -m usera
Modifying a Group Entry
# groupmod -g 400 class1 ==> to change group ID
To change group name
# /usr/sadm/bin/smgroup modify -- -n workgroup -N schoolgroup
Deleting a Group Entry
# groupdel class1
# /usr/sadm/bin/smgroup delete -- -n schoolgroup
# vi /etc/default/passwd ==> to control the properties for all users’
passwords on the system:
# ls -l /usr/sadm/defadduser ==> to display default values for useradd
command
# useradd -D
# cat /usr/sadm/defadduser
To create a user account:
# useradd -u 100 -g other -d /export/home/newuser1 -m -s /bin/ksh -c
"Regular User Account" newuser1
# passwd newuser1
# /usr/sadm/bin/smuser add -- -n newuser2 -u 500 -g other -d
/export/home/newuser2 -c "Regular User Account 2" -s /bin/ksh -x
autohome=N
# passwd newuser2
Modifying User Accounts
To change the login name and home directory for newuser1 to usera.
# usermod -m -d /export/home/usera -l usera newuser1
To change the login name and home directory for newuser2 to userb.
# /usr/sadm/bin/smuser modify -- -n newuser2 -N userb -d /export/home/userb
Deleting User Accounts
# userdel usera ==> to remove the user account
# userdel -r usera ==> to remove both the users account & home directory
# /usr/sadm/bin/smuser delete -- -n userb ==> the users home directory should be deleted manually
Creating a Group Entry
# groupadd -g 301 class1
# /usr/sadm/bin/smgroup add -- -n workgroup -g 123 -m usera
Modifying a Group Entry
# groupmod -g 400 class1 ==> to change group ID
To change group name
# /usr/sadm/bin/smgroup modify -- -n workgroup -N schoolgroup
Deleting a Group Entry
# groupdel class1
# /usr/sadm/bin/smgroup delete -- -n schoolgroup
# vi /etc/default/passwd ==> to control the properties for all users’
passwords on the system:
# ls -l /usr/sadm/defadduser ==> to display default values for useradd
command
# useradd -D
# cat /usr/sadm/defadduser
Package administration in solaris 10
Administering Packages
pkgadd Installs software packages to the system
pkgrm Removes a package from the system
pkginfo Displays software package information
pkgchk Checks package installation state
pkgtrans Translates packages from one format to another
# more /var/sadm/install/contents ==> to list all installed software packages
# pkginfo | more ==> to display information about installed software packages
# pkginfo -l | more ==> to view additional information
# pkginfo -l SUNWman ==> to view information of a specific package
# pkginfo | wc -l ==> to find how many packages are currently installed
To view information about packages that are located on the DVD
# pkginfo -d /cdrom/cdrom0/s0/Solaris_10/Product | more
# pkginfo -d /cdrom/cdrom0/Solaris_10/Product | more
Checking a Package Installation
The pkgchk command checks to determine if a package has been installed on the system. If the pkgchk command does not display a message, it indicates the package was installed successfully and that no changes have been made
to any files or directories in the package.
# pkgchk SUNWladm ==> to check the contents & attributes of a currently installed package
# pkgchk -v SUNWladm ==> to list the files contained in a software package
# pkgchk -p /etc/shadow ==> to find if the contents & attributes of a file have changed since it was installed with its software package
# pkgchk -l -p /usr/bin/showrev ==> to list information about selected files that make up a package
# pkgchk -l -P showrev ==> to find if a particular file is installed & to find the directory in which it is located
If -p option is used, the full path must be typed to get information about the file. If -P option is used, a partial path name can be used.
Adding a Software Package from DVD
Example: To transfer the SUNWvts software package from CD-ROM & install it
# cd /cdrom/cdrom0/Solaris_10/ExtraValue/CoBundled/SunVTS_6.0/Packages
# pkgadd -d . SUNWvts
Adding Packages by Using a Spool Directory
The pkgadd command, by default, looks in the /var/spool/pkg directory for any packages specified on the command line.
The default directory for packages that have been spooled, but not installed is /var/spool/pkg.
To copy a package from the Solaris DVD into the /var/spool/pkg directory
# pkgadd -d /cdrom/cdrom0/s0/Solaris_10/Product -s spool SUNWauda
The -s option with the keyword spool copies the package into the /var/spool/pkg directory by default.
# ls -al /var/spool/pkg ==> to verify if the package exists in the spool directory
# pkgadd SUNWauda ==> to add the package from the spool area
# pkgrm -s spool SUNWauda ==> to remove a package from the spool area
To use an alternative spooling directory
# pkgadd -d /cdrom/cdrom0/s0/Solaris_10/Product -s /export/pkg SUNWauda
# pkgrm -s /export/pkg SUNWauda ==> to remove a package from the
spool directory
Removing a Software Package
Caution – Be cautious of the dependency warnings you receive when removing a package. The system allows you to remove these packages even though they may be required by a different package.
# pkgrm SUNWauda
PACKAGE FORMATS
File system (or Directory) format: Multiple files and directories.
A package (SUNWrsc) in file system format:
# ls -ld SUNWrsc
# cd SUNWrsc
# ls -l
Data stream format: Single file.
A package in data stream format:
# ls -l SUNWrsc.pkg
# file SUNWrsc.pkg
# head SUNWrsc.pkg
Translating Package Formats
To translate a package from file system format in /var/tmp to data stream format
# pkgtrans /var/tmp /tmp/SUNWrsc.pkg SUNWrsc
First argument is the directory where file system format package is stored. Second argument is the package data stream file.
Third argument is the package to translate.
If no package name is given a list of all packages in the directory is displayed
# pkgadd -d /tmp/SUNWrsc.pkg all ==> to install packages in a data
stream format
Example:
To create a data streamed package
# cd /cdrom/cdrom0/s0/Solaris*
# pkgtrans -s Product /var/tmp/stream.pkg SUNWzlib SUNWftpr SUNWftpu
# file /var/tmp/stream.pkg
# head -5 /var/tmp/stream.pkg
# pkgadd -d /var/tmp/stream.pkg
pkgadd Installs software packages to the system
pkgrm Removes a package from the system
pkginfo Displays software package information
pkgchk Checks package installation state
pkgtrans Translates packages from one format to another
# more /var/sadm/install/contents ==> to list all installed software packages
# pkginfo | more ==> to display information about installed software packages
# pkginfo -l | more ==> to view additional information
# pkginfo -l SUNWman ==> to view information of a specific package
# pkginfo | wc -l ==> to find how many packages are currently installed
To view information about packages that are located on the DVD
# pkginfo -d /cdrom/cdrom0/s0/Solaris_10/Product | more
# pkginfo -d /cdrom/cdrom0/Solaris_10/Product | more
Checking a Package Installation
The pkgchk command checks to determine if a package has been installed on the system. If the pkgchk command does not display a message, it indicates the package was installed successfully and that no changes have been made
to any files or directories in the package.
# pkgchk SUNWladm ==> to check the contents & attributes of a currently installed package
# pkgchk -v SUNWladm ==> to list the files contained in a software package
# pkgchk -p /etc/shadow ==> to find if the contents & attributes of a file have changed since it was installed with its software package
# pkgchk -l -p /usr/bin/showrev ==> to list information about selected files that make up a package
# pkgchk -l -P showrev ==> to find if a particular file is installed & to find the directory in which it is located
If -p option is used, the full path must be typed to get information about the file. If -P option is used, a partial path name can be used.
Adding a Software Package from DVD
Example: To transfer the SUNWvts software package from CD-ROM & install it
# cd /cdrom/cdrom0/Solaris_10/ExtraValue/CoBundled/SunVTS_6.0/Packages
# pkgadd -d . SUNWvts
Adding Packages by Using a Spool Directory
The pkgadd command, by default, looks in the /var/spool/pkg directory for any packages specified on the command line.
The default directory for packages that have been spooled, but not installed is /var/spool/pkg.
To copy a package from the Solaris DVD into the /var/spool/pkg directory
# pkgadd -d /cdrom/cdrom0/s0/Solaris_10/Product -s spool SUNWauda
The -s option with the keyword spool copies the package into the /var/spool/pkg directory by default.
# ls -al /var/spool/pkg ==> to verify if the package exists in the spool directory
# pkgadd SUNWauda ==> to add the package from the spool area
# pkgrm -s spool SUNWauda ==> to remove a package from the spool area
To use an alternative spooling directory
# pkgadd -d /cdrom/cdrom0/s0/Solaris_10/Product -s /export/pkg SUNWauda
# pkgrm -s /export/pkg SUNWauda ==> to remove a package from the
spool directory
Removing a Software Package
Caution – Be cautious of the dependency warnings you receive when removing a package. The system allows you to remove these packages even though they may be required by a different package.
# pkgrm SUNWauda
PACKAGE FORMATS
File system (or Directory) format: Multiple files and directories.
A package (SUNWrsc) in file system format:
# ls -ld SUNWrsc
# cd SUNWrsc
# ls -l
Data stream format: Single file.
A package in data stream format:
# ls -l SUNWrsc.pkg
# file SUNWrsc.pkg
# head SUNWrsc.pkg
Translating Package Formats
To translate a package from file system format in /var/tmp to data stream format
# pkgtrans /var/tmp /tmp/SUNWrsc.pkg SUNWrsc
First argument is the directory where file system format package is stored. Second argument is the package data stream file.
Third argument is the package to translate.
If no package name is given a list of all packages in the directory is displayed
# pkgadd -d /tmp/SUNWrsc.pkg all ==> to install packages in a data
stream format
Example:
To create a data streamed package
# cd /cdrom/cdrom0/s0/Solaris*
# pkgtrans -s Product /var/tmp/stream.pkg SUNWzlib SUNWftpr SUNWftpu
# file /var/tmp/stream.pkg
# head -5 /var/tmp/stream.pkg
# pkgadd -d /var/tmp/stream.pkg
Performing Mount and unmount
To view which file systems are currently mounted
# mount
# more /etc/mnttab
# df -h
Temporary mount
# mount /dev/dsk/c0d1s6 /directoryname
To mount a filesystem permanently
# vi /etc/vfstab
/dev/dsk/c0d1s6 /dev/rdsk/c0d1s6 /mountpoint ufs 2 yes -
:wq
Mount Options
syntax: mount -o option,option,... device_name mount_point
# mount -o ro,nosuid /dev/dsk/c0d1s6 /mountpoint
# mount -o noatime /dev/dsk/c0d1s6 /mountpoint
# mount -o nolargefiles /dev/dsk/c0d1s6 /mountpoint
# mountall ==> to mount all file systems listed in /etc/vfstab file
# mountall -l ==> to mount only local filesystems listed in /etc/vfstab file
Mounting Different Types of File Systems
# fstyp /dev/rdsk/c0d1s7 ==> to view a filesystem type
# mount -F hsfs -o ro /dev/dsk/c0d0s0 /cdrom ==> to mount a CD-ROM
To mount a file system that resides on a diskette when the Volume Management (vold) services are stopped
# mkdir /pcfs
# mount -F pcfs /dev/diskette /pcfs
Unmounting File Systems
# umount /export/home ==> unmount using directory mount point
# umount /dev/dsk/c0d1s7 ==> unmount using logicak disk device name
# umountall ==> to unmount all filesystems listed in /etc/mnttab file
# umountall -l ==> to unmount only local filesystems
The umountall unmounts all file systems specified in the vfstab file except
/ (root), /usr, /proc, /dev/fd, /var, /var/run, and /tmp.
Unmounting a Busy File System
# umount -f mountpoint ==> to force unmount a filesystem
# fuser -cu mountpoint ==> to list all processes accessing the filesystem
# fuser -ck mountpoint ==> to kill all processes accessing the file system
# fuser -c mountpoint ==> to verify if all processes are killed
# umount mountpoint
Restricting Access to Mounted Diskettes, CD-ROMs, or DVDs
# /etc/init.d/volmgt stop ==> to stop Volume Management (vold) service
# /etc/init.d/volmgt start ==> to start Volume Management service
# mount
# more /etc/mnttab
# df -h
Temporary mount
# mount /dev/dsk/c0d1s6 /directoryname
To mount a filesystem permanently
# vi /etc/vfstab
/dev/dsk/c0d1s6 /dev/rdsk/c0d1s6 /mountpoint ufs 2 yes -
:wq
Mount Options
syntax: mount -o option,option,... device_name mount_point
# mount -o ro,nosuid /dev/dsk/c0d1s6 /mountpoint
# mount -o noatime /dev/dsk/c0d1s6 /mountpoint
# mount -o nolargefiles /dev/dsk/c0d1s6 /mountpoint
# mountall ==> to mount all file systems listed in /etc/vfstab file
# mountall -l ==> to mount only local filesystems listed in /etc/vfstab file
Mounting Different Types of File Systems
# fstyp /dev/rdsk/c0d1s7 ==> to view a filesystem type
# mount -F hsfs -o ro /dev/dsk/c0d0s0 /cdrom ==> to mount a CD-ROM
To mount a file system that resides on a diskette when the Volume Management (vold) services are stopped
# mkdir /pcfs
# mount -F pcfs /dev/diskette /pcfs
Unmounting File Systems
# umount /export/home ==> unmount using directory mount point
# umount /dev/dsk/c0d1s7 ==> unmount using logicak disk device name
# umountall ==> to unmount all filesystems listed in /etc/mnttab file
# umountall -l ==> to unmount only local filesystems
The umountall unmounts all file systems specified in the vfstab file except
/ (root), /usr, /proc, /dev/fd, /var, /var/run, and /tmp.
Unmounting a Busy File System
# umount -f mountpoint ==> to force unmount a filesystem
# fuser -cu mountpoint ==> to list all processes accessing the filesystem
# fuser -ck mountpoint ==> to kill all processes accessing the file system
# fuser -c mountpoint ==> to verify if all processes are killed
# umount mountpoint
Restricting Access to Mounted Diskettes, CD-ROMs, or DVDs
# /etc/init.d/volmgt stop ==> to stop Volume Management (vold) service
# /etc/init.d/volmgt start ==> to start Volume Management service
Managing solaris os file system
Creating a New ufs File System
# newfs /dev/rdsk/c0d1s6 ==> to create a new filesystem
# fstyp -v /dev/rdsk/c0d1s6 | head ==> to view minfree value
# newfs -m 2 /dev/dsk/c0d1s6 ==> to set minfree value for a new filesystem
# tunefs -m 1 /dev/rdsk/c0d1s6 ==> to change minfree value on an existing file system
Checking the File System
Never run the fsck command on a mounted file system.
# fsck /dev/rdsk/c0d1s6 ==> to check an unmounted filesystem
# fsck /export/home ==> to check using the mount point directory
# fsck -o f,p /dev/rdsk/c0d1s6
f - forces a file system check
p - checks and fixes the file system noninteractively (preen). The
program exits immediately if a problem requiring intervention is found.
# fsck -o b=32 /dev/rdsk/c0d1s6 ==> to use a backup superblock
# newfs -N /dev/rdsk/c0d1s6 ==> to list the locations of all the alternative backup superblocks
N - to view the file system parameters without actually creating the file system
# fsck -o b=518432 /dev/rdsk/c0d1s6 ==> to use an alternative superblock number
# newfs -N -T /dev/rdsk/c1t3d0s7
T - allows the file system to be a multi-Terabyte file system
Monitoring File System Use
To display the capacity of file systems
# df -k ==> disk allocation in Kbytes
# df -h ==> human readable format
# df -k /dev/dsk/c0d1s6 ==> to view available space on a device
To display disk usage
# cd /opt
# du -k ==> disk usage in kilobytes
# du -h /opt | more ==> human readable format
# du -ak /opt ==> disk usage including files
# du -sk /opt ==> summary of disk usage
# quot -af ==> to display disk space used by users on all mounted file systems in kb
a - reports on all mounted file systems
f - number of files
# quot -f /dev/dsk/c0d1s6 ==> to display disk space used by users for a specific file system
# newfs /dev/rdsk/c0d1s6 ==> to create a new filesystem
# fstyp -v /dev/rdsk/c0d1s6 | head ==> to view minfree value
# newfs -m 2 /dev/dsk/c0d1s6 ==> to set minfree value for a new filesystem
# tunefs -m 1 /dev/rdsk/c0d1s6 ==> to change minfree value on an existing file system
Checking the File System
Never run the fsck command on a mounted file system.
# fsck /dev/rdsk/c0d1s6 ==> to check an unmounted filesystem
# fsck /export/home ==> to check using the mount point directory
# fsck -o f,p /dev/rdsk/c0d1s6
f - forces a file system check
p - checks and fixes the file system noninteractively (preen). The
program exits immediately if a problem requiring intervention is found.
# fsck -o b=32 /dev/rdsk/c0d1s6 ==> to use a backup superblock
# newfs -N /dev/rdsk/c0d1s6 ==> to list the locations of all the alternative backup superblocks
N - to view the file system parameters without actually creating the file system
# fsck -o b=518432 /dev/rdsk/c0d1s6 ==> to use an alternative superblock number
# newfs -N -T /dev/rdsk/c1t3d0s7
T - allows the file system to be a multi-Terabyte file system
Monitoring File System Use
To display the capacity of file systems
# df -k ==> disk allocation in Kbytes
# df -h ==> human readable format
# df -k /dev/dsk/c0d1s6 ==> to view available space on a device
To display disk usage
# cd /opt
# du -k ==> disk usage in kilobytes
# du -h /opt | more ==> human readable format
# du -ak /opt ==> disk usage including files
# du -sk /opt ==> summary of disk usage
# quot -af ==> to display disk space used by users on all mounted file systems in kb
a - reports on all mounted file systems
f - number of files
# quot -f /dev/dsk/c0d1s6 ==> to display disk space used by users for a specific file system
Managing Local disk devices (solaris 10)
To display a physical device name
# ls -l /dev/dsk/c0d1s0
# ls -l /dev/rdsk/c0d1s0
Instance names are abbreviated names assigned by the kernel for each device on the system. An instance name is a shortened name for the physical device name.
# cat /etc/path_to_inst ==> to view the physical name and instance name of devices
# prtconf ==> to display the system’s configuration information
# format ==> to display both logical and physical device names
Ctrl+d - to exit the format utility
Disk Partition Tables
# format
format> verify ==> to read a disks VTOC (Volume Table of Contents)
# prtvtoc /dev/dsk/c0d1s0 ==> to read a disks VTOC
# prtvtoc /dev/dsk/c0d1s2
Relabeling a Disk
# prtvtoc /dev/dsk/c0d1s2 > /var/tmp/c0d1.vtoc ==> to save a disk’s VTOC to a file
To relabel a disk
# fmthard -s /var/tmp/c0d1.vtoc /dev/rdsk/c0d1s2
To initialize the VTOC of a disk
# fmthard -s /dev/null /dev/rdsk/c0d1s2
# fdisk -W - /dev/rdsk/c0d1p0 ==> to view fdisk partition table details
# fdisk -W /var/tmp/c0d1p0 /dev/rdsk/c0d1p0 ==> to save fdisk partition details to a file
# fdisk -F /var/tmp/c0d1p0 /dev/rdsk/c0d1p0 ==> to restore fdisk partition table
Solaris Management Console
# smc & ==> to start Solaris Management Console
# /etc/init.d/init.wbem status ==> to determine if SMC server is running
# /etc/init.d/init.wbem stop ==> to stop the SMC server
# /etc/init.d/init.wbem start ==> to start the SMC server
# ls -l /dev/dsk/c0d1s0
# ls -l /dev/rdsk/c0d1s0
Instance names are abbreviated names assigned by the kernel for each device on the system. An instance name is a shortened name for the physical device name.
# cat /etc/path_to_inst ==> to view the physical name and instance name of devices
# prtconf ==> to display the system’s configuration information
# format ==> to display both logical and physical device names
Ctrl+d - to exit the format utility
Disk Partition Tables
# format
format> verify ==> to read a disks VTOC (Volume Table of Contents)
# prtvtoc /dev/dsk/c0d1s0 ==> to read a disks VTOC
# prtvtoc /dev/dsk/c0d1s2
Relabeling a Disk
# prtvtoc /dev/dsk/c0d1s2 > /var/tmp/c0d1.vtoc ==> to save a disk’s VTOC to a file
To relabel a disk
# fmthard -s /var/tmp/c0d1.vtoc /dev/rdsk/c0d1s2
To initialize the VTOC of a disk
# fmthard -s /dev/null /dev/rdsk/c0d1s2
# fdisk -W - /dev/rdsk/c0d1p0 ==> to view fdisk partition table details
# fdisk -W /var/tmp/c0d1p0 /dev/rdsk/c0d1p0 ==> to save fdisk partition details to a file
# fdisk -F /var/tmp/c0d1p0 /dev/rdsk/c0d1p0 ==> to restore fdisk partition table
Solaris Management Console
# smc & ==> to start Solaris Management Console
# /etc/init.d/init.wbem status ==> to determine if SMC server is running
# /etc/init.d/init.wbem stop ==> to stop the SMC server
# /etc/init.d/init.wbem start ==> to start the SMC server
Subscribe to:
Posts (Atom)