Saturday 30 April 2011

User Administration

User Administration:
Two Types
1. Users           2. Groups
1. User:  user creation, types, syntax checkout on next post...
2. Group: It is a collection of users who can share the files and other system resources.
group consist of
1. Group Name
2. Group ID &
3. List of users in the group

when you create a group, by default one file gets updated automatically. i.e.
/etc/group


types of group:
1. primary group: It is a group to which the user must belong to without primary group we cannot create a user.
The user cannot have more than one primary group.
2. secondary group: It is a group to which the user can also belong to and the user can belong to 16 secondary groups.

Group ID: There are two different types of group ID's from 0-99 are system defined and 100-60,000 are user defined.
Note:
1. When you create a group we need to specify the group name and group ID.
2. Whereas 'group name' for administration reference and 'group id' for kernel reference.
3. group id's over 60,000 will not be having full functionalities.

Syntax to create a group:
# groupadd -g <gid> <group name>
ex: groupadd -g 777 sona
// sona group created with '777 group id'. when a group create /etc/group defaultly updated.

# cat /etc/group                  // to see the group details

We can create without '-g':
# groupadd gramsci                 //here gid=1010, because already highest value gid=1009 assigned
# groupadd hi
# groupadd -g 2000 hey            // now what is gid = 2000
# groupadd bye                         //now gid= 2001, because highest value gid is 2000

Note: When you create a group with specifying gid it will take the increment value of the highest user assigned gid.












UFS Architecture



UFS (Unix File System) Architecture:














1. Volume Table of Content (VTOC):
  • It always resides in the sector '0'.
  • Its capacity is 512 bytes 
  • It contains the information about
            i. Disk Label
            ii. No. of assigned slices
            iii. Amount of space allocated for slice

2. Primary Boot Block (PRB):
This boot block contains the boot strap program which is nothing but a bootable file and It always resides to a sector 1 to 15.

3. Secondary Boot Blocks (SBB):
As primary boot block contains the important data, so it's backup has to be maintained. Hence secondary boot block is used, secondary boot block contains the entire information of PBB.

4. INODE:
If you want to create an file we should definitely have an "INODE" number, where INODE block limit of the type of file, the size of file when it is created, when it was modified and the file permissions and it resides from sector 32. 




File System checking

#fsck : Due to improper shutdown of the systems some times the file system gets corrupted and to check the corrupted file system, we can use utility called "fsck" (file system checking).
  • It always in raw format (rdsk)
  • It is always run on unmounted file system.
  • It refers "/etc/vfstab" file to check in what way the file system check has to be done. i.e. either sequential or parallely.
Options of "fsck":
1. # fsck -m: This is to check the inconsistency of a file system.
2. # fsck -y: This option used to check and repair the inconsistency of file system.

Note: Before running "fsck" ensure that file system is permanent (i.e. in vfstab), the entry should be in "/etc/vfstab".

File system configuration:
# df -h
# umountall
# df -h
# vi /etc/vfstab

To check the inconsistency of the file system:
# fsck -m /dev/rdsk/c0t0d0s4
// yes, it is good, ok

To corrupt the file system:
# dd if=/dev/zero of=/dev/rdsk/c0t0d0s4 bs=512 count=32
# fsck -m /dev/rdsk/c0t0d0s4
//now its corrupted

To repair file system:
# fsck -F ufs -y -o b=32 /dev/rdsk/c0t0d0s4

File checking is done in two way
1. Sequentially
2. Parellely

6 phases:
phase 1= check blocks & sizes
phase 2=check path names
phase 3a=check connectivity
phase 3b=verify shadows/ACLs
phase 4=check reference counts
phase 5=check cylinder groups

Friday 29 April 2011

Mount a file systems with non defaults

Difference between 'large files' and 'no large files'
large file: (rw) we can create a file of more than 2 GB
no large file: (r) the file size should be less than 2GB.

The default settings are 'rw' permissions which supports large files.

mount a file systems with non defaults:
1. Select a slice, allocate some memory to the slice, then format it
# newfs /dev/rdsk/c0t0d0s6
# mkdir /java
# mount -0 ro, nolargefiles /dev/dsk/c0t0d0s6 /java
# cat /etc/mnttab

Note: When you mount a FS with non defaults, that ro & nolargefiles, we can only read the contents of the FS but can't write.
To convert the non defaults FS
# mount -0 remount /dev/dsk/c0t0d0s6 /java
# cat /etc/mnttab

