Super User is a question and answer site for computer enthusiasts and power users. 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

How can I create or resize the swap memory on a linux device (Amazon Linux AMI). The problem came when I run a program and it gave me that errors:

 IOError: [Errno 28] No space left on device

INFO (theano.gof.compilelock): Waiting for existing lock by unknown process (I am process '947')
INFO (theano.gof.compilelock): To manually release the lock, delete /root/.theano/compiledir_Linux-3.4.43-43.43.amzn1.x86_64-x86_64-with-glibc2.2.5-x86_64-2.6.8-64/lock_dir
WARNING (theano.gof.compilelock): Something wrong happened: <type 'exceptions.IOError'> [Errno 28] No space left on device

When I execute the free to check out the memory of the device, the linux device printed me:

    total       used       free     shared    buffers     cached
Mem:      22058544    7581508   14477036          0     144316    7025740
-/+ buffers/cache:     411452   21647092
Swap:            0          0          0

How can I resize the swap to use it or create a new swap file. Thanks!

share|improve this question
up vote 1 down vote accepted

I don't know if this will be the same for you but I tried this and it worked. You can try to use a swap file :

  1. Create a file that will be used as the swap file with count being equal to the desired block size (here the size is 64MB)

    dd if=/dev/zero of=/swapfile bs=1024 count=65536
  2. Enable the swap using the following:

    mkswap /swapfile
  3. Check if the swap is really used:

    swapon -s
  4. If everything seems alright you can add this line to /etc/fstab :

    /swapfile          swap            swap    defaults        0 0
share|improve this answer

Sorry I found the answer. What I had to do is that below to create the swap file:

dd if=/dev/zero of=/swapfile bs=1024 count=10930193

Then to enable it just do:

mkswap /swapfile
share|improve this answer
This looks very close to @NabilEchaouch's answer; if so, you should upvote and accept that (by clicking the green checkmark outline just below the voting arrows) rather than writing another answer of your own. You can delete your own answer afterwards as it adds nothing that isn't already in Nabil's answer. – Michael Kjörling Aug 6 '13 at 12:47
@MichaelKjörling Done! ;) – Marc Ortiz Aug 6 '13 at 13:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .