1

I am looking to enable hibernation on Ubuntu 18.04.

I'd like to know if my swapfile exists and is being recognized as a swapfile. Not sure if I have swap, or if one part of the system does not recognize swap, or if I do not have swap.

$ sudo filefrag -v /dev/nvme0n1p4
Filesystem type is: 1021994
File size of /dev/nvme0n1p4 is 0 (0 blocks of 4096 bytes)
/dev/nvme0n1p4: 0 extents found

$ swapon -s Filename Type Size Used Priority /dev/nvme0n1p4 partition 16191484 0 -2

Ubuntu Disk Driver shows a 16G partition for swap under the same.

TIA.

wip
  • 11

1 Answers1

0

You can list the active swap devices with

swapon --show

or with

cat /proc/swaps

If you created your swap file as a sparse file (https://en.wikipedia.org/wiki/Sparse_file), it is possible that it actually has 0 blocks allocated if it never was in active use so far. Check its allocated size with

du -h myswapfile

and compare with

ls -lh myswapfile

(I guess that's what you wanted to achieve with that filefrag -v command which does something similar by coincidence)

HuHa
  • 3,525