Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


No swap on CentOS 6 with kernel 2.6.32-754.3.5 ?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

No swap on CentOS 6 with kernel 2.6.32-754.3.5 ?

With kernel 2.6.32-754.3.5 (the latest available) swap is reduced to 4k on CentOS 6.

With the previous kernel this KVM box had 512MB swap. Swap partition is still there and functioning, it's just tiny :)

[root@serv:~] fdisk -l /dev/vda
...
   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *           1        1240     9959232   83  Linux
/dev/vda2            1240        1306      524288   82  Linux swap / Solaris
[root@serv:~] cat /etc/fstab
...
/dev/vda1        /             ext4    defaults        1 1
/dev/vda2        swap          swap    defaults        0 0
...
[root@serv:~] grep swap /var/log/dmesg
Adding 4k swap on /dev/vda2.  Priority:-1 extents:1 across:4k 
[root@serv:~] free
             total       used       free     shared    buffers     cached
Mem:        510432     114600     395832        236      12608      62224
-/+ buffers/cache:      39768     470664
Swap:            4          0          4

I see the same thing on a Xen VM also.

Ideas?

Comments

  • FrankZFrankZ Veteran
    edited September 2018

    I do not see the same issue.

    Linux yomama.acme.com 2.6.32-754.3.5.el6.x86_64 #1 SMP Tue Aug 14 20:46:41 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
    [root@yomama ~]# free
                 total       used       free     shared    buffers     cached
    Mem:        501844     421676      80168        220      47848     186248
    -/+ buffers/cache:     187580     314264
    Swap:       524284      39708     484576
    

    I would unmount and remount the swap partition as it should be 512MB.
    /dev/vda2 1240 1306 524288 82 Linux swap /

  • FranciscoFrancisco Top Host, Host Rep, Veteran

    check the partition size? :) Maybe it resized wrong.

    Francisco

  • Why do you think that's a problem? I usually build my VM's without any swap space.

  • frankbfrankb Member
    edited September 2018

    This sounds exactly like the problem I had on a Debian 9 Xen machine, and I wasn't the only one:
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=906992
    For now I'm running the old kernel vmlinuz-4.9.0-7-686-pae

  • Francisco said: check the partition size? :) Maybe it resized wrong.

    fdisk shows 524288 blocks.

  • FrankZ said: I do not see the same issue.

    Perhaps because you're 64bit? I'm 32bit.

    If I reboot to the previous kernel (2.6.32-754.2.1.el6.i686)...

    [root@serv:~] free -m
                 total       used       free     shared    buffers     cached
    Mem:           498         94        404          0          7         51
    -/+ buffers/cache:         35        463
    Swap:          511          0        511

    Then reboot to the latest kernel (2.6.32-754.3.5.el6.i686)...

    [root@serv:~] free -m
                 total       used       free     shared    buffers     cached
    Mem:           498         97        401          0          7         52
    -/+ buffers/cache:         37        461
    Swap:            0          0          0
    [root@serv:~] grep Swap /proc/meminfo 
    SwapCached:            0 kB
    SwapTotal:             4 kB
    SwapFree:              4 kB
  • I created an 80M swapfile. It also is seen as 4k.

    [root@serv:~] swapon -s
    Filename        Type        Size     Used      Priority
    /dev/vda2       partition   4        0         -1
    /swapfile       file        4        0         -2
    [root@serv:~] grep Swap /proc/meminfo 
    SwapCached:            0 kB
    SwapTotal:             8 kB
    SwapFree:              8 kB

    Lots of references to swap in the 2.6.32-754.3.5 kernel changelog. Methinks someone broke something -- at least for 32bit systems.

    Anyone else with a CentOS 6 32bit VM?

  • @sleddog swapon, swapoff?

  • SolidxGaming said: @sleddog swapon, swapoff?

    Tried. No error, but result is 4k swap space as before.

    Then tried swapon -f. No error, no change.

    Using swapon -v it looks like everything is OK:

    [root@serv:~] swapon -v /dev/vda2
    swapon on /dev/vda2
    swapon: /dev/vda2: found swap signature: version 1, page-size 4, same byte order
    swapon: /dev/vda2: pagesize=4096, swapsize=536870912, devsize=536870912

    But I still have only 4k swap:

    [root@serv:~] swapon -s
    Filename        Type        Size     Used      Priority
    /dev/vda2       partition   4        0         -1

    /var/log/messages...

    Sep 15 11:07:51 serv kernel: Adding 4k swap on /dev/vda2.  Priority:-2 extents:1 across:4k
  • I saw the same issue on my 32 bit install and reverted to the previous kernel, I was doing a quick update and I didn't have the time to properly diagnose.

    Before I reverted, I did try adding additional swap on the regular file system using a loop back device, it also only gave me 4k.

    Thanked by 1sleddog
  • @sleddog said:
    Anyone else with a CentOS 6 32bit VM?

    It's probably not related since it looks like you are using less than 4Gb mem but are you using a kernel with PAE?

    From your output - it doesn't look like you will have any benefits from having a swap partition. Is lack of swap actually a problem?

    BTW - I noticed that you are using paravirtualized drivers. Maybe there's a quota being set by the hypervisor for that device. That's probably where I would look.

  • birchbeer said: It's probably not related since it looks like you are using less than 4Gb mem but are you using a kernel with PAE?

    No.

    birchbeer said: From your output - it doesn't look like you will have any benefits from having a swap partition. Is lack of swap actually a problem?

    Lack of swap is not a problem. Total inability to have swap is.

    birchbeer said: BTW - I noticed that you are using paravirtualized drivers. Maybe there's a quota being set by the hypervisor for that device. That's probably where I would look.

    I think this is ruled out by the fact the swap works as expected when using the previous kernel.

    Thanks for the comments.

  • @sleddog said:
    I think this is ruled out by the fact the swap works as expected when using the previous kernel.

    Hmmm. I am curious about your problem. I just installed Centos 6 - 32bit using kernel 2.6.32-754.3.5 and I don't see the problem.

    [root@localhost ~]# uname -r
    2.6.32-754.3.5.el6.i686
    [root@localhost ~]# free -h
                        total       used       free     shared    buffers     cached
    Mem:          498M       119M       378M       164K       5.1M        37M
     -/+ buffers/cache:        77M       420M
    Swap:         1.0G         0B       1.0G
    

    The only difference from what I can tell is that I am not using paravirtualization.

  • birchbeer said: The only difference from what I can tell is that I am not using paravirtualization.

    It's a KVM. What are you running on?

  • @sleddog I spun a CentOS 6 Vultr instance (KVM) in attempt to re-produce this issue but couldn't:

    [root@vultr ~]# uname -r
    2.6.32-754.el6.i686
    
    [root@vultr ~]# free -m
                 total       used       free     shared    buffers     cached
    Mem:           498         56        441          0          5         30
    -/+ buffers/cache:         21        476
    Swap:            0          0          0
    
    [root@vultr ~]# dd if=/dev/zero of=swap.bin bs=1M count=512
    512+0 records in
    512+0 records out
    536870912 bytes (537 MB) copied, 1.53301 s, 350 MB/s
    
    [root@vultr ~]# mkswap swap.bin 
    mkswap: swap.bin: warning: don't erase bootbits sectors
            on whole disk. Use -f to force.
    Setting up swapspace version 1, size = 524284 KiB
    no label, UUID=95b10e30-9273-4e28-bd26-18bee1c27033
    
    [root@vultr ~]# swapon swap.bin 
    
    [root@vultr ~]# free -m
                 total       used       free     shared    buffers     cached
    Mem:           498        490          7          0          1        460
    -/+ buffers/cache:         28        469
    Swap:          511          0        511
    
    [root@vultr ~]# 
    
    Thanked by 1sleddog
  • @sleddog - I am using a VMWare host. And I used a LVM partition for swap.

    If you need swap space, your other option instead of using a partition is to use a swapfile instead. The example provided by @akb is for a swapfile. Perhaps there's an issue with paravirtualized swap partitions with KVM.

  • birchbeer said: If you need swap space, your other option instead of using a partition is to use a swapfile instead. The example provided by @akb is for a swapfile.

    I already did this (as explained above). After 'swapon', the swapfile is also 4k. So I get a total of 8k swap...

    [root@serv:~] swapon -s
    Filename        Type        Size     Used      Priority
    /dev/vda2       partition   4        0         -1
    /swapfile       file        4        0         -2
  • sleddogsleddog Member
    edited September 2018

    @akb said:
    @sleddog I spun a CentOS 6 Vultr instance (KVM) in attempt to re-produce this issue but couldn't:

    [root@vultr ~]# uname -r
    2.6.32-754.el6.i686
    

    Different kernel version. I think you're one behind. I have:

    [root@serv:/] uname -r
    2.6.32-754.3.5.el6.i686

    2.6.32-754.el6.i686 doesn't have the issue for me.

  • akbakb Member
    edited September 2018

    @sleddog said:

    @akb said:
    @sleddog I spun a CentOS 6 Vultr instance (KVM) in attempt to re-produce this issue but couldn't:

    [root@vultr ~]# uname -r
    2.6.32-754.el6.i686
    

    Different kernel version. I think you're one behind. I have:

    [root@serv:/] uname -r
    > 2.6.32-754.3.5.el6.i686

    2.6.32-754.el6.i686 doesn't have the issue for me.

    My bad. Launched another instance and did a yum update this time to update to the latest kernel: 2.6.32-754.3.5.el6.i686 in CentOS 6 repo before testing. Still unable to re-produce the issue:

    [root@vultr ~]# uname -r
    2.6.32-754.3.5.el6.i686
    
    [root@vultr ~]# free -m
                 total       used       free     shared    buffers     cached
    Mem:           498         52        445          0          5         26
    -/+ buffers/cache:         20        477
    Swap:            0          0          0
    
    [root@vultr ~]# dd if=/dev/zero of=swap.bin bs=1M count=512
    512+0 records in
    512+0 records out
    536870912 bytes (537 MB) copied, 1.73676 s, 309 MB/s
    
    [root@vultr ~]# mkswap swap.bin
    mkswap: swap.bin: warning: don't erase bootbits sectors
            on whole disk. Use -f to force.
    Setting up swapspace version 1, size = 524284 KiB
    no label, UUID=8a85af2a-4ba1-42e1-9f0b-95d10dd8b43f
    
    [root@vultr ~]# swapon swap.bin 
    
    [root@vultr ~]# free -m
                 total       used       free     shared    buffers     cached
    Mem:           498        491          7          0          1        460
    -/+ buffers/cache:         28        469
    Swap:          511          0        511
    
    [root@vultr ~]# 
    
    Thanked by 1sleddog
  • sleddogsleddog Member
    edited September 2018

    akb said: Still unable to re-produce the issue

    So there's something different between Vultr KVM and my KVM provider.

    I've opened a ticket with the provider asking for comment.

    I have one other CentOS 6 VM, XEN virtualization (XEN PV I think), which shows the same problem.

    Any providers who'd like to chime in here, experiment, and share their knowledge are welcome :)

    Summary:

    On some CentOS 6 VMs:

    • With kernel 2.6.32-754.el6.i686 swap works as expected
    • With kernel 2.6.32-754.3.5.el6.i686 swap (partition or swapfile) becomes 4k
  • On Vultr, I had no swap on Debian. It might a customization on their end.

  • Seen and reproduced on a fresh minimal install. Appears to depend in VM platform. dediserve and brightbox vm's exhibit this issue.

Sign In or Register to comment.