Score:0

Where is my /dev/dm-2 2 GB swap partition?

cn flag

On a brand new Ubuntu 22.04.2 installation, swapon --show shows I have a 2 GB swap partition:

$ swapon --show
NAME      TYPE      SIZE USED PRIO
/dev/dm-2 partition 1.9G   0B   -2

Neither df -h, nor the gparted GUI, however, shows this partition anywhere. Where is it?

Update:

Note that I have a LUKS-encrypted install.

It may be in there. lsblk shows something in my nme0n1 disk:

nvme0n1               259:6    0   1.8T  0 disk  
├─nvme0n1p1           259:7    0   512M  0 part  /boot/efi
├─nvme0n1p2           259:8    0   1.7G  0 part  /boot
└─nvme0n1p3           259:9    0   1.8T  0 part  
  └─nvme0n1p3_crypt   253:0    0   1.8T  0 crypt 
    ├─vgubuntu-root   253:1    0   1.8T  0 lvm   /var/snap/firefox/common/host-hunspell
    │                                            /
    └─vgubuntu-swap_1 253:2    0   1.9G  0 lvm   [SWAP]

Here's what I see in gparted:

enter image description here

Gnome Disks doesn't show it either. Here's a snippet from Disks:

enter image description here

Update: double-clicking in gparted doesn't graphically show the two logical volumes, unfortunately, but it does list them under the "Logical Volumes" section at least! Here I see "root" and "swap_1" logical volumes after double-clicking the LUKS-encrypted partition in gparted:

enter image description here

Double-clicking in Gnome Disks has no effect.

Score:1
ng flag

It appears that your swap partition is a LVM partition under nvme0n1p3 which is an encrypted partition that also contains your root file system.

Swap partitions don't have a usable file system like ext4 so tools like df won't show your swap partition.

I don't know why it's not showing in gparted. Is your view showing the divisions underneath nvme0n1p3?

Gabriel Staples avatar
cn flag
`Is your view showing the divisions underneath nvme0n1p3?` No. See my gparted screenshot I just added to the question.
Nmath avatar
ng flag
Can you double click on the partition for more information? This is a tad difficult to reproduce without having the same set up. But you can see that your `/` partition is also not enumerated, so it's apparent that it doesn't mean it's missing.
Gabriel Staples avatar
cn flag
I just added a screenshot of the double-clicking in gparted.
Nmath avatar
ng flag
Under "logical volumes", it lists `root` and `swap_1`. `swapon` also shows it's set up correctly, so you're good
Score:0
cn flag

I figured out some more info. which adds additional insight.

Where is my /dev/dm-2 2 GB swap partition?

It's in my LUKS-encrypted partition. Although gparted and Gnome Disks both cannot show the LVM (Logical Volume Manager) volumes within LUKS partitions, blivet-gui, a 3rd partition manager program, can.

Use blivet-gui, instead of gparted or Gnome Disks, to see what is inside of LUKS-encrypted LVM volumes/partitions

Here's what it shows me:

As you can see, my nvme0n1 disk has 3 partitions, with the latter being a 1.82 TiB lvm volume it calls vgubuntu:

enter image description here

If I double-click on it, blivet-gui shows it contains two subvolumes, which it calls type lvmlv. One of my logical volumes is my vgubuntu-root 1.82 TiB root filesystem, and the other is my vgubuntu-swap_1 1.91 GiB swap partition, which is apparently swapon --show is showing as my /dev/dm-2 partition here:

$ swapon --show
NAME      TYPE      SIZE USED PRIO
/dev/dm-2 partition 1.9G   0B   -2

So, although my answer isn't complete either, it at least adds a little more insight. Use the blivet-gui partition editor to see what is inside LUKS-encrypted LVM volumes.

To install blivet-gui

From my answer here: Unix & Linux: How to edit/resize an LVM partition graphically (with a GUI)?:

See blivet-gui's own installation instructions: https://software.opensuse.org/download.html?project=home:vtrefny&package=blivet-gui

Namely, for Ubuntu 22.04 and 20.04:

# For Ubuntu 22.04
echo 'deb http://download.opensuse.org/repositories/home:/vtrefny/xUbuntu_22.04/ /' | sudo tee /etc/apt/sources.list.d/home:vtrefny.list
curl -fsSL https://download.opensuse.org/repositories/home:vtrefny/xUbuntu_22.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home_vtrefny.gpg > /dev/null
sudo apt update
sudo apt install blivet-gui

# For Ubuntu 20.04
echo 'deb http://download.opensuse.org/repositories/home:/vtrefny/xUbuntu_20.04/ /' | sudo tee /etc/apt/sources.list.d/home:vtrefny.list
curl -fsSL https://download.opensuse.org/repositories/home:vtrefny/xUbuntu_20.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home_vtrefny.gpg > /dev/null
sudo apt update
sudo apt install blivet-gui

# etc.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.