我在 /swapfile1 下有一个 8GB 的交换文件,每次登录时我都必须在终端中手动加载它。我尝试按照此线程中的建议修改 fstab添加新的交换文件。如何编辑 fstab 以在重启后启用交换?没有成功。我需要在 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>
/dev/mapper/nvme0n1p6_crypt / ext4 errors=remount-ro 0 1
# /boot was on /dev/nvme0n1p5 during installation
UUID=0caeaa04-232f-4181-87a6-cab787ef6d0c /boot ext4 defaults 0 2
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=666E-4F0F /boot/efi vfat umask=0077 0 1
答案1
您应该添加类似这样的内容:
/swapfile1 none swap sw 0 0
到 /etc/fstab。