Take the 2-minute tour ×

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.

1 Answer 1

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

