Showing posts with label Solaris. Show all posts
Showing posts with label Solaris. Show all posts

Wednesday, April 20, 2011

Working with swap space

Get Hand's on Training on 10G RAC / Backup & Recovery / Standby / 10G ASM / Oracle 11i Apps call @ 9958874333 mail: anup@indiandba.com visit : http://www.indiandba.com/

What is swap space?

Swap space is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the physical memory is full, inactive pages in memory are moved to the swap space.

Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.

Nota:

Swap space on disk is used to hold pages of memory that have been paged or swapped out. A shortage of swap space may cause symptoms such as system hanging, poor response times, and unsuccessful spawning of new processes.

Can we consider for replacement of RAM?

While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.

What is the recommended swap size system requirement?

Two to three times the amount of Physical Memory for Swap space (unless the system exceeds 1 GB of Physical Memory, where two times the amount of Physical Memory for Swap space is sufficient)

What the difference between swapping and paging?

Swapping is one of the Unix mechanisms to accommodate the size limitation of memory by moving entire processes to disk to reclaim memory.

Paging is another Unix machanism to manage the limitations of memory. Unlike swapping, where entire processes are moved in and out of memory, paging moves only individual pages of processes to disk. Paging is not as serious a problem as swapping, as the entire program does not have to reside in memory to run. A small amount of paging may not noticeably affect the performance of a system. However, the performance of a system may degraderapidly as paging activity increases.

What's a swap file?

In some situations it's difficult to add a new swap partition. Linux doesn't allow changing partition definitions and if we cannot add new partitions without dropping existing partitions. In this case swapfiles may be helpful.

Is it possible to resize a swap partition?

Linux doesn't allow changing partiton defintions without removing a partition and destroying all data stored on this partition.

How to Monitoring Swap Resources?

On Solaris:

# swap -l
swapfile dev swaplo blocks free
/swap/swapfile - 16 4194288 4194288

# swap -s
total: 4102472k bytes allocated + 702696k reserved = 4805168k used, 2258760k available

On Linux:

# /sbin/swapon –s
We can also check using "cat /proc/swaps" file.

Recommendation:
Swap usage may slowly increase as shown above but should stop at some point. If swap usage continues to grow steadily or is already large, then one of the following choices may need to be considered:

- Add more RAM or reduce the size of the SGA
- Increase the size of the swap space

If you see constant swapping, then you need to either add more RAM or reduce the size of the SGA. Constant swapping should be avoided at all cost. You can check current swap activity using the following commands:

$ vmstat 3 100

How to Add Swap Partaion?

On Solaris:

Step 1: Use the swap –a command to add additional area.

# swap -a /dev/dsk/c1t0d0s3

Step 2: Add a swap slice in /etc/vfstab file

# vi /etc/vfstab

Add the following line to create the swap slice.

/dev/dsk/c1t0d0s3 --swap -no -

Note – When the system is subsequently rebooted, the new swap slice /dev/dsk/c1t0d0s3 will be automatically included as part of the swap space as a result of adding the entry to the /etc/vfstab file.

On Linux:

Step 1: Use the command mkswap to setup the swap partition. At a shell prompt as root, type the following:

# /sbin/mkswap /dev/hdb2

Step 2: To enable the swap partition immediately, type the following command:

swapon /dev/hdb2

Step 3 To enable it at boot time, edit /etc/fstab to include:

/dev/hdb2 swap swap defaults 0 0

The next time the system boots, it will enable the new swap partition. After adding the new swap partition and enabling it, make sure it is enabled by viewing the output of the command

cat /proc/swaps or /proc/free.

How to add a swap file?

On Solaris:

Step 1: Create a swap file named swapfile in the partition that have enough free space, for example /export/data directory.

# mkfile 1000m /export/data/swapfile

Step 2: Add the swap file to the system’s swap space.
# swap -a /export/data/swapfile

Step 3: Check the details of the modified system swap space with swap -l and swap -s command.

Step 4: 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
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot opt

