为什么swapsize小于交换分区的devsize?

为什么swapsize小于交换分区的devsize?

我的笔记本电脑运行的是启用了 LVM 的 Debian 11。

现在磁盘空间组织如下

disk
├──512 MiB FAT32 for EFI
├──488 MiB EXT2 for Linux boot
└──476 GiB LVM2 PV as the main storage
   ├──377 GiB EXT4 mounted as /
   ├──16 GiB linuxswap
   └──82 GiB unallocated space (prepared for Windows but still not used)

使用交换分区。这初始尺寸交换空间设置为大约 1 GiB。然后我发现休眠不可用,因此我将交换分区扩展到与RAM相同的大小。但交换大小并未扩展。

我已经尝试swapoff/swapon并重新启动了笔记本电脑几次。问题仍然存在。我检查过/etc/fstab,但交换大小没有硬编码。

如何解决这个问题呢?下面列出了一些命令的详细输出


$ sudo fdisk -l
Disk /dev/nvme0n1: 476.94 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: SAMSUNG MZALQ512****-00***
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 16384 bytes / 131072 bytes
Disklabel type: gpt
Disk identifier: 78F7570F-9AF4-42D7-9EA9-0695511652FB

Device           Start        End   Sectors  Size Type
/dev/nvme0n1p1    2048    1050623   1048576  512M EFI System
/dev/nvme0n1p2 1050624    2050047    999424  488M Linux filesystem
/dev/nvme0n1p3 2050048 1000214527 998164480  476G Linux LVM

Disk /dev/mapper/ggg--vg-root: 377.35 GiB, 405173960704 bytes, 791355392 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 16384 bytes / 131072 bytes

Disk /dev/mapper/ggg--vg-swap_1: 16 GiB, 17179869184 bytes, 33554432 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 16384 bytes / 131072 bytes


$ sudo swapon --all --verbose
swapon: /dev/mapper/ggg--vg-swap_1: found signature [pagesize=4096, signature=swap]
swapon: /dev/mapper/ggg--vg-swap_1: pagesize=4096, swapsize=1027604480, devsize=17179869184
swapon /dev/mapper/ggg--vg-swap_1


$ sudo blkid
/dev/nvme0n1p1: UUID="FDE0-715D" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="5222097f-d402-4d88-8dc2-43d612eabc00"
/dev/nvme0n1p2: UUID="1212fdd8-86c7-4277-9ecd-39d1c3c3caad" BLOCK_SIZE="1024" TYPE="ext2" PARTUUID="a48e5723-f026-4987-bd64-8e7aeeffd39e"
/dev/nvme0n1p3: UUID="puRvR1-fytt-oaKp-AxPP-qK81-8XRR-ymx0JC" TYPE="LVM2_member" PARTUUID="ac420ba1-b2dc-47d2-8089-607419b12acc"
/dev/mapper/ggg--vg-root: UUID="ea3cea08-1660-4343-b309-72dd8a1a1c55" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/ggg--vg-swap_1: UUID="449f099a-5189-428e-a317-0ad03669ecfb" TYPE="swap"


$ cat /etc/fstab
# /etc/fstab: static file system information.
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/ggg--vg-root /               ext4    errors=remount-ro 0       1
# /boot was on /dev/nvme0n1p2 during installation
UUID=1212fdd8-86c7-4277-9ecd-39d1c3c3caad /boot           ext2    defaults        0       2
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=FDE0-715D  /boot/efi       vfat    umask=0077      0       1
/dev/mapper/ggg--vg-swap_1 none            swap    sw              0       0

答案1

增加交换卷的大小不会影响“交换”数据的大小。

尝试

swapoff -a
mkswap /dev/mapper/ggg--vg-swap_1
swapon -a

相关内容