Swap size increase

Dear All,

How to increase the swap size when physicall memory reaches 60 %. OR it can be only done after the physicall memory is full.

Rgds
Rj

See man mkswap. Swap can change any time short of when you need more (because your commands will fail).

umount /dev/sda1
Perform a check on the file system

e2fsck -f /usr/sda1
Now resize with

resize2fs /usr/sda1 60M
resize is a tool to perform partition.

try this.

I'm afraid mkswap is a Linux command, not a Solaris one. e2fsck/resize2fs and sda1 are also Linux specific (and unrelated to swap increase).

On Solaris you increase the swap area with the "swap -a swapname" command.

Swapname can be a partition, slice or file.

Eg:

mkfile 1g /extraswap
swap -a /extraswap

To have this extra swap persisting after a reboot, add a line for it in /etc/vfstab.

You can in crease the swap size in two ways

  1. By Adding another slice
  2. By adding file

Example: Please follow the below steps

[LEFT]Adding Swap Files
[/LEFT]

[LEFT]To add a swap file, complete the following steps:

  1. The /export/data file system appears to have adequate space to
    create an additional swap file. Create a 20-Mbyte swap file named[/LEFT]

swapfile in the /export/data directory.

# mkfile 20m /export/data/swapfile

2. Add the swap file to the system's swap space.

# swap -a /export/data/swapfile

3. List the details of the modified system swap space.

# swap -l

[LEFT]swapfile dev swaplo blocks free
/dev/dsk/c0t0d0s1 136,1 16 1206736 1084736
/export/data/swapfile - 16 40944 40944[/LEFT]

4. List a summary of the modified system swap space.

# swap -s

[LEFT]total: 106256k bytes allocated + 8512k reserved = 114768k used,
587512k
available[/LEFT]

[LEFT]5. To use a swap file when the system is subsequently rebooted, add an
entry for the swap file in the /etc/vfstab file.[/LEFT]

# vi /etc/vfstab

[LEFT]#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot opt[/LEFT]
/export/data/swapfile - - swap - no -

Adding Slice
all the above steps are followed

except here u mention ,

#swap -a /dev/rdsk/c*t*d*s*

make an entry in /etc/vfstab, to make it permanent.

Hope this will help you....

1 Like

Hi Sudhansu,

Thanks for your reply....

And I also have one doubt which i have mentioned in another post.

I have a hard disk which have some mount points... and now the requirement is the resize the hard disk ...( increase in size ) ...

SVM is also present...Do you have any link which shows the steps for resizing under SVM ( raid 1 )

Regards
Rj

Dear Rj,

I am bit confused by the question. What u asking is increasing the size of harddisk. I don't think u can increase the size of the hard disk rather u can increase the size of a file system

What you can do, that u can add a separate silce to an existing file system to increase it's size.

Here are some steps to do the things.

Suppose u have /home mounted on /dev/rdsk/c0t0d0s7.. Here u can increase the size of /home. suppose u have another hard disk(c1t0d0) and u want to add the fihth slice (c1t0d0s5) to /home for increasing the size.

step 1 : create the metadevices by metadb command. If alrady configured then leave it.

STEP 2 :
# metainit -f d* 2 1 c0t0d0s7(i:e /home) 1 c1t0d1s5 (new slice)

STEP 3:
Edit the /etc/vfstab and input the below entry

/dev/dsk/c0t0d0s7 /dev/rdsk/c0t0d0s7 /export/home ufs 2 yes - <Old entry >

now give this new entry and omit the above entry

/dev/md/dsk/d* /dev/md/rdsk/d* /export/home ufs 2 yes -

STEP 4: then unmount /home and mount it back.

STEP 5 : this is the important command

   \# growfs -M /home /dev/md/rdsk/d*

now u can check df -h to find out whether the size is increased or not.

1 Like

Dear Sudhansu,

Thanks for your reply....From your mail I could learn of increasing the size of the file system by adding another slice.

Let us suppose if we dont have enough space in the hard disk , we want to add another disk and attach to this file system....is there any way for this...

Pl input your thoughts on this.

Regards
Rj

His method works for that, but is for regular fs space. For swap, you just get the device up and add whatever partitions of it you want to swap as described way above.