/export/data/swapfile --swap -no -

On Linux:

Step 1: Determine the size of the new swap file and multiple by 1024 to determine the block size. For example, the block size of a 64 MB swap file is 65536.

At a shell prompt as root, type the following command with count being equal to the desired block size:

# mkdir /data2
# dd if=/dev/zero of=/data2/swapfile1 bs=1024 count=65536

Step 2: Setup the swap file with the command:

# /sbin/mkswap /data2/swapfile1

Step 3: To enable the swap file immediately but not automatically at boot time:

# /sbin/swapon /data2/swapfile1

Step 4: To enable it at boot time, edit /etc/fstab to include:

# /data2/swapfile1 swap swap defaults 0 0

The next time the system boots, it will enable the new swap file.

How to remove swap partition?

On Solaris:

Step 1: Delete a swap slice from the current swap configuration.

# swap -d /dev/dsk/c1t0d0s3

Step 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.

On Linux:

At a shell prompt as root, execute the following command to make sure the swap partition is disabled (where /dev/hdb2 is the swap partition):

# swapoff /dev/hdb2
Remove its entry from /etc/fstab.
Remove the partition using parted or fdisk.

How to remove swap file?

On Solaris:

Delete a swap file from the current swap configuration.

# swap -d /export/data/swapfile

Remove the file to free the disk space that it is occupying.

# rm /export/data/swapfile

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 /export/data/swapfile command shows the space in use until you remove the swap file.

At a shell prompt as root, execute the following command to disable the swap file (where /swapfile1 is the swap file):

# swapoff /data2/swapfile1
Remove its entry from /etc/fstab.

Remove the actual file:
# rm /data2/swapfile1
Remove its entry from /etc/fstab.

How to get paging/Swap information?

# vmstat 5 5

The first column in /proc/stat shows the page-in counter and the second the number page-out counter. Check the numbers in intervals to get information about the paging activity.

# grep swap /proc/stat or vmstat

The first column in /proc/stat shows the swap-in counter and the second is the number swap-out counter. Check the numbers in intervals to get information about the swapping activity.

Click Here for download complate documnet.

Friday, May 15, 2009

Formatting Linux File system

When we Format linux file system
  • When we want to expand file system
    When we just added new hard disk drive

Here, we take example suppose we just added new hard disk drives

Step 1 Add Hard Disk physically with Machine

Step 2 login as a root and execute # fdisk –l command. You will see newly added disks here. (Example: /dev/sdc)

Step 3 Now we create file system. Log is as a root user and type following command:

# mkfs.ext3 /dev/sdc1

Step 4 Create mount point directory for the file system

# mkdir /Indian

Step 5 Mount the new file system

# mount /dev/sdc1 /Indian

Step 6 we need to add partition to /etc/fstab file

# vi /etc/fstab

Add/append following entry to file:

/dev/sdc1 /indian ext3 defaults 0 2

Monday, April 20, 2009

How to create Shared Disk “between” two Solaris Machine on VMWare

Step 1 Create first Machine

Create the windows folders to house the first virtual machines and the shared storage.

D:\>mkdir SUNOS-1

F:\>mkdir SHARED-STORAGE

Install Solaris virtual machine in SUNOS-1 Directory.

Step 2 Create virtual disks for storage usage, which is shared by Both Machine.

  • Down the virtual Machine
  • Go to VMware Server Console. Click on Edit virtual machine settings.
  • Virtual Machine Settings: Click on Add.
  • Add Hardware Wizard: Click on Next.
  • Hardware types: Select Hard Disk.
  • Select a Disk:
  • Disk: Select create a new virtual disk.
  • Select a Disk Type:
  • Virtual Disk Type: Select SCSI (Recommended).
  • Specify Disk Capacity:
  • Disk capacity: Enter “10GB.”
  • Select Allocate all disk space now.
  • Specify Disk File:
  • Disk file: Enter “F:\>SHARED-STORAGE\DISK1.vmdk.”
  • Click on Advanced
  • Add Hardware Wizard:
  • Virtual device node: Select IDE0.1.
  • Mode: Select Independent, Persistent for all shared disks.
  • Click on Finish.

