2 swapfiles in /opt, but only one list in fstab?
Hi all,
Found 2 different sized swap files in the /opt folder:
Code:
root@serv:/home/adminpc# ls /opt
lost+found swapfile15g swapfile20g
root@serv:/home/adminpc#
In the fstab file, there is only one listed:
Code:
/opt/swapfile20g none swap sw 0 0
Can I delete the other one?
Regards
Re: 2 swapfiles in /opt, but only one list in fstab?
Probably yes. It looks like it remained from earlier and wasn't deleted when it stopped being used.
In any case you can check active swap with the following command too, and that file will probably not be in the list of used ones:
Re: 2 swapfiles in /opt, but only one list in fstab?
Quote:
Originally Posted by
Heeter
Can I delete the other one?
You (or the person setting up your server) was following my tutorial with their own customizations. If you re-read the "Swap File Management" section, it shows how to add and remove swap files safely.
LHammonds
Re: 2 swapfiles in /opt, but only one list in fstab?
Hey, Guys Thank you for your responses
It is the only one showing up on list
Lhammonds, I did use your tutorial to set up this server. I will use your tutorial to remove the extra swapfile.
Thank again Guys!!!!
Re: 2 swapfiles in /opt, but only one list in fstab?
If you are using LVM, don't use swapfiles. Use a swap LV.
Re: 2 swapfiles in /opt, but only one list in fstab?
Actually Thank you The FU
the swapfile is sitting in the /dev/LVG/opt folder, would that be considering swapLV?
Re: 2 swapfiles in /opt, but only one list in fstab?
Quote:
Originally Posted by
Heeter
Actually Thank you The FU
the swapfile is sitting in the /dev/LVG/opt folder, would that be considering swapLV?
No. If you didn't run
Code:
sudo mkswap /dev/{vgname}/{lvname}
then it isn't a swap partition/LV.
Re: 2 swapfiles in /opt, but only one list in fstab?
Quote:
Originally Posted by
TheFu
No. If you didn't run
Code:
sudo mkswap /dev/{vgname}/{lvname}
then it isn't a swap partition/LV.
Hi theFU! Thank you for responding!!!!.
If I understand your response correctly, the current swapfile sits in the /dev/LVG/opt folder and in the fstab file, with the command that you wrote, can the swap file stay in that folder? Or does it create a new swapfile in /dev/LVG/swap?
Just wondering if I should remove the current swapfile and remove the /dev/LVG/opt LVM?
Thank you again for being there for me.
Re: 2 swapfiles in /opt, but only one list in fstab?
sudo mkswap /dev/{vgname}/{lvname}
Either you did that or you didn't.
If you use lsblk, does it show /dev/{vgname}/{lvname} as an LV, type swap?
Something like this?
Code:
├─hadar--vg-swap_1 4.3G lvm swap [SWAP]
There is no "directory" called /dev/{vgname}/{lvname}. It is a symlink to a /dev/dm-{some number}
Code:
$ ll /dev/hadar-vg/
total 0
drwxr-xr-x 2 root root 300 Oct 2 18:36 ./
drwxr-xr-x 21 root root 4960 Oct 3 22:21 ../
lrwxrwxrwx 1 root root 7 Oct 3 20:48 libvirt-lv -> ../dm-2
lrwxrwxrwx 1 root root 7 Oct 3 20:48 root -> ../dm-0
lrwxrwxrwx 1 root root 7 Oct 3 20:48 swap_1 -> ../dm-1
I cleaned up that listing for clarity. There are many other LVs there, each pointing at a different ../dm-{some number} device.
Re: 2 swapfiles in /opt, but only one list in fstab?
Hi TheFU
Nope, it doesn't show up:
Code:
root@serv:/home/adminpc# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 1.8T 0 disk
└─sda1 8:1 0 1.8T 0 part /mnt/2TExternal
sdc 8:32 0 1.7T 0 disk
├─sdc1 8:33 0 1.9G 0 part /boot
├─sdc2 8:34 0 1K 0 part
└─sdc5 8:37 0 1.6T 0 part
├─LVG-root 253:0 0 4G 0 lvm /
├─LVG-usr 253:1 0 10G 0 lvm /usr
├─LVG-var 253:2 0 4G 0 lvm /var
├─LVG-tmp 253:3 0 3.5G 0 lvm /tmp
├─LVG-bak 253:4 0 7.5G 0 lvm /bak
├─LVG-srv 253:5 0 3.8G 0 lvm /srv
├─LVG-opt 253:6 0 52G 0 lvm /opt
├─LVG-home 253:7 0 1.8G 0 lvm /home
└─LVG-vmstorage 253:9 0 1.6T 0 lvm /var/vmstorage
sr0 11:0 1 1024M 0 rom
sr1 11:1 1 1024M 0 rom
root@serv:/home/adminpc#
Code:
root@serv:/home/adminpc# ll /dev/LVG
total 0
drwxr-xr-x 2 root root 220 Oct 3 12:56 ./
drwxr-xr-x 20 root root 4540 Oct 3 12:56 ../
lrwxrwxrwx 1 root root 7 Oct 2 17:16 bak -> ../dm-4
lrwxrwxrwx 1 root root 7 Oct 2 17:16 home -> ../dm-7
lrwxrwxrwx 1 root root 7 Oct 2 17:16 opt -> ../dm-6
lrwxrwxrwx 1 root root 7 Oct 2 17:16 root -> ../dm-0
lrwxrwxrwx 1 root root 7 Oct 2 17:16 srv -> ../dm-5
lrwxrwxrwx 1 root root 7 Oct 2 17:16 tmp -> ../dm-3
lrwxrwxrwx 1 root root 7 Oct 2 17:16 usr -> ../dm-1
lrwxrwxrwx 1 root root 7 Oct 2 17:16 var -> ../dm-2
lrwxrwxrwx 1 root root 7 Oct 2 17:16 vmstorage -> ../dm-9
root@serv:/home/adminpc#
Code:
root@serv:/home/adminpc# free -h
total used free shared buff/cache available
Mem: 94Gi 9Gi 452Mi 1.0Mi 83Gi 83Gi
Swap: 19Gi 24Mi 19Gi
root@serv:/home/adminpc#
](*,)
What can I do to fix this? Have to add this to the growing list of fixes on this setup, LOLOL