swap strange behaviour

emanuelebruno

Renowned Member
May 1, 2012
143
7
83
Catania
emanuelebruno.it
Hi to all, I have a production server proxmox 2.1 based, and I have discovered that the swap file doesn't work in my containers. If a create a container debian or centos based and trying to test it with the instructions of this website http://unix.stackexchange.com/questions/1367/how-to-test-swap-partition , I have seen that the swap file is never used from the container.

My proxmox version is this:

pve-manager: 2.1-1 (pve-manager/2.1/f9b0f63a)
running kernel: 2.6.32-11-pve
proxmox-ve-2.6.32: 2.0-66
pve-kernel-2.6.32-11-pve: 2.6.32-66
lvm2: 2.02.95-1pve2
clvm: 2.02.95-1pve2
corosync-pve: 1.4.3-1
openais-pve: 1.1.4-2
libqb: 0.10.1-2
redhat-cluster-pve: 3.1.8-3
resource-agents-pve: 3.9.2-3
fence-agents-pve: 3.1.7-2
pve-cluster: 1.0-26
qemu-server: 2.0-39
pve-firmware: 1.0-15
libpve-common-perl: 1.0-27
libpve-access-control: 1.0-21
libpve-storage-perl: 2.0-18
vncterm: 1.0-2
vzctl: 3.0.30-2pve5
vzprocps: 2.0.11-2
vzquota: 3.0.12-3
pve-qemu-kvm: 1.0-9
ksm-control-daemon: 1.1-1

Anybody can you help me?
 
OpenVZ does not use a swap partition - it just simulates a 'virtual' swap.

Please use KVM if you want to use a real swap partition.
 
Perhaps I have discovered the problem: taking a look to /etc/fstab file I have noticed that my production server is configured without swap partition; the following is the screenshot of mine fstab: hosted fstab.png
Do you think that I can add a file swap?

I want to proceed in this way (my production server is an i7 with 24 GB di ram):

dd if=/dev/zero of=/swapfile bs=24M count=1024
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile

After that I suppose I have to add to /etc/fstab the following line:
/swapfile swap swap defaults 0 0

I'm scared to apply these settings because I have a production server... Do you think that I will meet some problem after reboot?
 
Perhaps I have discovered the problem: taking a look to /etc/fstab file I have noticed that my production server is configured without swap partition; the following is the screenshot of mine fstab: View attachment 1247
Do you think that I can add a file swap?

I want to proceed in this way (my production server is an i7 with 24 GB di ram):

dd if=/dev/zero of=/swapfile bs=24M count=1024
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile

After that I suppose I have to add to /etc/fstab the following line:
/swapfile swap swap defaults 0 0

I'm scared to apply these settings because I have a production server... Do you think that I will meet some problem after reboot?
Hi,
better performance (ok, if swapping start the performance are allways bad) is with an swap-partition.
Look with
Code:
vgs
lvs
perhaps you have allready an logical volume for swap, or enough free space in the volume group (leaf enough free space in the VG for snapshots (backup)).

Udo