Pages

Wednesday, December 8, 2010

How to add secondary swap device with swap file

You can add a secondary swap device using a file. You just need to create the file as tips below.


1.    Check disk space that can contain swap file. In this example you will create 512 MB file on /


    root@solaris-sunray # df -h
    Filesystem             size   used  avail capacity  Mounted on
    /dev/dsk/c0d0s0         15G   4.6G    10G    31%    /
    /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                   655M   956K   654M     1%    /etc/svc/volatile
    objfs                    0K     0K     0K     0%    /system/object
    /usr/lib/libc/libc_hwcap1.so.1
                        15G   4.6G    10G    31%    /lib/libc.so.1
    fd                       0K     0K     0K     0%    /dev/fd
    swap                   655M   1.2M   654M     1%    /tmp    swap                   654M    32K   654M     1%    /var/run

2.    Create 512 MB file.



    root@solaris-sunray # mkfile 512m swapfile
3.    Activate the swap area

    root@solaris-sunray # /usr/sbin/swap -a /swapfile
4.    Verify that swap has been added

    root@solaris-sunray # swap -l
5.    (Optional) If you want to add swap area permanently, modify /etc/vfstab and add this record

    /swapfile    -    -    swap    -    no    -

No comments:

Post a Comment