Step 3 Modify virtual machine configuration file.

Additional parameters are required to enable disk sharing between the two virtual RAC nodes. Open the configuration file, D:\>SUNOS-1\ Solaris 10.vmx.vmx and add the bold parameters listed below.

.

.

.

priority.grabbed = "normal"

priority.ungrabbed = "normal"

disk.locking = "FALSE"

diskLib.dataCacheMaxSize = "0"

ide0:1.sharedBus = "virtual"

ide0:0.redo = ""

ethernet0.addressType = "generated

-

-

-

-

-

ethernet0.connectionType = "hostonly"

ide0:1.present = "TRUE"

ide0:1.fileName = "E:\SHARED-DISK.vmdk"

ide0:1.redo = ""

checkpoint.vmState = ""

ide0:1.mode = "independent-persistent"

ide0:1.deviceType= "disk"

floppy0.present = "FALSE"

Step 4 Create and Configure the Second Virtual Machine

Create the windows folders to house the second virtual machines.

E:\>mkdir SUNOS-2

  • Shutdown the First Virtual Machine
  • Copy all the files from D:\SUNOS-1 to E:\SUNOS-2
  • Open your VMware Server Console, press CTRL-O to open the second virtual machine,
  • E:\SUNOS-2\Solaris 10.vmx.
  • Rename the second virtual machine name from SUN1 to SUN2.
  • Click on Start this virtual machine to start SUN2, leaving SUN1 powered off.
  • SUN2 – Virtual Machine: Select create a new identifier.
  • Log in as the root user and modify the network configuration.

Follow below step for modifying Host Name and IP

  • $ ifconfig <Ethernat> <new IP>
  • $ ifconfig <Ethernet> up
  • $ go to /etc/hosts file and change IP and host
  • $ go to /etc/nodenames file and change host anme
  • $ go to /etc/hostname.<Ethernet> and change host name
  • Restart the Second Virtual Machine.
  • Start the First virtual Machine
  • Verify all changes and Enjoy. Your Shared Storage is ready for fun.

Sunday, December 14, 2008

Solaris 10 OS Installation on VMWARE

Solaris 10 OS Installation on VMWARE

1. Open VMWARE Console and Click on New Virtual Machine and click next.

2. Select Virtual Machine Configurations: Typical

3. Select Gust Operation System: Sun Solaris and version solaris10

4. Type virtual Machine Name and Location.

5. Select Network Connection. Total 4 options.

  • User Bridge connection

  • Use network address translation (NAT)

  • Use host only network (Select Host Only Network)

  • Do not use a network

6. Specify Disk Capacities. (8 GB) and Click on Finish Button.

Now your virtual machine is ready to install Solaris 10 OS

7. Double Click on CD-ROM Devices

8. Select Use ISO image when you planning to install OS through ISO image otherwise Use physical drive.

9. Click on Start the Virtual Machine.

10. Select Solaris Interactive (Default) installation

11. Configure keyboard Layout screen appear (press F2)

12 Select a language English

13 welcome screen appear (Click Next)

14 Select network connectivity and (Click Next).

15. DHCP Screen appears select No and (Click Next).

16 Type Host Nome and (Click Next)

17 Type IP Address and (Click Next)

18 Type netmask (Select default) and (Click Next)

19 Select No for Enable Ipv6 for pcn0 and (Click Next)

20 Select None for Default Route and (Click Next)

21 Select No for Enable Kerberos security and (Click Next)

22 Select None for Name Services and (Click Next)

23 NFSv4 Domain Name select Default and (Click Next)

24 Select Geographic Time Zones and (Click Next)

25 Continent and Country (INDIA) and (Click Next)

26 Accept the default date and time and (Click Next)

27 Enter ROOT password and (Click Next)

28 Select Yes for Enabling Remote Services and (Click Next)

29 Confirm Information and (Click Next)

