Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Thursday, 28 January 2016

How To Add Swap Space to Amazon EC2 Linux


Add Swap Space

 METHOD: 1

Step: 1. Attach the EBS volume to the instance in AWS Panel :

Note: The device you set it to (in my case, /dev/xvdg).

Step: 2. To see which Devices are Active on your Instance :

Go to Terminal & Type :

# fdisk -l

Step: 3. Setup the SWAP Area :

# mkswap -f /dev/xvdg

(the -f option is to force the command to proceed – omit it if you are unsure about the target)

Step: 4. In order to have the SWAP Space Available after a Boot :

# vi /etc/fstab   

/dev/xvdg       swap    swap    defaults        0  0

-- Save & Quit (:wq)

Step: 5. Finally, We can turn on SWAP (without a reboot) :
   
# swapon /dev/xvdg

Step: 6. To Check SWAP : 

# free -m

METHOD: 2

Step: 1. Type the following command with count being equal to the desired block size :

# dd if=/dev/zero of=/swapfile bs=1M count=1024

Step: 2. Setup the SWAP file with the command :

# mkswap /swapfile

Step: 3. To Enable the SWAP file Immediately but not Automatically at Boot Time :

# swapon /swapfile

Step: 4. To Enable it at the Boot Time  :

# vi /etc/fstab

/swapfile     swap     swap     defaults     0 0

-- Save & Quit (:wq)

Step: 5. To Check SWAP : 

# free -m


Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog

0 comments:

Post a Comment

Copyright © 2016 Kousik Chatterjee's Blog