Centos 6.10 Swap File Issue Shows only 4K

Issues related to applications and software problems
Post Reply
User avatar
jmazaredo
Posts: 3
Joined: 2018/11/28 04:14:57
Location: Philippines
Contact:

Centos 6.10 Swap File Issue Shows only 4K

Post by jmazaredo » 2018/11/28 04:41:51

I have CentOs 6.10 with swapfile (3.81GB) on default install running with no problem.

I noticed my swap shows yesterday 4K only.
I tried removing and adding again but no avail still same.
Also I tried creating swapfile via DD and FALLOCATE with random sizes 4GB 3GB 8GB and do mkswap. When i check via free -h still shows only 4K

Summary I tried via partition and file stile same 4K (see below)

DMESG
Adding 4k swap on /home/swapfile. Priority:-2 extents:1 across:4k
Adding 4k swap on /dev/mapper/VolGroup-lv_swap. Priority:-1 extents:1 across:4k
Adding 4k swap on /home/swapfile. Priority:0 extents:1 across:4k
Adding 4k swap on /home/swapfile. Priority:0 extents:1 across:4k
Adding 4k swap on /dev/mapper/VolGroup-lv_swap. Priority:-1 extents:1 across:4k
Adding 4k swap on /home/swapfile1. Priority:-1 extents:1 across:4k
Adding 4k swap on /home/swapfile1. Priority:-1 extents:1 across:4k
Adding 4k swap on /home/swapfile1. Priority:-1 extents:1 across:4k
Adding 4k swap on /dev/mapper/VolGroup-swap. Priority:-1 extents:1 across:4k
Adding 4k swap on /dev/mapper/VolGroup-swap. Priority:-1 extents:1 across:4k
Adding 4k swap on /dev/mapper/VolGroup-swap. Priority:-1 extents:1 across:4k
Adding 4k swap on /dev/mapper/VolGroup-swap. Priority:-1 extents:1 across:4k
Adding 4k swap on /dev/mapper/VolGroup-swap. Priority:-1 extents:1 across:4k
Adding 4k swap on /dev/mapper/VolGroup-swapper. Priority:-1 extents:1 across:4k
Adding 4k swap on /home/swapfile. Priority:-2 extents:1 across:4k
Adding 4k swap on /dev/mapper/VolGroup-swapper. Priority:-1 extents:1 across:4k
Adding 4k swap on /home/swapfile. Priority:-2 extents:1 across:4k
Adding 4k swap on /home/swapfile. Priority:-1 extents:1 across:4k
Adding 4k swap on /home/swapfile1. Priority:-2 extents:1 across:4k
Adding 4k swap on /home/swapfile1. Priority:-1 extents:1 across:4k
Below are details of config
Filename Type Size Used Priority
/dev/dm-1 partition 4 0 -1
/home/swapfile file 4 0 -2


2.6.32-754.3.5.el6.i686 #1 SMP Tue Aug 14 21:12:17 UTC 2018 i686 i686 i386 GNU/Linux

/dev/mapper/VolGroup-lv_root / ext4 defaults 1 1
UUID=5ce1d9c1-e8de-452f-bab9-2c3c2c03a981 /boot ext4 defaults 1 2
/dev/mapper/VolGroup-lv_home /home ext4 grpquota,usrquota,rw 0 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/mapper/VolGroup-swapper swap swap defaults 0 0
/home/swapfile swap swap defaults 0 0

free command

total used free shared buffers cached
Mem: 8023744 6053716 1970028 3668 473260 4538548
-/+ buffers/cache: 1041908 6981836
Swap: 8 0 8


vmstat command

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 0 1964864 473624 4540312 0 0 287 339 173 215 3 1 93 3 0



NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdc 8:32 0 278.9G 0 disk
├─sdc1 8:33 0 500M 0 part /boot
└─sdc2 8:34 0 278.4G 0 part
├─VolGroup-lv_root (dm-0) 253:0 0 50G 0 lvm /
├─VolGroup-swapper (dm-1) 253:1 0 3.8G 0 lvm [SWAP]
└─VolGroup-lv_home (dm-2) 253:2 0 1.1T 0 lvm /home
sda 8:0 0 931.5G 0 disk
└─sda1 8:1 0 931.5G 0 part
└─md0 9:0 0 931.4G 0 raid1
└─VolGroup-lv_home (dm-2) 253:2 0 1.1T 0 lvm /home
sdb 8:16 0 931.5G 0 disk
└─sdb1 8:17 0 931.5G 0 part
└─md0 9:0 0 931.4G 0 raid1
└─VolGroup-lv_home (dm-2) 253:2 0 1.1T 0 lvm /home
sr0 11:0 1 1024M 0 rom
Iosef Tarasov: Everything's got a price, bitch.
John Wick: Not this bitch.

tunk
Posts: 564
Joined: 2017/02/22 15:08:17

Re: Centos 6.10 Swap File Issue Shows only 4K

Post by tunk » 2018/11/28 11:54:25

What's the output of: ls -la /home
Or maybe you could try to remove this from /etc/fstab:
/home/swapfile swap swap defaults 0 0

User avatar
jmazaredo
Posts: 3
Joined: 2018/11/28 04:14:57
Location: Philippines
Contact:

Re: Centos 6.10 Swap File Issue Shows only 4K

Post by jmazaredo » 2018/11/29 03:47:28

ls -la shows the file with the right size ex. i create 4G it will show 4G in ls -la
Already removed in fstab, added again reboot still 4k

Sample creating swap with different size still 4k
Using 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
Iosef Tarasov: Everything's got a price, bitch.
John Wick: Not this bitch.

Post Reply