Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

I've installed Debian Wheezy and after installation completed, I realized that I forgot to set the swap memory. So now, how can I configure the swap space?

share|improve this question
up vote 7 down vote accepted

Try this:

  1. Create a partition or RAID array or logical volume... (or use an existing one) for swap
  2. mkswap that partition
  3. Run blkid that-block-device
  4. Add an entry to /etc/fstab in the form UUID=7321174b-e4d8-4d9d-b223-113a1b8e9c9f swap swap sw 0 0 (see step 3 for actual UUID)
  5. swapon -a or reboot
share|improve this answer
You can also use a file instead of a partition. It's slower, but will get the job done if you don't have room for an additional partition. – jordanm Sep 17 '12 at 22:50

FYI. If you configure a swap space on an encrypted container, it will break! I strongly advise you to configure swap volume during the OS setup phase.

share|improve this answer
Edit: if you try to configure swap space on logical volume where the encrypted container resides outside of the logical volume, it will break. – Neocron Jul 22 '15 at 23:58
I am using swapfiles on encrypted volumes for years without setting them up in setup phase and never ran into problems. – Jodka Lemon Jul 23 '15 at 0:04
..running Debian. – Jodka Lemon Jul 23 '15 at 0:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.