Solaris / OpenSolaris Add Swap File

See all Sun Solaris UNIX related FAQ
How do I add swap space under Solaris / OpenSolais UNIX operating systems?

You can add the swap space as follows under Solaris UNIX operating systems.
Advertisement

Create A Swap File

Type the following command to create a file using mkfile (1024 Meg swap file):
# mkfile 1024m /disk2/swapfile

Enable Swap Space

To enable it type the following command:
# swap -a /disk2/swapfile
Finally, check your new swap space, enter:
# swap -l

Enable Swap Space File On Boot

Add the following line to /etc/vfstab file:
# vi /etc/vfstab
Append the following entry:

/disk2/swapfile   -   -   swap   -   no   -

Close and save the file.

References:

  • See man pages swap, and mkfile commands.

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

0 comments… add one

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.