I've installed Debian Wheezy; after installation completed, I realized that I forgot to set the swap memory. So now, how can I configure the swap space?
Asked
Active
Viewed 7,101 times
3 Answers
8
Try this:
- Create a partition or RAID array or logical volume... (or use an existing one) for swap
mkswapthat partition- Run
blkid that-block-device - 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) swapon -aor reboot
Stéphane Chazelas
- 522,931
- 91
- 1,010
- 1,501
Renan
- 16,976
- 8
- 69
- 88
-
2You 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
0
If you can't create a new partition or add new disks, you can increase your swap with the following :
swapfile=swapfile01
dd if=/dev/zero of=/var/$swapfile bs=1024 count=$(( 2*1024*1024 ))
mkswap -L $swapfile /var/$swapfile
echo "/var/$swapfile swap swap defaults 0 0" >> /etc/fstab
swapon /var/$swapfile
NB - this creates a 2GB swapfile. Adjust count= to requirements.
Leolo
- 123
- 5
-3
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.
Neocron
- 1
-
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 00:04
-