13

Why don't I have a swap partition in my installation?

$ lsblk
nvme0n1     259:0    0 238.5G  0 disk 
└─nvme0n1p1 259:1    0 238.5G  0 part /

Did I install Ubuntu/ Kubuntu wrong?

I thought it should be like this:

nvme0n1     259:0    0 238.5G  0 disk 
├─nvme0n1p5 259:3    0  15.9G  0 part [SWAP]
├─nvme0n1p1 259:1    0 222.6G  0 part /
└─nvme0n1p2 259:2    0     1K  0 part 

I just picked what was suggested during the installation. But it seems odd.

Zanna
  • 72,312
Run
  • 2,748

1 Answers1

26

There's nothing wrong. In fresh installations of 17.04 we have a swap file instead of a swap partition, as mentioned in the release notes (if you upgrade rather than install afresh, you will still have a swap partition).

The swap file is located at

/swapfile

You can always check the status of swap with the command swapon --show.
Here's my output in 17.04:

$ swapon --show
NAME      TYPE SIZE  USED PRIO
/swapfile file 1.3G 62.2M   -1

You can also see if it's being used with the free command as usual

$ free -h
              total        used        free      shared  buff/cache   available
Mem:           1.9G        1.3G        152M         95M        423M        328M
Swap:          1.3G         62M        1.3G

See - working just fine.

According to the Arch wiki

There is no performance advantage to either a contiguous swap file or a partition, both are treated the same way.

It just provides a little more flexibility; it's easier to resize.

Minor note: Btrfs (alternative filesystem to ext4) does not support swap file usage, so you will need to create a swap partition yourself if you want to use Btrfs. But if you're brave enough to use Btrfs, you surely know what you're doing anyway ;)

Zanna
  • 72,312