Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to add a swap file on Solaris 10. I have already created a 2GB file swap.file. Then, I add a swap file with the command:

swap -a /swap.file

which shows an error:

/swap.file: size is invalid

What am I doing wrong?

share|improve this question

migrated from stackoverflow.com Jul 11 '12 at 12:30

This question came from our site for professional and enthusiast programmers.

You are likely running a 32 bit kernel. You can just create 2 x 1 GB swap files and add them separately.

# rm /swap.file
# /usr/sbin/mkfile 1024m /swap1
# /usr/sbin/mkfile 1024m /swap2
# /usr/sbin/swap -a /swap1
# /usr/sbin/swap -a /swap2

Also, for this setting to survive a reboot, you'll also need to add lines to the /etc/vfstab file, eg:

/swap1 - - swap - no -
/swap2 - - swap - no -
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.