30 Select default Install option and (Click Next)

After that the system is being analyzed. Please wait screen appear and select the Type of Installation

Now Installer Install to OS…
Enjoy

Thursday, November 20, 2008

How to Add an Entry to the /etc/vfstab File?

How to Add an Entry to the /etc/vfstab File

Step 1 log in as a Root User

Step 2 Edit the /etc/vfstab file and add an entry.

Step 3 save the changes.

How to Create File Systems?

How to Create File Systems?

After creating Disk Partition, we should create File System and Mount the file file system.

Step 1. Create a file system for each slice.

# newfs /dev/rdsk/cwtxdysz

where /dev/rdsk/cwtxdysz is the raw device for the file system to be created.

Step 2. Create a Directory

# mkdir

Step 3. Verify the new file system by mounting.

# mount /dev/dsk/cwtxdysz /

# ls

How to Create Disk Partation / Slices and Label a Disk?

How to Create Disk Partation / Slices and Label a Disk?

After adding and formating disk we should create Disk Partation/Slice and Label the Disk.

Step 1 Invoke the format utility. A numbered list of disks is displayed.

Step 2 Type the number of the disk that you want to repartition.where disk-number is the number of the disk that you want to repartition.

Step 3 Select the partition menu.

format> partition

Step 4 Display the current partition (slice) table.

partition> print

Step 5 Start the modification process.

partition> modify

Step 6 Set the disk to all free hog.

Choose base (enter number) [0]? 1

Step 7 Create a new partition table by answering yes when prompted to continue.

Do you wish to continue creating a new partition table based on above table[yes]? yes

Step 8. Make the displayed partition table the current partition table by answering yes when prompted.

Okay to make this the current partition table[yes]? yes

If you don't want the current partition table and you want to change it, answer no.

Step 9. Name the partition table.

Enter table name (remember quotes): "partition-name"where partition-name is the name for the new partition table.

Step 10. Label the disk with the new partition table after you have finished allocating slices on the new disk.

Ready to label disk, continue? Yes

Step 11. Quit the partition menu.

Step 12 Verify the new disk label.

Step 13. Exit the format utility.

Step 14 After Labelind you can create file systems on the disk

Tuesday, November 18, 2008

How to Format Disk?

You have learned about adding disk in my previous update. What do you think, only after adding the disk, you are able to store data on disk?. NO…….NO….Never……you can not store data on disk.

if you want to store data on disk. You must complete the following task: Format the Disk, create disk partition, create slice, create file system and mount the file system.

I will discuss all topics separately on my blog.

Here we will discuss only about How to Format the Disk?

Step 1 Invoke the format utility. This will display a numbered of list of disks.

Step 2 Type the number of the disk (Newelly Added Disk) on which to create a Solaris fdisk partition।

Step 3 Select the fdisk menu।format> fdisk

Step 4 The fdisk menu that is displayed depends upon whether the disk has existing fdisk partitions... Type Yes for making 100% Solaris disk partation।

Step 5 Label the disk
format> label
Ready to लेबल डिस्क, continue? एस
format> Quit

Step 6 After creating பிடிச்க் partition, Next we will create slices on the disk(I will discuss How to create Disk slice and label in next session...please wait coming soon........)

How to add Disk to a Solaris?

If you want to add disk with Sun Solaris server. You just shut down the Machine and attached the disk. Start the machine and execute the following command (#devfsadm). After executing this command sun refresh the device list.
I am describing here example for adding disk on VM (SUN SOLARIS)
Step: 1 shut down the VM
Step: 2 go to the Vmware setting
Step: 3 add a new hard disk device
Step: 4 Start Virtual machine and execute one of the following Method:
Method: 1 Open terminal and type following command:
# devfsadm
Method: 2 open terminal and type following command:
# touch /reconfigure
# reboot
After adding the physical disk. You must format the disk, partition the disk, create file system and mount the file system.
We will discuss How to Format the Disk? in next session.

Anup
Get Hands-on Sun Solaris Traning form ANUP