Archive for the ‘Linux OS’ Category

Working With Directories And Files in Solaris

January 10th, 2021, posted in Solaris
Share

Working with Files and DirectoriesAdd A User From The Command Line In Solaris,Add A User From The Command Line In Solaris 10,Add A User From The Command Line, In Solaris10 ,Add A User ,The Command Line In Solaris10,The Command Line In Solaris,solaris 10,

Working with Files and Directories is very basic thing which we dont want to miss while learning Solaris 10. Lets check few very basic commands.

To display the current working directory:

pwd command: It displays the current working directory.

example:
#pwd
/export/home/immam

To display contents of a  directory:

ls command (Listing Command): It displays all files and directories under the specified directory.
Syntax: ls -options <DirName>|<FileName>
The options are discussed as follows:

Option
Description
p It lists all the files & directories. The directory names are succeeded by the symbol ‘/’
F It lists all files along with their type. The symbols ‘/’, ‘*’, (None), ‘@’ at the end of file name represents directory, executable, Plain text or ASCII file & symbolic link respectively
a It lists all the files & directories name including hidden files
l It lists detailed information about files & directories
t It displays all the files & directories in descending order of their modified time.
r It displays all the files & directories in reverse alphabetical order
R It displays all the files & directories & sub-directories in recursive order
i It displays the inode number of  files & directories
tr It displays all the files & directories in the ascending order of their last modified date
Analysis of output of ls -l command:
ls -l → It list all the files and directories long list with the permission and other information. The output looks as follows:
FileType & Permissions LinkCount UID GID Size Last ModifiedDate & ModifiedTime <File/Directory Name>
Following table explains the output:
Entry
Description
FileType ‘-‘ for file & ‘d’ for directory
Permissions Permissions are in order of Owner, Group & Other
LinkCount Number of links to the file
UID Owner’s User ID
GID Group’s ID
Size Size of the file/directory
Last ModifiedDate & ModifiedTime Last Modified Date & Time of the file/directory
<File/Directory Name> File/Directory name
Example:
# ls -l
total 6
-rw-r–r–   1 root     root        136 May  6  2010 local.cshrc
-rw-r–r–   1 root     root        167 May  6  2010 local.login
-rw-r–r–   1 root     root        184 May  6  2010 local.profile

Understanding permissions:

Following table explains the permission entry:

Entry
Description
No permission/denied
r read permission
w write permission
x execute permission

File Command: It is used to determine the file type. The output of file command can be “text”, “data” or “binary”.
Syntax: file <file name>
Example: 
# file data
data: English text

Changing Directories: ‘cd’ commad is used to change directories.
Syntax: cd <dir name>
If cd command is used without any option it changes the directory from current working directory to user’s home directory.


Example: Let the user be ‘ravi’ and current working directory is /var/adm/messages#pwd
/var/adm/messages
#cd
#pwd
#/export/home/raviThere is also a different way to navigate to the user’s home directory :
#pwd
/var/adm/messages
#cd ~ravi
#pwd
/export/home/ravi
#cd ~raju
#pwd
/export/home/raju
#cd ~ravi/dir1
#pwd
/export/home/ravi/dir1In the above examples, the ‘~’ character is the abbreviation that represents the absolute path of the user’s home directory. However this functionality is not available in all shells.There are few other path name abbreviations which we can use as well. These are listed below :
.  → current working directory
.. → Parent directory or directory above the current working  directory.
So if we want to go to the parent directory of the current working directory following command is used:
#cd ..We can also navigate multiple levels up in directory using cd, .. and /.
Example: If you want to move two levels up the current working directory, we will use the command :
#cd ../..
#pwd
/export/home/ravi
#cd ../..
#pwd
/export
#cd ..
#pwd
/

Viewing the files:

cat command: It displays the entire content of the file without pausing.
Syntax: cat <file name>
Example:
#file data
data: English text
#cat data
This is an example for demonstrating the cat command.
#
Warning: The cat command should not be used to open a binary file as it will freeze the terminal window and it has to be closed. So check the file type using ‘file’ command, if you are not sure about it.more command: It is used to view the content of a long text file in the manner of one screen at a time.
Syntax: more <file name>The few scrolling options used with more command are as follows :

Scrolling Keys
Action
Space Bar Moves forward one screen
Return Scrolls one line at a time
b Moves back one screen
h Displays a help menu of features
/string searches forward for a pattern
n finds the next occurrence of the pattern
q quits and returns to shell prompt



