如何自动挂载交换分区?

Hri*_*gar 20 partitioning fstab mount

我在安装过程中没有使用交换分区,所以现在我的 ubuntu 已安装,我使用 GParted 分区编辑器创建一个未分配的分区,我将其格式化为 linux-swap。它没有自动挂载,所以我右键单击它并选择了 swapon。现在,每当我启动笔记本电脑时,分区都不会自动安装。Swapon 仍然有效,但如果分区没有在启动时挂载,它就无用了。我看到一些答案,其说是编辑名为fstab文件一些文件,但我给予一步一步的指示,因为我是一个我不知道什么样的变化,使...请帮我小白不知道Ubuntu 的 U,我遇到了很多问题...请帮助我!:'( :( 这是我的 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/sda2 during installation
UUID=33a0fc77-06b0-406c-95fd-15bf7033b619 /               ext4    errors=remount-ro 0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
Run Code Online (Sandbox Code Playgroud)

Rap*_*ael 23

这是你以前的/etc/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/sda2 during installation
UUID=33a0fc77-06b0-406c-95fd-15bf7033b619 /               ext4    errors=remount-ro 0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
Run Code Online (Sandbox Code Playgroud)

现在,要将交换分区添加到其中,请执行以下操作:

  1. 打开 Gparted。

    Gparted 截图

  2. 右键单击交换分区,然后单击信息

    在 Gparted 中选择分区

  3. 记下您的 UUID。

    分区信息中的 UUID

  4. 现在,/etc/fstab通过执行以下操作来修改您之前的 :


小智 5

输入终端:

gnome-disks 
Run Code Online (Sandbox Code Playgroud)

然后选择交换分区。在设置菜单中选择“编辑安装”选项。