系统监视器中交换不可用

系统监视器中交换不可用

我创建了一个 5 GB 的交换分区,但我总是注意到它在系统监视器上被标记为“不可用”,而且当我执行操作时会消耗整个 RAM,ubuntu 会开始终止以释放 RAM,而 SWAP 根本没有用处

我在终端输入了sudo mountall -v 以下内容

mounted event handled for /proc/sys/fs/binfmt_misc local 1/5 remote 0/0 virtual 1/12 swap 0/1 mounted event handled for /sys local 1/5 remote 0/0 virtual 2/12 swap 0/1 mounted event handled for /sys/fs/fuse/connections local 1/5 remote 0/0 virtual 3/12 swap 0/1 mounted event handled for /sys/kernel/security local 1/5 remote 0/0 virtual 4/12 swap 0/1 mounted event handled for /dev/pts local 1/5 remote 0/0 virtual 5/12 swap 0/1 mounted event handled for /run/lock local 1/5 remote 0/0 virtual 6/12 swap 0/1 mounted event handled for /run/shm local 1/5 remote 0/0 virtual 7/12 swap 0/1 mounted event handled for /home/ahmed/.gvfs local 2/5 remote 0/0 virtual 7/12 swap 0/1 mounted event handled for /media/UbuntuGeneralFiles local 3/5 remote 0/0 virtual 7/12 swap 0/1 mounted event handled for /media/ONCE\040AND\040FOR\040ALL local 4/5 remote 0/0 virtual 7/12 swap 0/1 mounting event handled for /tmp mounted event handled for /dev local 4/5 remote 0/0 virtual 8/12 swap 0/1 mounted event handled for /proc local 4/5 remote 0/0 virtual 9/12 swap 0/1 mounted event handled for /sys/kernel/debug local 4/5 remote 0/0 virtual 10/12 swap 0/1 mounted event handled for /run local 4/5 remote 0/0 virtual 11/12 swap 0/1 mounted event handled for /home/ahmed virtual finished remote finished local 4/5 remote 0/0 virtual 12/12 swap 0/1 mounted event handled for /tmp local finished All filesystems mounted local 5/5 remote 0/0 virtual 12/12 swap 0/1

这是 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>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sdf1 during installation
UUID=34c3c29b-e5dd-4ed7-a49b-616afded4704 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sdf2 during installation
#UUID=9a7f0b9c-9be9-4074-8957-afcf25072bbe none            swap    sw              0       0
/dev/mapper/cryptswap1 none swap sw 0 0
/dev/disk/by-label/swap /mnt/swap auto nosuid,nodev,nofail 0 0
/dev/sdb2 /mnt/sdb2 ext4 nosuid,nodev,nofail 0 0

sudo blkid 这是`的输出

  /dev/sda1: UUID="AC9C59EA9C59B016" TYPE="ntfs" 
/dev/sda2: LABEL="System" UUID="C26CFB2E6CFB1C3B" TYPE="ntfs" 
/dev/sda3: LABEL="ONCE AND FOR ALL" UUID="3EF60BD0F60B86FD" TYPE="ntfs" 
/dev/sdb1: UUID="34c3c29b-e5dd-4ed7-a49b-616afded4704" TYPE="ext4" 
/dev/sdb2: LABEL="Swap" UUID="21cf04d1-6c18-4ab7-a8c3-ec435ab3f43e" TYPE="ext4" 
/dev/sdb5: LABEL="UbuntuGeneralFiles" UUID="E636244736241AD7" TYPE="ntfs" 
/dev/sr1: LABEL="Etisalat 3.5G" TYPE="iso9660" 

`sudo fdisk -l:

Disk /dev/sda: 1000.2 GB, 1000203804160 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953523055 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: 0x0d91aeaa

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      206847      102400    7  HPFS/NTFS/exFAT
/dev/sda2          206848   209717247   104755200    7  HPFS/NTFS/exFAT
/dev/sda3       209717248  1953519615   871901184    7  HPFS/NTFS/exFAT

Disk /dev/sdb: 250.1 GB, 250059350016 bytes
64 heads, 32 sectors/track, 238475 cylinders, total 488397168 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: 0x00000001

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048   236331007   118164480   83  Linux
/dev/sdb2       236333056   244148221     3907583   82  Linux swap / Solaris
/dev/sdb3       244148222   488396799   122124289    5  Extended
/dev/sdb5       244148224   488396799   122124288    7  HPFS/NTFS/exFAT`

我不知道实际上发生了什么,有什么帮助吗?

答案1

13.10

如果其他人在 13.10 上遇到类似的问题,我在 ArchWiki 上找到了这些说明。

检查交换状态:

swapon -s

或者

free -m

如果没有列出任何内容(您没有交换),您可以在正在运行的系统上创建它,如下所示:

首先,列出可用的分区使用:

sudo blkid

mkswap 实用程序默认为分区生成一个 UUID,因此最好使用 -U 标志来指定交换 UUID(如果已存在)。将“custom_UUID”替换为前面列出的相应 UUID。此外,将 /dev/sda5 替换为要用于交换的分区:

警告:指定分区上的所有数据将丢失。

sudo mkswap -U custom_UUID /dev/sda5

如果未列出交换分区,则blkid可以使用以下命令分配随机 UUID:

sudo mkswap /dev/sda5

要在此设备上启用交换:

sudo swapon /dev/sda5

现在,检查 /etc/fstab 以确保系统将在启动时挂载该分区。我将使用 gedit,但任何文本编辑器都可以。

sudo gedit /etc/fstab

如果没有列出交换,您可能需要使用 /dev/sda5 或 UUID 将其添加到列表末尾。

/dev/sda5 none swap defaults 0 0

重启

我希望这有帮助。

答案2

使用 gparted GUI 的解决方案:

打开 gparted,然后左键单击交换分区并在上下文菜单中选择 swapon。

答案3

看起来交换分区存在,但请检查它cat /proc/swaps,然后尝试激活它sudo swapon --all

相关内容