我调整了分区大小并删除了交换区域,如何更新 /etc/fstab 文件以重新启用交换?

我调整了分区大小并删除了交换区域,如何更新 /etc/fstab 文件以重新启用交换?

这是我当前的 fstab 文件内容:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sdb4 during installation
UUID=d5d25cbb-a5ab-4c28-92cd-3d1037563ec3 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sdb3 during installation
#UUID=1672c5d6-df35-432a-b850-23a1b7886bc3 none            swap    sw              0       0
/dev/mapper/cryptswap1 none swap sw 0 0

这是 sudo blkid 输出....

/dev/sda1: LABEL="Disco HDD" UUID="5ED2B771D2B74C51" TYPE="ntfs"
/dev/sdb1: LABEL="Reservado para el sistema" UUID="34DA6223DA61E19A" TYPE="ntfs" PARTUUID="e0ef6fba-01"
/dev/sdb2: UUID="5E9266DB9266B765" TYPE="ntfs" PARTUUID="e0ef6fba-02"
/dev/sdb4: UUID="d5d25cbb-a5ab-4c28-92cd-3d1037563ec3" TYPE="ext4" PARTUUID="e0ef6fba-04"
/dev/sdb5: LABEL="swap" UUID="a3a1b9ea-266d-47c8-955f-74a16e53a696" TYPE="swap" PARTUUID="e0ef6fba-05"

显然他们有不同的 UUID......

在此处输入图片描述

我应该如何更新 fstab 文件以便能够重新激活交换到新值?

编辑:

这是 swapon -s 命令的输出,这是什么意思?我创建的交换分区是否被使用?

Filename     Type            Size     Used  Priority
/dev/sdb5   partition       3070972     0      -1

答案1

根据以上数据,新行应如下所示:

UUID=a3a1b9ea-266d-47c8-955f-74a16e53a696 none            swap    sw              0       0

基本上,您只需将旧的 UUID 更改为新的 UUID,然后取消注释该行。

相关内容