Head and Tail command in UNIX/LINUX/SOLARIS:
head command: It displays the first 10 lines of a file by default. The number of lines to be displayed can be changed using the option -n. The syntax for the head command is as follows:
Syntax: head -n <file name>
This displays the first n lines of the file.

tail command: It displays the last 10 lines of a file by default. The number of lines to be displayed can be changed using the options -n or +n.
Syntax: 
#tail -n <file name>
#tail +n <file name>
The -n option displays the n lines from the end of the file.
The +n option displays the file from line n to the end of the file.


Displaying line, word and character count:
wc command: It is used to display the number of lines, words and characters in a given file.
Syntax: wc -options <file name>

The following option can be used with wc command:

Option
Description
l Counts number of lines
w Counts number of words
m Counts number of characters
c Counts number of bytes
Example: 
#cat data
This is an example for demonstrating the cat command.
#wc -w data
9

Copying Files: 

cp command: It can be used to copy file/files.
Syntax:cp -option(s) surce(s) destination
The options for the cp command are discussed below :
Option
Description
i Prevents the accidental overwriting of existing files or directories
r Includes the contents of a directory, including the contents of all sub-directories, when you copy a directory
Example:
#cp file1 file2 dir1
In the above example file1 and file2 are copies to dir1.

Moving & renaming files and directories: 

mv command: It can be used to

1. Move files and directories within the directory hierarchy :
Example: We want to move file1 and file2 under the directory /export/home/ravi to /var
#pwd
/export/home/ravi

#mv file1 file2 /var

2. Rename existing files and directories.
Example: we want to rename file1 under /export/home/ravi to file2.
#pwd
/export/home/ravi

#mv file1 file2

The mv command does not affect the contents of the files or directories being moved or renamed.

We can use -i option with the mv command to prevent the accidental overwriting of the file.

Creating files and directories :

touch Command : It is used to create an empty file. We can create multiple file using this command.
Syntax: touch <files name>
Example: #touch file1 files2 file3

mkdir command : It is used to create directories.
Syntax: mkdir -option <dir name>

When the <dir name> includes a pah name, option -p is used to create all non-existing parent directory.

Example:
#mkdir -p /export/home/ravi/test/test1

Removing Files and Directories :

rm command: It is used permanently remove files/directories.

 Syntax: rm -option <file name>/<dir name>

The -i option is used to prompt user for confirmation before the deletion of files/directories.

Example: We want to remove file1 and file2 from the home directory of user ravi.
#pwd
/
#cd ~ravi
#pwd
/export/home/ravi
#rm file1 file2
Note: The removal of a directory is slightly different. If the directory is not empty and you are trying to delete it, you will not be able to do so. You need to use -r option to remove the directory with files and sub-directories.
Example: We want to delete a directory test under user ravi home directory and it contains file and sub-directories.
#pwd
/export/home/ravi
#rm test
rm: test is a directory
#rm -r test

#

To remove an empty directory:
Syntax: rmdir <directory name>


Links (Soft Link and Hard Link) : This section has been covered under section :Solaris File System. Please refer to it.

Searching Files, Directories & its contents:

Using the grep command : The grep is very useful and widely used command.
lets take an example where we want to see if the process statd is running of not. Following command is used :
#ps -ef | grep statd

# ps -ef | grep statd
daemon  2557     1   0   Jul 07 ?           0:00 /usr/lib/nfs/statd
root 10649  1795   0 05:29:39 pts/4       0:00 grep statd
#
Syntax: grep options filenames.
The options used are discussed below :

i Searches both uppercase and lowercase characters
l Lists the name of files with matching lines
n Precedes each line with the relative line number in the file
v Inverts the search to display lines that do not match pattern
c Counts the lines that contain pattern
w Searches for the expression as acomplete word, ignoring those matches that are sub strings of larger words

Lets see few examples:
Suppose we want to search for all lines that contain the keyword root in /etc/group file and view their line numbers, we use following option :
# grep -n root /etc/group
1:root::0:
2:other::1:root
3:bin::2:root,daemon
4:sys::3:root,bin,adm
5:adm::4:root,daemon
6:uucp::5:root
7:mail::6:root
8:tty::7:root,adm
9:lp::8:root,adm
10:nuucp::9:root
12:daemon::12:root

