我有一台带2GB RAM的笔记本电脑,但没有购买更多 RAM 的资金。自从我安装了 64 位 Mint(MATE 桌面版)后,我使用的内存超过 1GB,而我使用 32 位 Cinnamon 时的内存为 170 - 500MB。
我创建了一个交换分区,现在我想永久设置它,以便在启动/重新启动时激活它。有人可以帮助我使用在 ROOT 终端中使用的命令吗?
PS:下面是 fdisk -l 的列表,显示驱动器分区
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000814ae
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 718847 358400 7 HPFS/NTFS/exFAT
/dev/sda2 718848 571549695 285415424 7 HPFS/NTFS/exFAT
/dev/sda3 571549696 781264895 104857600 7 HPFS/NTFS/exFAT
/dev/sda4 781264896 976771071 97753088 f W95 Ext'd (LBA)
/dev/sda5 781266944 966531071 92632064 7 HPFS/NTFS/exFAT
/dev/sda6 966533120 976771071 5118976 82 Linux swap / Solaris
Disk /dev/sdb: 8100 MB, 8100249600 bytes
204 heads, 51 sectors/track, 1520 cylinders, total 15820800 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000d308d
Device Boot Start End Blocks Id System
/dev/sdb1 2048 15820799 7909376 83 Linux
Run Code Online (Sandbox Code Playgroud)
这是我的 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> unt point> <type> <options> <dump> <pass>
/host/linuxmint/disks/root.disk / ext4 loop,errors=remount-ro 0 1
/host/linuxmint/disks/swap.disk none swap loop,sw 0 0
# a swapfile is not a swap partition, so no using swapon|off from here on
#use dphys-swapfile swap[on|off] for that
Run Code Online (Sandbox Code Playgroud)
启动您最喜欢的编辑器并打开/etc/fstab
. 由于这是一个系统范围的配置文件,您要么需要以 root 身份(或任何其他 uid 0 的帐户)执行此操作,要么需要以额外权限 (sudo) 启动编辑器。
找到一个空行并添加/dev/sda6 swap swap defaults 0 0
.
保存,然后用“swapon -a”进行测试。
解释:
/etc/fstab 包含有关要挂载哪些分区以及这些分区使用哪些文件系统进行格式化的信息。其中大部分将在您启动时自动添加。(例外:noauto
选项)。
交换分区被视为任何其他分区,只是没有挂载点。
这是典型的 fstab 文件的外观:
# file system mount-point type options dump fsck_order
#
/dev/sda1 / ext2 defaults 0 0
/dev/sda2 /usr ext2 defaults 0 1
/dev/sda3 /usr/local ext2 defaults 0 1
/dev/sda4 /home ext2 defaults, noatime 0 1
# Disk 2
#
/dev/sdb1 /tmp ext2 defaults, noatime 0 0
/dev/sdb2 swap swap defaults 0 0
Run Code Online (Sandbox Code Playgroud)
在 fstab 中输入 en 后,您可以通过使用命令打开所有标准交换位置来测试它swapon -a
。
归档时间: |
|
查看次数: |
2325 次 |
最近记录: |