The free command tells how much swap space is on a Linux system, but it doesn’t tell where it is. When this question pops up in my mind, I check the /etc/fstab file and the result is mostly accurate except on one server that I’ve just reinstalled.
The suspicious fstab file content seems to hint me that the swap space is on sdk2 disk partition, which I know is definitely not:
What’s the evidence? Well, the
To get further confirmation, I examine /proc/swaps:
Conclusion: To find out which disk partition is used for Linux swap space, try to check /proc/swaps file. In additional, confirm the size reported by “fdisk -l” and “free” command is matching.


The suspicious fstab file content seems to hint me that the swap space is on sdk2 disk partition, which I know is definitely not:
LABEL=SWAP-sdk2 swap swap defaults 0 0
What’s the evidence? Well, the
fdisk -l /dev/sdk shows there is no swap partition. Indeed, the only swap partition is on /dev/sda (first SCSI hard disk) and the partition size does match with the swap space reported by free command:
fdisk -l /dev/sda
Disk /dev/sda: 299.4 GB, 299439751168 bytes
255 heads, 63 sectors/track, 36404 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 2060 16442527+ 82 Linux swap
free -m
total used free shared buffers cached
Mem: 16043 842 15201 0 126 372
-/+ buffers/cache: 343 15700
Swap: 16057 0 16057
To get further confirmation, I examine /proc/swaps:
cat /proc/swaps Filename Type Size Used Priority /dev/sda2 partition 16442516 0 -1
Conclusion: To find out which disk partition is used for Linux swap space, try to check /proc/swaps file. In additional, confirm the size reported by “fdisk -l” and “free” command is matching.


Custom Search



2013 •