Swap FS Creating and FS Tuning

On modern hardware with 32GB memory or more swap space is rarely used for its primary purpose. Bu Solaris has a very elegant idea of linking swap space and /tmp. In other words /tmp in Solaris is memory based filesystem and files in it disappear on reboot. That means that it is important for Solaris administrators to understand the features of the Solaris swap. There are three major area of interest here:

Swap space requirements

The relationship of swap with the TMPFS file system

Recovery from error messages related to swap space

Solaris virtual memory is a combination of the available random access memory (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 system’s memory requirements exceed the size of available RAM. The default page size for Solaris is 8K. Usual size of Solaris swap partition is the size of RAM. In can be less but some application, such as Oracle requires the size swap to be equal to the size of RAM .

But if RAM is bigger then 2GB usually it sufficient to allocate about 25-30% of physical RAM.

Paging is the transfer of selected memory pages between RAM and the swap areas.

To display the size of a memory page in bytes. The default page size for the Solaris 10 OS is 8192 bytes

# pagesize
8192

# pagesize -a To display all supported page sizes.
8192
65536
524288
4194304
swap command provides a method of adding, deleting, and monitoring the swap areas used by the kernel.
Swap area changes made from the command line are not permanent and are lost after a reboot. To create permanent additions to the swap space, create an entry in the /etc/vfstab file. The entry in the /etc/vfstab file is added to the swap space at each reboot.

6. List a summary of the modified system swap space.
# swap -s
total: 41672k bytes allocated + 5416k reserved = 47088k used, 901200k
available
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
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
…
/usr/local/swap/swapfile – – swap – no –
Removing Swap Slices
1. Delete a swap slice from the current swap configuration.
# swap -d /dev/dsk/c1t3d0s1
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

FS Tuning

SWAPFS: A FS used by the kernel for swapping. Swap space is used as a vertual memory storage area when the system does not have enough physical memory to handle current process.

PROCFS: The process file system resides in memory. It contains a list of active processes, by process number in the /proc directory.Ps command is used to get the information of the /proc directory.

TMPFS: Temporary file system uses in local memory for file system reads/writes because it uses physical memory not in the disk. TMPFS is faster than to files in a UFS.THis is not permanent, they are deleted when the file system is unmounted or the system is shutdown or rebooted. This is the default FS type for /tmp directory in the SUNOS system software.When memory is insufficient to hold everything in the temporary file system, the TMPFS uses swap space as a temporary backing store, as long as adequate swap space is present
Subdirectory Description
/dev/fd File descriptors
/dev/md Logical volume management metadisk devices
/dev/pts Pseudo terminal devices
/dev/rdsk Raw disk devices
/dev/rmt Raw magnetic tape devices
/dev/term Serial devices

/etc/inet Configuration files for network services
/etc/nfs Configuration file for NFS server logging
/etc/security Control files for Role Based Access Control and security privileges
/etc/skel Default shell initfiles for new user accounts
/etc/svc The Service Management Facility database and log files
/etc/zones Initialization and reference files for the Solaris 10 OS Zones facility
/var/svc Service Management Facility control files and logs.

inodes contain two parts. First, inodes contain information about the file, including its owner, its permissions, and its size. Second,
inodes contain pointers to data blocks associated with the file content.

Data blocks are units of disk space that are used to store data
A symbolic link is a file that points to another file.
# ln -s file1 file2
A hard link is the association between a file name and an inode.

# ln file1 file2
A file system is a collection of files and directories that make up a structured set of information