/dev/centos/swap missing

General support questions
Post Reply
sdbhabal
Posts: 19
Joined: 2011/03/02 11:31:49

/dev/centos/swap missing

Post by sdbhabal » 2018/02/20 09:21:11

Hello Guys,

I am running into weird issue.
I have rebooted my Centos 7.1.1503 server today morning.
After reboot, Centos unable to find swap partition.

In lvdisplay, it is showing LV Status as suspended.
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID 6Gr4Om-xEBB-Ab56-jubd-YdLa-wYO5-scqiz0
LV Write Access read/write
LV Creation host, time localhost, 2015-11-19 10:05:39 +0530
LV Status suspended
# open 0
LV Size 103.87 GiB
Current LE 26591
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1

--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID CB3xsr-lJ2i-RggZ-56R1-yMGu-xUy5-EELUU4
LV Write Access read/write
LV Creation host, time localhost, 2015-11-19 10:05:39 +0530
LV Status available
# open 1
LV Size 483.58 GiB
Current LE 123796
Segments 4
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0

[root@localhost ~]#

Also I am trying to look for the swap file, it is showing file does not exist.
[root@localhost ~]# ll /dev/centos/swap
ls: cannot access /dev/centos/swap: No such file or directory
[root@localhost ~]#

Guys please help.

pjsr2
Posts: 614
Joined: 2014/03/27 20:11:07

Re: /dev/centos/swap missing

Post by pjsr2 » 2018/02/20 11:40:16

What does /etc/fstab say about the swap partition?

You should update your CentOS installation as soon as possible. CentOS 7.1.1503 is old and many (security) fixes have been added since.

sdbhabal
Posts: 19
Joined: 2011/03/02 11:31:49

Re: /dev/centos/swap missing

Post by sdbhabal » 2018/02/20 12:20:29

Resolved this issue with below steps:

fdisk -l
Make sure swap space is formatted with the 82 ID
In my case e.g. /dev/sdb1 is formatted with the 82

Turn off existing swap space
swapoff -v /dev/mapper/centos-swap

mkswap /dev/sdb1

Add entry for persitant
vim /etc/fstab

Turn On the newly created Swap Space
swapon -a

Verifiy with the below command
free -m

Post Reply