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.

  • try cat /proc/swaps – phuclv Apr 30 '17 at 3:14
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 ;)

| improve this answer | |
  • @Zanna the /swapfile and a swap partition serve a similar function, except in the case of hibernation, correct? – heynnema Apr 29 '17 at 21:13
  • 1
    If I just upgraded an older system that installed with a swap partition to 17.04, should I delete my old swap partition? – cat Apr 29 '17 at 22:44
  • @cat - you should make that another question... – HorusKol Apr 30 '17 at 1:54
  • 1
  • btrfs has become production ready a while ago, it's only some features that are (still) experimental; it's not correct to treat the whole FS as experimental... – heemayl Apr 30 '17 at 3:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.