note:
we can convert non-default(nolarge) to default(large) but default to non-default difficult. we need to unmount it and then remount.

To create a hidden file system:
1.
# newfs /dev/rdsk/c0t0d0s6
# mount -m /dev/dsk/c0t0d0s6 /cherry
# df -h
# cat /etc/mnttab
# cd cherry
# pwd
/cherry
# touch c1 c2 c3 c4 c5
#ls
# umount /cherry
# unmountall
# df -h
# mount /dev/dsk/c0t0d0s6 /cherry
# df -h
# cd /cherry
# ls
c1 c2 c3 c4 c5

note: when you create a hidden FS in solaris the FS information is not updated in "/etc/mnttab" and it is not visible when you use "df -h" command.
There is no command in solaris to find out the hidden filesystem.
The command to unmount the hidden filesystem is "umountall".




Installation of sun Solaris in spark machine

First insert the Solaris OS DVD in cd drive

Steps involved in installation:
Step 1:
OK setenv boot-device cdrom
boot-device=  cdrom
OK printenv boot-device
boot-device=  cdrom
Step 2:
Language: 0 (english)
use DHCP for home(): No
Hostname: Solaris
IPaddress: 192.168.0.1
Enable IP V6 for: No
Default router: None
Kerboros: No
Name services: None
Time jone: Asia -> India
password: sun
enable remote services: Yes
welcome wizard
reboot : Yes
Specify the media: cd/dvd
please select the following: Intial install
select one: custom install
laguage: Asia ->english
Additional product: none
select solaris software group
entire group OEM        4238.7
Entire group                  4184.1
Developer group           4094.6
End user group              32698
cursor group                  362.4
reduced networking        338.3

selected disk: c0t0d0
preserve data: no
layout file system (default)
slice   filesystem   size(MB)        max
  0        /               1024           327MB    
  1       /usr            5000           4862MB
  3       swap          1024            10MB

apply

File System


File System: It is an option in which we can format a disk space, according to the user requirement.
  • The default file system in Solaris is - UFS (Unix File System)
Types of File System:
1. Disk Based File System (ex: UFS)
2. Network Based File System (NFS)
3. Memory Based File System (ex: CACHEFS, TEMPFS, Auto FS)

Flag Status:
1. Write Mount: ex: Disk based FS
2. Write Unmount: ex: Memory based FS
3. Read Mount
4. Read Unmount

Types of Devices:
1. Logical Devices (/dev): This logical device names are for administrative reference and these are symbolically linked with physical devices. All the logical devices are under /dev directory.
2. Physical Devices (/devices): These are for kernel reference and All the physical device names stored under /device directory.

Formates of a disk:
1. rdsk (raw disk): The disk before formatting will be under raw format, identified as "rdsk".
2. dsk (block disk): The disk after formatting, is known as block device, it is identified as "dsk".

commands used to create file system:
1. #format: is command line utility which shows all the available disks in a system.
2. #newfs: is a command line utility which is used to format a disk under "ufs". when you format a disk by using a "newfs" by default on directory will create called "Lost+Found". which contain un saved data, which is used to recover data in next reboot.
3. #mount: mount in the FS means, attaching the file system to a directory under root.
4. #mountall: It is used to mount all the permanent FS. 
5.#umount: unmount the FS
6.#umountall: It is used to umount all the FS except root & root user.
7. /etc/mnttab:  when you create a file system & mount, by default one file get updated automatically, that is /etc/mnttab, the entries in mnttab are temporary.
8. /etc/vfstab: If you want to make it permanent, we have to update a file called /etc/vfstab.
to view the content of the file system "cat /etc/mnttab" use
9. #fsck: (File system check): used to check inconsistency file system (unmounted FS). 
     i. serial checking
     ii. parallel checking

Steps for File System creation:

Solaris1# Format
specify disk (enter its number): 0
Format> p                   // partition
Partition> p                 // print
Partition> 4                 // Select the slice
partition id tag [unassigned]:                        //leave it blank it defaultly take unassigned
partition permission flags [wm]:                   //leave it blank it defaultly take wm
enter starting cylinder number cy[0]: 514
enter partition size: 500m                           //500 MB                               
// The entered information about partition ID, permission flags and partition size will be on the RAM, in order to update to the kernel we need to "label" it.
partition> l                                                // l- label
ready to the label disk, continue? Y           // now it is into the kernal, before it was in RAM
partition> q                    // quit from partition  
format> q                    // quit from format & back to the Solaris1
Solaris1# newfs /dev/rdsk/c0t0d0s4          // to construct new file system
construct new filesystem (y/n)? Y
 Solaris1# df -h (or) df -k                         // to view file system, no slice(s4) visible, bcoz not yet mounted
