Debian, Swap: Difference between revisions

From Andreida
m (Andreas moved page Swap to Debian, Swap)
No edit summary
 
(One intermediate revision by the same user not shown)
Line 37: Line 37:
If you want to see if your swap is currently used:
If you want to see if your swap is currently used:
swapon -s
swapon -s
<pre>
Filename Type Size Used Priority
/dev/sda5 partition 998396 0 -2
</pre>


If something is wrong, you can create and activate a swap partition/file:
If something is wrong, you can create and activate a swap partition/file:
mkswap /dev/hda2
mkswap /dev/hda2
swapon /dev/hda2
swapon /dev/hda2

There is a page about creating a swapfile: [[Debian, create swapfile]].

Latest revision as of 07:20, 5 January 2025

In your /etc/fstab should be an entry like

/dev/vda2        none            swap    sw              0       0

it might not point to a partition (/dev/vda2) but instead to a file and the "none" might be something different because it is (I think) not relevant for a swap partition.

It will NOT be mounted, so don't try to use

mount

to see if it is working.

With

df -hT

you see which partitions are known to your system and you get some information about them. BUT you normally will not see your swap partition, so that is NOT an error.

There are multiple tools you can use to check on devices. One of them - not better or worse than the others - is fdisk.

apt-get install fdisk
fdisk -l

It WILL show you swap partitions in a recognizeable way too. Something like

Device     Boot    Start      End  Sectors Size Id Type
/dev/vda1  *        2048 50329215 50327168  24G 83 Linux
/dev/vda2       50329216 52426367  2097152   1G 82 Linux swap / Solaris

Or you could use

apt-get install util-linux
lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda      8:0    0   20G  0 disk
├─sda1   8:1    0   19G  0 part /
├─sda2   8:2    0    1K  0 part
└─sda5   8:5    0  975M  0 part [SWAP]
sr0     11:0    1   51M  0 rom

If you want to see if your swap is currently used:

swapon -s
Filename                                Type            Size            Used            Priority
/dev/sda5                               partition       998396          0               -2

If something is wrong, you can create and activate a swap partition/file:

mkswap /dev/hda2
swapon /dev/hda2

There is a page about creating a swapfile: Debian, create swapfile.