swap space issue

HI All,

Recently during oracle install I realized that I did not have enough swap space.

So I -

  1. Created a swap file "swap_fille1" in /rpool using mkfile -
# ls -ltr /rpool
total 10487121
drwxr-xr-x   3 root     root           3 Dec 21 12:09 boot
drwxr-xr-x   2 root     root           3 Dec 21 12:09 etc
-rw------T   1 root     root     5368709120 Dec 29 13:38 swap_file1
  1. Then I added that file to the /etc/vfstab file -
# cat /etc/vfstab
#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
fd      -       /dev/fd fd      -       no      -
/proc   -       /proc   proc    -       no      -
/dev/zvol/dsk/rpool/swap        -       -       swap    -       no      -
/devices        -       /devices        devfs   -       no      -
sharefs -       /etc/dfs/sharetab       sharefs -       no      -
ctfs    -       /system/contract        ctfs    -       no      -
objfs   -       /system/object  objfs   -       no      -
swap    -       /tmp    tmpfs   -       yes     -
/rpool/swap_file1       -       -       swap    -       no      -
  1. Reboot .

But this did not help the swap space -

# df -h
Filesystem             size   used  avail capacity  Mounted on
rpool/ROOT/s10x_u6wos_07b
                       146G   6.2G   133G     5%    /
/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                   1.8G   360K   1.8G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
                       139G   6.2G   133G     5%    /lib/libc.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                   1.8G    80K   1.8G     1%    /tmp
swap                   1.8G    28K   1.8G     1%    /var/run
rpool/export           146G    19K   133G     1%    /export
rpool/export/home      146G    24K   133G     1%    /export/home
rpool                  146G   5.0G   133G     4%    /rpool

Then where did the 5GB space go? How can I use the other space to increase the swap space becuase I have couple of big s/w installation pending.

current swap space info -

# /usr/sbin/swap -s
total: 295428k bytes allocated + 83004k reserved = 378432k used, 1594308k available
# swap -l
swapfile             dev  swaplo blocks   free
/dev/zvol/dsk/rpool/swap 181,2       8 2052088 2052088

I will appreciate any help.

Thanks
Sumeet

You cannot use a file based swap file when that file is on ZFS. Simply add a zvol instead.

zfs create -V 5gb rpool/swap1
swap -a /dev/zvol/dsk/rpool/swap1

But wont this be a temporary solution and will go away after reboot?

And How did you realize that this was a zfs filesystem?

There are plenty of evidences in your posting that show you are using zfs.

My solution won't survive a reboot but adding a single line to /etc/vfstab referencing swap1 would make it persistent.

There is actually a much simpler and better solution, assuming you are not using the swap file when doing it, which looks like to be the case according to your "swap -l" output:

swap -d /dev/zvol/dsk/rpool/swap
zfs set volsize=6G rpool/swap
swap -a /dev/zvol/dsk/rpool/swap

That one will persist after a reboot.

I tried doing the last 3 steps but got (exact message) -

/dev/zvol/dsk/rpool/swap is normally mounted on   according to /etc/vfstab. Please remove this entry to use this device.

Should I really remove this entry from the /etc/vfstab file?

Thanks
Sumeet

After which command did you get this error message ?

after this -

swap -a /dev/zvol/dsk/rpool/swap

I can see the same thing in the /etc/vfstab file. So I think we might have to remove this entry from there before running it.

That's weird. I don't reproduce that behavior. Anyway, you can just temporarily comment out the vfstab line for "swap -a" to work, or simply reboot while keeping the line intact.

I did that and then I could see the swap size increase to 6.5G.

But after reboot it is again down to 800 MB.

I am thinking that just to enable the process of installation I will use this temp increase of swap space. Hope that will work.

I have couple of qusns -

Why do I see two swap space - one in /tmp and another in /var/run. Is that normal?

I can see a huge core file. What is the significance of that?

Please post the output of this command:

grep swap /etc/vfstab

You do not see two swap space, just two (or more) filesystems backed by virtual memory. No big deal.

Hi jlliagre,

It worked. I had removed the /dev/zvol/dsk/rpool/swap from /etc/vfstab file instead of commenting it.

I followed your instruction and put back the above path in the fvstab file and it worked.

Thanks
Sumeet