Create a swap space of 1GB

April 9, 2008 | In: Linux

For 1 gb

Execute the command below.

=========================
dd if=/dev/zero of=swapfile1 bs=1024 count=1048576
=========================

=========================
/sbin/mkswap -c -v1 /swapfile1
=========================

=========================
/sbin/swapon /swapfile1
=========================

Edit the file /etc/fstab
Add the line below.

=========================

/swapfile1              swap                   swap    defaults  0 0

=========================

For creating swap files of different sizes. Example 2GB , you can create two !GB swap files with different swapfile name.

If you need to create a single 2 GB swap file the first step should be edited with suitable values.

==========================

For 1 gb

Execute the command below.

=========================
dd if=/dev/zero of=swapfile1 bs=1024 count=1048576
=========================

=========================
/sbin/mkswap -c -v1 /swapfile1
=========================

=========================
/sbin/swapon /swapfile1
=========================

Edit the file /etc/fstab
Add the line below.

=========================

/swapfile1              swap                   swap    defaults  0 0

=========================

For creating swap files of different sizes. Example 2GB , you can create two !GB swap files with different swapfile name.

If you need to create a single 2 GB swap file the first step should be edited with suitable values.

=========================
dd if=/dev/zero of=swapfile1 bs=1024 count=1048576
=========================

The bs value and count value should be changed for corresponding swap file size.

However, the easier method is to create more swap files to size 1Gb.

If you need 4Gb swap , create four 1Gb swap files.

mm
Hi All… I have been working the IT Industry since last ten years… Specialized in Linux, Cloud Infrastructure and Solution Design.
On the hobby friend, I do research on IOT, Micro-controllers, Electronics etc.
Music is my passion..Connect me on..

Comment Form

*

Authors

mm
Presoon John

Hi All... I have been working the IT Industry since last ten years... Specialized in Linux, Cloud Infrastructure and Solution Design.
On the hobby friend, I do research on IOT, Micro-controllers, Electronics etc.
Music is my passion..Connect me on..

Access this post via Mobile

Scan the QR Code
QR Code Generator

Categories