Solaris1# mkdir /sunny
Solaris1#mount /dev/dsk/c0t0d0s4 /sunny
Solaris1# df -h                                         // to view file system, now slice(s4) visible, bcoz mounted to sunny
Solaris1# cd /sunny
Solaris1# ls                                             //no files created yet
Solaris1#touch 1 2 3                               // create files 1 2 3

note: /etc/mnttab:  when you create a file system & mount, by default one file get updated automatically, that is /etc/mnttab, the entries in mnttab are temporary.
If you want to make it permanent, we have to update a file called /etc/vfstab.
//to view the content of the file system "cat /etc/mnttab" use

Solaris1#cat /etc/mnttab
/dev/dsk/c0t0d0s4          /sunny
Solaris1# umount /sunny                          // to unmount the file system
Solaris1# df -h
now there is no s4 slice mounted
Solaris1# vi /etc/vfsstab                           //vfstab :  virtual file system table
   device                       device to              mount     FS     fsck     mount      mount
  tomount                         fsck                  point      type    pass    at boot     options
------------------------------------------------------------------------------------
/dev/dsk/c0t0d0s4   /dev/rdsk/c0t0d0s4   /sunny    UFS    1       Yes           -

1. device to mount:  It refers to block device
2. device to fsck: file system checking is always done on unmounted FS.
3. mount point: refers to the directory on which the FS is mounted.
4. FS type: default is UFS
5. fsck pass: it is done in two modes i. serial check ii. parallel check
6. mount at boot: it is used to specify whether you want to mount the file system at next reboot or not
7. mount options: '-' it refers to default options. i.e FS permission RW, support the large file.

Thursday 28 April 2011

the configuration & unconfig of zones


For configuration it require 4 steps
1. Create
2. Install
3. Ready
4. Boot
For unconfiguration it require 3 steps
1. Halt
2. Uninstall
3. Delete
The installation takes approximately 20 mins

The configuration:
Take a system with Global zone (default OS), and make a new non-global zone (virtual OS) from global zone.
Create a File system of 4GB, Format it, Mount it, and make it permanent.
Solaris1# Format
specify disk (enter its number): 0
Format> p                   // partition
Partition> p                 // print 
Partition> 5                 // Select the slice 
partition id tag [unassigned]:                        //leave it blank it defaultly take unassigned
partition permission flags [wm]:                   //leave it blank it defaultly take wm
enter starting cylinder number cy[0]: 514
enter partition size: 4g                                
// The entered information about partition ID, permission flags and partition size will be on the RAM, in order to update to the kernel we need to "label" it.
partition> l
ready to the label disk, continue? Y           // now it is into the kernal, before it was in RAM
partition> q                    // quit from partition    
format> q                    // quit from format & back to the Solaris1
Solaris1# newfs /dev/rdsk/c0t0d0s5          // to construct new file system
construct new filesystem (y/n)? Y
 Solaris1# df -h (or) df -k                         // to view file system, no slice(s5) visible, bcoz not yet mounted
Solaris1# mkdir /sunny
Solaris1#mount /dev/dsk/c0t0d0s5 /sunny 
Solaris1# df -h                                         // to view file system, now slice(s5) visible, bcoz mounted to sunny
Solaris1# zoneadm list -vc                       // to display the status of the zone
ID           Name             Status         path
0             global             running         /      //Id=0 always zero bcoz global
// now i want to create non-global zone, so create zone with name 'sun'
1. Create:
Solaris1# zonecfg -z sun
zonecfg:sun> create                                 // create: it creates whole root zone
                                                               // create -b: it creates sparse root zone
// if you want to config non-global zone, it required IP address, physical address & all networking details.
zonecfg:sun> set autoboot=true
zonecfg:sun> set zonepath =/sunny
zonecfg:sun> add net
zonecfg:sun:net> set physical=hme0
zonecfg:sun:net> set address=192.168.0.25   //ip address depends on requirement 
zonecfg:sun:net> end
zonecfg:sun> commit                                    // save
zonecfg:sun> exit

