By user12609114 on Apr 18, 2009
I was working on a VDI 3.0 install today and I got an error that led me on a very interesting journey. As I was attempting to install the VirtualBox component on Solaris 10 10/08 I got an error stating that my swap needed to be equal or greater to my memory.
When I do a Solaris install I normally select custom and create 2 partitions. One for root and one for swap. I know the old adage that swap should be twice RAM , but in these days with so much RAM in the systems, I don't normally follow it. Faced with learning how to resize swap or reinstalling I took the lazy way out and reinstalled Solaris 10. This time I gave the swap partition 10GB.
Thinking I would be merrily moving along my way I ran the VirtualBox installer script again, and bam same error. The error said I had 4GB of swap and 8GB of memory. Stop the presses, I know I said 10GB's. df -h clearly showed 10GB's. Obviously the script was calculating swap differently then I was. I cracked the script open and found that it was running the command swap -l. Low and behold I only had 4GB of swap, per the command.
Turns out that there are 2 types of swap in Solaris, "system virtual memory" and "disk paging space". Seems as if the GUI installer allows you to adjust one but not the other. To be fair the settings might be there I have just never noticed. Now I was tempted at first to just comment out the check in the script and to keep moving, but I decide it must be their for a reason. After a bit of research it looks like there is a known issue. While it is a remote possibility, some customers ran into the issue in the EA releases of VDI 3.0, and hence why the check was added. In other words the proper thing to do was to fix the swap space sizing. Looks like I was going to have to figure out how to adjust that swap size.
After some research I found this link, which shows how to increase the size of your swap and your dump for a zfs file system. Due to a known issue it is recommend that you delete the partition first and then recreate it. Here are the steps:
# swap -d /dev/zvol/dsk/rpool/swap
# zfs volsize=2G rpool/swap
# swap -a /dev/zvol/dsk/rpool/swap
I tried to delete the swap partition and got an error that it did not exist. While investigating this, I realized I had no rpool. Then it dawned on me, I had a UFS installation! I have been doing a lot of work with OpenSolaris recently and it installs zfs as the root file system by default. I was positive Solaris 10/08 has bootable ZFS. I was also positive I had not missed a question in the gui installer. After doing a bit more research I found this great link, which identifies that in order to choose ZFS as your root file system in Solaris 10 10/08 you need to use the text based installer not the gui. Looks like another install was forthcoming!
Third time the charm? I booted to the install DVD again and this time I choose the text installer. I was asked the normal questions of the gui installer, but also what type of file system I wanted, I selected ZFS, and I was asked to set the size of my swap and dump. Both went to 8GB which equals the amount of RAM I have in the box.
After Solaris installed I ran the swap command again;
# swap -l
swapfile dev swaplo blocks free
/dev/zvol/dsk/rpool/swap 181,2 8 16777208 16777208
Note the response is in blocks so you have to divide by 2 to get kb. I have 8GB of swap and am good to go!