View Issue Details

IDProjectCategoryView StatusLast Update
0015499CentOS-6util-linux-ngpublic2019-02-05 07:35
Reporterjmazaredo 
PrioritynormalSeveritytrivialReproducibilityhave not tried
Status newResolutionopen 
PlatformCentos 6.10OSCentos 6.10OS VersionCentos 6.10
Product Version6.10 
Target VersionFixed in Version 
Summary0015499: Swap Issue : Tried creating new swap but always show 4K in free -h command
DescriptionCreating swap file only shows 4k total . used different kernel | CentOS (2.6.32-754.6.3.el6.i686) |
| CentOS (2.6.32-754.3.5.el6.i686) | Both file and partition shows only 4K

[root@sever1 home]# cat /proc/swaps
Filename Type Size Used Priority
/home/swapfile file 4 0 -1
/dev/dm-1 partition 4 0 -2
[root@server1 home]#


Followed https://www.centos.org/docs/5/html/5.2/Deployment_Guide/s2-swap-creating-file.html
Additional InformationUsing two kernels

<< | CentOS (2.6.32-754.6.3.el6.i686) | >>
<< | CentOS (2.6.32-754.3.5.el6.i686) | >>

Server Logs

Nov 25 14:03:53 server kernel: 45591 pages in swap cache
Nov 25 14:03:53 server kernel: Free swap = 168kB
Nov 25 14:03:53 server kernel: Total swap = 3997692kB
Nov 25 14:40:38 server kernel: Kernel command line: ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=129M@0M rd_LVM_LV=VolGroup/lv_root KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
Nov 25 14:40:38 server kernel: dracut: Scanning devices sdc2 for LVM logical volumes VolGroup/lv_swap VolGroup/lv_root
Nov 25 14:40:38 server kernel: dracut: inactive '/dev/VolGroup/lv_swap' [3.81 GiB] inherit
Nov 25 14:40:38 server kernel: Adding 4k swap on /dev/mapper/VolGroup-lv_swap. Priority:-1 extents:1 across:4k
Nov 26 10:41:28 server kernel: Adding 4k swap on /swapfile. Priority:-2 extents:1 across:4k
Nov 27 03:16:27 server kernel: 2 pages in swap cache
Nov 27 03:16:27 server kernel: Free swap = 0kB
Nov 27 03:16:27 server kernel: Total swap = 8kB
Nov 27 04:27:12 server kernel: 2 pages in swap cache
Nov 27 04:27:12 server kernel: Free swap = 0kB
Nov 27 04:27:12 server kernel: Total swap = 8kB


Recreate Again

[root@server1 home]# uname -a
Linux server1. 2.6.32-754.3.5.el6.i686 #1 SMP Tue Aug 14 21:12:17 UTC 2018 i686 i686 i386 GNU/Linux
[root@server1 home]# swapoff -a
[root@server1 home]# dd if=/dev/zero of=/home/swapfile bs=1024 count=65536
65536+0 records in
65536+0 records out
67108864 bytes (67 MB) copied, 0.361016 s, 186 MB/s
[root@server1 home]# mkswap /home/swapfile
mkswap: /home/swapfile: warning: don't erase bootbits sectors
        on whole disk. Use -f to force.
Setting up swapspace version 1, size = 65532 KiB
no label, UUID=14d48fcc-0b2d-4dc5-820e-d4e0b8f5eba4
[root@server1 home]# swapon /home/swapfile
[root@server1 home]# cat /proc/swaps
Filename Type Size Used Priority
/home/swapfile file 4 0 -1
[root@server1 home]# free -h
             total used free shared buffers cached
Mem: 7.7G 4.4G 3.2G 3.6M 467M 1.0G
-/+ buffers/cache: 2.9G 4.7G
Swap: 4K 0B 4K
[root@server1 home]#

Nov 28 16:03:44 server1 kernel: Adding 4k swap on /home/swapfile. Priority:-1 extents:1 across:4k
TagsNo tags attached.

Activities

cemc

cemc

2018-11-29 08:41

reporter   ~0033175

I'm having the same issue, on a 32 bit CentOS, in a Virtualbox VM.
This guest was moved from a physical hardware to Virtualbox a couple of days ago. On the physical machine there was no problem.
I also tried to create the swapfile from /dev/urandom, still no luck.
cemc

cemc

2018-11-29 08:47

reporter   ~0033176

Also tried with the same two kernels, no change, when booting, the /swapfile is used, but it's showing only 4k size, and the logs:

Adding 4k swap on /swapfile. Priority:-1 extents:1 across:4k

[root@ftp ~]# ls -la /swapfile
-rw------- 1 root root 1073741824 Nov 29 10:28 /swapfile

[root@ftp ~]# du -sb /swapfile
1073741824 /swapfile
cemc

cemc

2018-11-29 09:15

reporter   ~0033177

Update:

2.6.32-754.2.1.el6.i686 - swap is working ok
2.6.32-754.3.5.el6.i686 - not working
2.6.32-754.6.3.el6.i686 - not working
post-factum

post-factum

2019-01-29 10:27

reporter   ~0033718

Mind sharing `dmesg`, `cat /proc/cpuinfo` and `dmidecode` please?
post-factum

post-factum

2019-02-05 07:34

reporter   ~0033776

Upstream commit 9df9516940a61d29aedf4d91b483ca6597e7d480 fixes the issue.
post-factum

post-factum

2019-02-05 07:35

reporter   ~0033777

RHEL bugs:

  * https://bugzilla.redhat.com/show_bug.cgi?id=1670328
  * https://bugzilla.redhat.com/show_bug.cgi?id=1635960

Issue History

Date Modified Username Field Change
2018-11-28 08:18 jmazaredo New Issue
2018-11-29 08:41 cemc Note Added: 0033175
2018-11-29 08:47 cemc Note Added: 0033176
2018-11-29 09:15 cemc Note Added: 0033177
2019-01-29 10:27 post-factum Note Added: 0033718
2019-02-05 07:34 post-factum Note Added: 0033776
2019-02-05 07:35 post-factum Note Added: 0033777