//check out the zone status, as we just created sun (non-global), but no packages installed in 'sun'
Solaris1# zoneadm list -vc
ID           Name             Status         path
0             global             running         / 
-               sun               configured    /sunny
Solaris1# ls -ld /sunny                                 // check the status of permission 
Solaris1# chmode 700 /sunny                     // set the permission as 700

2. Install:
Solaris1# zoneadm -z sun install                  
//now all the files copying from global zone(Solaris1) to non-global zone (sun) 
Solaris1# zoneadm list -vc
ID           Name             Status         path
0             global             running         / 
1               sun               installed       /sunny

3.Ready:
Solaris1# zoneadm -z sun ready
Solaris1# zoneadm list -vc
ID           Name             Status         path
0             global             running         / 
2               sun               ready           /sunny


4. Boot:
Solaris1# zoneadm -z sun boot
Solaris1# zoneadm list -vc
ID           Name             Status         path
0             global             running         / 
3               sun                running    /sunny


To go on to the non global zone:
Solaris1# zlogin -C -E sun
select 13 for CDE
Solaris1# telnet 192.168.0.25
sun#
sun# telnet 192.168.0.1
Solaris1#
// thus the two OS systems are running in one hardware called zones.

To unconfig a zone:
1. Halt:
Solaris1# zoneadm list -vc
ID           Name             Status         path
0             global             running         / 
3               sun                running       /sunny
Solaris1# zoneadm -z sun halt
Solaris1# zoneadm list -vc
ID           Name             Status         path
0             global             running         / 
1               sun               installed       /sunny
2. uninstall:
Solaris1# zoneadm -z sun uninstall -F
3. Delete:
Solaris1# zonecfg -z sun delete
Solaris1# zoneadm list -vc
ID           Name             Status         path
0             global             running         /   



 // so, as unusual showing single global zone


   

Zones


Zones : It means virtualization, that is installing an OS into an existing OS.

Types of Zones:
1. Global Zone: It is a default zone which is created automatically when install the OS.
2. Non-Global Zone: It is a virtual zone, i.e. the OS which is installed into a existing OS.

Types of Non-global zone:
1. Whole root zone: If you copy all the packages required for zone from global zone is called whole root zone. For whole root zone minimum space required should be 4GB.
2. Sparse root zone: If a zone is created by taking limited packages from global zone is called sparse root zone.

Different states of the zone:
1. Configured State: When you create a zone & the zone for which some parameters have been committed then the state of the zone will be configured.
2. Installed State: After creating a zone when you initialized the packages into the zone then the state of the zone will be installed.
3. Ready State: The zone that is configured & the virtual plat form has been associated with the installed zone and a unique ID will be associated to the zone.
4. Running State: The zone which is associated & which is in running condition is called Running State.

Important points:
1. The default zone is Global zone.
2. The non-global zone can be created only from global zone.
3. The global zone will be having the entire information about the hardware architecture.
4. The global zone ID is always zero(0).
5. The global & non-global zone can communicate with each other.
6. We can create or delete a non-global zone only from global zone.
7. One non-global zone can't create another non-global zone.
8. Two non-global zones can communicate with each other, but one non-global zone will not be having information about the other non global zone.
9. The non-global zone which created from global zone will be of same OS. i.e Homogeneous, doesn't support heterogeneous.

Basic Concepts


1. Machine: A hardware device  is called as Machine.
2. Host: If we assign any address to a machine to identify it, is called Host.
3. Client: A Host PC which is not able to do the job and sending the request to some other PC in network to process the job.
4. Server: A PC which is processing the client's request is called "server".
5. Work Station: A Host PC which is able to perform every job by itself.
6. Process: A foreground process which is running on the system is called process.
7. Daemon: It is a background process.
8. Multitasking: Which allow you to perform a multiple task in a single system.
9. Multi User: Multiple users should be able to login to a single system.
10. Distributed system: A group of systems integrated (or interconnected) to perform a job.
11. False Tolerance: A distributed system which, if any one the system is crashed then also if your able to perform the job successfully is called "False Tolerance".
12. Spanning: If your able to write the data in the multiple disk alternately, simultaneously or sequentially is called Spanning.
13. Kernel: Communication between Hardware device & user. Kernel nothing but a basic device driver.
14. Shell: It acts as a interface between the kernel & user.