To search for all the lines that does not contain the keyword root:
# grep -v root /etc/group
staff::10:
sysadmin::14:
smmsp::25:
gdm::50:
webservd::80:
postgres::90:
unknown::96:
nobody::60001:
noaccess::60002:
nogroup::65534:
cta::101:
rancid::102:
mysql::103:
torrus::104:

To search for the names of the files that contains the keyword root in /etc directory :
# cd /etc
# grep -l root group passwd hosts
group
passwd

To count the number of lines containing the pattern root in the /etc/group file:
# grep -c root group
11

Using regular expression Metacharacters with grep command:

Metachar Purpose Example Result
^ Begining of line Anchor ‘^test’ Matches all lines begining with test
$ End of line anchor ‘test$’ Matches all the lines ending with test
. Matches one char ‘t..t’ Matches all the line starting and ending with t and 2 char between them
* Matches the preceding item 0 or more times ‘[a-s]*’ Matches all lines starting with lowercase a-s
[] Matches one character in the pattern ‘[Tt]est’ Matches lines containing test ot Test
[^] Matches one character not in pattern ‘[^a-s]est’ Matches lines that do not contain “a” though “s” and followed by est
Using egrep command : 

With egrep we can search one or more files for a pattern using extended regular expression metacharacters.

Following table describes the Extended Regular Expression Metacharacters :
Metachar
Purpose
Example
Result
+ Matches one of more preceding chars ‘[a-z]+est’ Matches one or more lowercase letters followed by est(for example chest, pest, best, test, crest etc
x|y Matches either x or y ‘printer|scanner’ Matches for either expression
(|) Groups characters ‘(1|2)+’ or ‘test(s|ing)’ Matches for one or more occurrence.
Syntax: egrep -options pattern filenames
Examples:
#egrep ‘[a-z]+day’ /ravi/testdays
sunday
monday
friday
goodday
badday
In the above example, we searched for the letter ending with day in the file /ravi/testdays#egrep ‘(vacation |sick)’ leave’ /ravi/leavedata
vacation leave on 7th march
sick leave on 8th march
In the above example we are displaying sick leave and vacation leave from file /ravi/leavedataUsing fgrep command :
It searches for all the character regardless of it being metacharacter as we have seen in case of grep and egrep commands.
Syntax: fgrep options string filenames
Example:
#fgrep ‘$?*’ /ravi/test
this is for testing fgrep command $?*
#Using Find command :
This command is used to locate files and directories. You can relate it with windows search in terms of functionality.
Syntax: find pathnames expressions actionsPathname: The absolute or relative path from where the search begins.Expressions: The search criteria is mentioned here. We will discuss search criteria below in details.

Expression
Definition
-name filename Finds the file matching.
-size [+|-]n Finds files that are larger than +n, smaller than -n, or exactly n.
-atime [+|-]n Find files that have been accessed more than +n days, less than -n or exactly n days ago.
-mtime [+|-]n Find files that have been modified more than +n days, less than -n or exactly n days ago.
-user loginID Finds all files that are owned by the loginID name.
-type Finds a file type : f for file, d for directory.
-perm Find files that have certain access permission bits.

Action: Action required after all the files have been found. By default it displays all the matching pathnames

Action
Definition
-exec command {} \; Runs the specified command on each file located.
-ok commadn {} \:
Requires confirmation before the find command applies the command to each file located.
-print Prints the search result
-ls Displays the current pathname and associated stats : inode number, size in kb, protection mode, no. of hard links and the user.
-user loginID Finds all files that are owned by the loginID name.
-type Finds a file type : f for file, d for directory.
-perm Find files that have certain access permission bits.

Examples:
#touch findtest
#cat >> findtest
This is for test.
#find ~ -name findtest -exec cat {} \;
This is for test.
#
The above examples searches for the file : findtest and displays its content. We can also use ‘ok’ option instead of exec. This will prompt for confirmation before displaying the contents of file findtest.

If we want to find files larger than 10 blocks (1 block = 512bytes) starting from /ravi directory, following command is used :
#find /ravi -size +10

If we want to see all files that have not been modified in the last two days in the directory /ravi, we use :
#find /ravi -mtime +2


Printing Files:

lp comand : This command is located in /usr/bin directory. It is used to submit the print request to the printer.
Syntax:
/usr/bin/lp <file name>

/usr/bin/lp -d <printer name > <file name>

The options for the lp command are discussed below :
Option
Description
d It is used to specify the desired printer. It is not required if default printer is used
o It is used to specify that the banner page should not be printed
n Print the number of copies specified
m It send email after the print job is complete
lpstat command : It displays the status of the printer queue.  The Syntax for this command is as follows:
lpstat -option <printer name>
The options for the lpstat command are discussed below :
Option
Description
p Displays the status of all printers
o Displays the status of all output printers
d Displays the default system printer
t Displays the complete status information of all printers
s Display the status summary of all printers
a Displays which printers are accepting request
The output of the lpstat command is in the following format :
<request ID> <user ID> <File Size> <Date & Time> <status>
Cancel command : It is used to cancel the print request.
Syntax:
cancel <request ID>
cancel -u <user name>
Note: We can use lpstat command to get the request ID.
Share

Getting Started with Solaris 10

December 28th, 2020, posted in Solaris
Share

Must to know keywords: Before kick starting the SOLARIS study lets be aware of few important keywords and FACTS about the SOLARIS OS.

Process: A process is a program running or being executed on the computer.Every process has a unique identifier number known as process ID.

Daemon: This would be something new to Window’s user. A daemon is also a process which often runs continuously as long as the system is up.This daemons runs in background. The daemons starts when the system starts and ends with the shutdown.

Kernel: Kernel is the heart of operating system. Its the core defining program for the Operating system.

Shell:
Shell is the program through which a user interacts with the kernel. It acts as a wrapper between the user and kernel.When a user issues a command on the shell, the shellgoes to kernel and gets back the required information to the user.Shell Script: We can write a series of shell command in a file and execute them. This file is known as shell script.


A brief Introduction to SOLARIS OS:
Solaris from SUN Microsystems, founded in February 1982 by Bill Joy (among others), who was previously involved in the development of BSD 4.1. It was the improved version of BSD 4.1 that was released by SUN as SunOS in 1983. It was based on SPARC (Scalable Processor Architecture).

In the year 1996 the Sun Solaris was introduced both for the SPARC and X86 based architecture. It had both CDE (Common Desktop Environment and JDS (Java Desktop System).
Difference b/w SPARC and X86 based machines:
SPARC
X86
It uses RISC (Reduced Instruction Set Computing) It uses CISC (Complex Instruction Set Computing)
It uses SCSI(Smaller Computing System Interface). The benefits of SCSI are: 1. Increase performance
2. Increase data availability
3. Hot Swappable
It uses IDE(Integrated Device Electronic)
Types of Chips in SPARC
  1. PROM (Programmable Read Only Memory)It is an 8kb chip which is non-pluggable. It understands only hardware commands & it does not understand OS related commands. The main purpose of PROM chip is to configure the system h/w and to set boot priorities.To go to Open Boot Prompt (OBP) or OK prompt: press STOP (key) + A
  1. NV RAM (Non-Volatile RAM chip)It is also a chip which is pluggable but it contains unique hardware ID which cannot duplicate to other machines.
    NV RAM chips contains complete information about the PROM chip like:
  1. Prom release and version
  2. Host ID
  3. MAC Address
  4. RAM size
Different releases of SOLARIS:
SOLARIS 10 beta released in the year 2004
SOLARIS 10 OEM released in the year 2005
SOLARIS 10 New features released in the year 2006
SOLARIS 11 was released in the year 2011
New Features in SOLARIS 10
  1. Zones: It is nothing but virtual OS something like virtual OS under Vmware. The main purpose of ZONES is to reduce the h/w costs and to utilize the CPU and hardware resource effectively. SOLARIS supports maximum 8192 virtual OS. We can install only SOLARIS OS in virtual OS.
  2. SMF: The main purpose of it is to increase the performance of the server by enabling the services which we required and by disabling the services which we don’t require.
  3. ZFS: It is advance file system which supports maximum 16 Exabytes. It is OS dependent.

Logging into Solaris Desktop Environment:
When a user logins into the Solaris Desktop environment, the login screen appears have following fields:
username:
help:
options:
Start Over:
Ok
Various login options: 
When a user selects the options button at login screen, a list with menu appears:
Language: It is used to change the language option.
Session
CDE (Common Desktop Environment)
Java Desktop System, Release 3
User’s Last Desktop: It displays the desktop used at the end of                                                                                             previous session.
Failsafe session: It displays the terminal window instead of starting a desktop session. This can be used when a user has trouble login in single X-terminal window. It is available even when command line logging option is not available.
Remote Login: It is used to connect to remote system.
Enter Host Name …
Choose Host List
Command line login : 
This is used to work in UNIX command environment. Type exit to get out of the command line environment. The desktop login screen re-appears after 30 seconds.
Reset login screen
It is used to reset desktop environment login screen.
Changing User Password:
In Solaris OS, the user password must have following characteristics:
1. Password length: 6-8 characters in length.
2. It contains at least 2 alphabetic characters & must contain at least one numeric or special character such as semicolon(;), an asterisk(*), or a dollar sign($).
3. Differ from the user’s login name.
4. Differ from previous password by at least three characters
5. Contain spaces(optional)
6. Not to be reverse of the user’s login name.
Note: The above password requirements do not apply to the system administrator’s root account.
To change the password perform following steps:
1. Run the passwd command.
2. Type the existing password at the Enter existing password prompt.
3. Type the new password at the new password prompt.
4. Re-enter the new password again at the Re-enter new password prompt.
Securing Desktop Environment session:
1. Locking screen: click Launch -> Lock Screen.
2. Exiting session:Click Launch -> Log out -> OK
Customizing desktop session:
To change desktop background:
Launch -> Preferences -> Desktop Preferences -> Display
To customize workspace:
Move mouse to Workspace switcher area in front of pannel -> Right click on workspace –> Select preferences 
Managing files:
Double click on Documents icon on desktop
Launch -> Open Recent -> Open Documents Folder

Using Online Documentation:
The Online reference manual(man) pages provide detailed descriptions if Solaris commands and how to use them. It explains detained information about the usage of an command.
Syntax: man options command
Example:# man ls

The above example gives detailed information about the ls command.

Scrolling in man pages:
Scrolling Keys
Action
Space bar Displays the next screen of a man page
Return Displays the next line of a man page
b Moves back one full screen
/pattern Searches forward for a pattern
n Finds the next occurrence of pattern after /pattern command is used
h Provides description of all scrolling capabilities
q Quits the man page and returns to shell
Searching man pages:

man intro 
It is used to view descriptive information about sections contained in the man pages.
man -s number <command>|<filename>

This is used for looking a specific section of man pages .

man -l command

This is used to list the man pages that relate to the same command.

man -k keyword
It searches all the man pages containing the keyword specified.
Example:
man -k clear
The above command finds the man page that contains the keyword ‘clear’.

man -M path
Specify an alternate manpath to use. By default, man uses manpath derived code to determine the path to search. This option overrides the $MANPATH environment variable and causes option -m to be ignored.

Preformatted man pages:

The catman command is used to create preformatted man pages, which is faster to access, however they occupy more space.  catman  makes  use of the index database cache(windex) associated with each hierarchy to determine which files need to be formatted.
#catman -w
The above command configures windex database for man pages.

The online product documentation can be found from the link:

Few FAQs : You may skip this section if not interested.
DMP(Dynamic Multipathing)
This is miscellaneous information and you can skip if not interested. In computer data storage technology field, dynamic multipathing (DMP) is a multipath I/O enhancement technique that balances input/output (I/O) across many available paths from the computer to the storage device to improve performance and availability. The name was introduced with Veritas Volume Manager software.
The DMP utility does not take any time to switch over, although the total time for failover is dependent on how long the underlying disk driver retries the command before giving up.
IDE Controller (Integrated Device Controller):
The IDE controller is used mostly in X86 based system.
There can be maximum two IDE controller attached to a Motherboard with each port being able to control two IDE devices, for a total of four. So totally 4 device can be connected via IDE Controller in a system.
Following example explains the same:
c0d0 – Primary Master
c0d1 – Primary Slave
c1d0 – Secondary Master
c1d1 – Secondary Slave
There can be maximum of 10 slices in an x-86 based machine. Following example illustrate the same:
c0d0s0, c0d0s1,………c0d0s9
c0d1s0, c0d1s1,………c0d1s9
c1d0s0, c1d0s1,………c1d0s9
c1d1s0, c1d1s1,………c1d1s9
Note: ‘c’ refers to controller, ‘d’ refers to disk and ‘s’ refers to slice.
SCSI Controller (Small Computing System Interface):
There are three types of SCSI controller:
1. Narrow SCSI
It supports maximum of 7-device and only 8 slices
Example:         c0t0d0s0, c0t0d0s1,……….c0t0d0s7
                        c0t1d0s0, c0t1d0s,………… c0t1d0s7
                        .
                        .
                        .
                        c0t6d0s0, c0t6d0s1,……….. c0t6d0s7
Note: ‘t’ refers to target.
2. Wide SCSI & 3. Ultra SCSI
It supports maximum of 15 devices and 8 logical partitions.
The difference between Wide & Ultra SCSI is that the performance is better in Ultra SCSI.
Share

Creating Partition Space In Sun Solaris 10

November 3rd, 2019, posted in Solaris
Share

Open  console and start with this :Oracle Database,DBA immam,DBA imam,oracle issues,oracle database,oracle clone issues,oracle clone,oracle autoconfig,oracle autoconfig issues

bash-3.00# format

It gives the following output.

Searching for disks…done
AVAILABLE DISK SELECTIONS:
0. c0d0 <DEFAULT cyl 2085 alt 2 hd 255 sec 63>
/pci@0,0/pci-ide@1,1/ide@0/cmdk@0,0
Specify disk (enter its number):


Check out, AVAILABLE DISK SELECTIONS. Now, I have only one disk (c0d0). Select the ‘0’ (Zero) no. disk to make partitioned in it.

Specify disk (enter its number): 0

It will give the following output.

selecting c0d0
Controller working list found
[disk formatted, defect list found]
Warning: Current Disk has mounted partitions.
/dev/dsk/c0d0s0 is currently mounted on /. Please see umount(1M).
/dev/dsk/c0d0s1 is currently used by swap. Please see swap(1M).
/dev/dsk/c0d0s3 is currently mounted on /mytest. Please see umount(1M).
FORMAT MENU:
disk          – select a disk
type         – select (define) a disk type
partition – select (define) a partition table
current    – describe the current disk
format     –  format and analyze the disk
fdisk         – run the fdisk program
repair      – repair a defective sector
show       – translate a disk address
label       – write label to the disk
analyze – surface analysis
defect    – defect list management
backup   – search for backup labels
verify     – read and display labels
save        – save new disk/partition definitions
volname – set 8-character volume name
!<cmd> – execute <cmd>, then return
quit
format>

Now enter ‘p’ (Partition) to initiate partitioning procedure in it.

format> p

It will give following output :

PARTITION MENU:
0 – change `0′ partition
1 – change `1′ partition
2 – change `2′ partition
3 – change `3′ partition
4 – change `4′ partition
5 – change `5′ partition
6 – change `6′ partition
7 – change `7′ partition
select – select a predefined table
modify – modify a predefined partition table
name – name the current table
print – display the current table
label – write partition map and label to the disk
!<cmd> – execute <cmd>, then return
quit
partition>

To see existing partitions, issue ‘p’ (print).

partition> p

It will give following output.

Current partition table (original):
Total disk cylinders available: 2085 + 2 (reserved cylinders)

Part      Tag     Flag      Cylinders         Size               Blocks
0       root    wm       3 – 1308       10.00GB          (1306/0/0)     20980890
1       swap    wu    1309 – 1570        2.01GB          (262/0/0)       4209030
2     backup    wm       0 – 2084       15.97GB         (2085/0/0)    33495525
3 unassigned    wu    1571 – 1672      800.11MB    (102/0/0)   1638630
4 unassigned    wm                     0               0                      (0/0/0)           0
5 unassigned    wm                     0               0                      (0/0/0)           0
6 unassigned    wm                     0               0                      (0/0/0)           0
7 unassigned    wm                     0               0                      (0/0/0)           0
8       boot    wu                          0 –    0        7.84MB    (1/0/0)       16065
9 alternates    wu                     1 –    2       15.69MB    (2/0/0)       32130

partition>

Checkout the table. No 0, 1, 2,8 and 9 is not usable. no. 3 is not usable as already created a partition there. 4,5,6 and 7 is available to make partition. So, I have selected 4.

partition> 4

It will give following output :

Part      Tag           Flag     Cylinders        Size            Blocks
4 unassigned    wm       0               0         (0/0/0)           0

Enter partition id tag[unassigned]:

Keep partition id and permission flags empty.

Enter partition id tag[unassigned]:
Enter partition permission flags[wm]:
Enter new starting cyl[0]:

Now, check previous partition of no. 4. It is number 3. Its Cylinders count ended at 1672. So, we will start from 1673. (If there is no no. 3 that i created previously, then we would have look for part no. 1. Not 2, because it is not usable, it represents whole disk size).

Now enter 1673

Enter new starting cyl[0]: 1673

and partition size 500mb.

Enter partition size[0b, 0c, 1673e, 0.00mb, 0.00gb]: 500mb

Now enter ‘label’ to confirm your partition.

partition> label
Ready to label disk, continue? y

Now, again see your partitioning summary.

partition> p
Current partition table (unnamed):
Total disk cylinders available: 2085 + 2 (reserved cylinders)

Part      Tag     Flag      Cylinders         Size               Blocks
0       root    wm       3 – 1308       10.00GB          (1306/0/0)     20980890
1       swap    wu    1309 – 1570        2.01GB          (262/0/0)       4209030
2     backup    wm       0 – 2084       15.97GB         (2085/0/0)    33495525
3 unassigned    wu    1571 – 1672      800.11MB    (102/0/0)   1638630
4 unassigned      wm    1673 – 1736     502.03MB   (64/0/0) 1028160
5 unassigned    wm                     0               0                      (0/0/0)           0
6 unassigned    wm                     0               0                      (0/0/0)           0
7 unassigned    wm                     0               0                      (0/0/0)           0
8       boot    wu                          0 –    0        7.84MB    (1/0/0)       16065
9 alternates    wu                     1 –    2       15.69MB    (2/0/0)       32130

Well, its done.

Now, issue ‘q’ to exit partition and again ‘q’ to exit format.

partition> q
FORMAT MENU:
disk – select a disk
type – select (define) a disk type
partition – select (define) a partition table
current – describe the current disk
format – format and analyze the disk
fdisk – run the fdisk program
repair – repair a defective sector
show – translate a disk address
label – write label to the disk
analyze – surface analysis
defect – defect list management
backup – search for backup labels
verify – read and display labels
save – save new disk/partition definitions
volname – set 8-character volume name
!<cmd> – execute <cmd>, then return
quit
format> q
bash-3.00#

Then, format file system.

bash-3.00# newfs /dev/rdsk/c0d0s4

Result :

bash-3.00# newfs /dev/rdsk/c0d0s4
newfs: construct a new file system /dev/rdsk/c0d0s4: (y/n)? y
Warning: 4032 sector(s) in last cylinder unallocated
/dev/rdsk/c0d0s4:           1028160 sectors in 168 cylinders of 48 tracks, 128 sectors
502.0MB in 13 cyl groups (13 c/g, 39.00MB/g, 18624 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 80032, 160032, 240032, 320032, 400032, 480032, 560032, 640032, 720032,
800032, 880032, 960032

Now, we have to mount this partition.

Create a directory in root directory.

bash-3.00# cd /
bash-3.00# mkdir oracle

Our partition is at ‘/dev/dsk/c0d0s4’. We will mount it to previously created oracle directory.

bash-3.00# mount /dev/dsk/c0d0s4 /oracle

Check newly created partition.

bash-3.00# cd /oracle/
bash-3.00# ls
lost+found
bash-3.00# df -h
Filesystem                         size   used  avail capacity  Mounted on
/dev/dsk/c0d0s0        9.9G   3.4G   6.4G    35%    /
/devices                             0K     0K     0K     0%    /devices
ctfs                                 0K     0K     0K     0%    /system/contract
proc                                 0K     0K     0K     0%    /proc
mnttab                               0K     0K     0K     0%    /etc/mnttab
swap                               2.3G   548K   2.3G     1%    /etc/svc/volatile
objfs                                0K     0K     0K     0%    /system/object
sharefs                              0K     0K     0K     0%    /etc/dfs/sharetab
fd                                   0K     0K     0K     0%    /dev/fd
swap                               2.3G   136K   2.3G     1%    /tmp
swap                               2.3G    32K   2.3G     1%    /var/run
/dev/dsk/c0d0s3        752M   1.0M   698M     1%    /mytest
/dev/dsk/c0d0s4        472M   1.0M   424M     1%    /oracle
bash-3.00#

To make it permanent. you need to edit the file ( /etc/vfstab ) {stands for Virtual File System Table} using command:

vi /etc/vfstab

now : enter your new partition information in the last line device to mount device

/dev/dsk/c0d0s4 /dev/rdsk/c0d0s4 /oracle ufs 1 yes –
Share