【发布时间】:2013-11-01 08:17:12
【问题描述】:
请不要再在这个问题上浪费你的时间了...我最终删除了整个 VM 并创建了另一个。我这样做所花费的时间少于解决问题所花费的时间。我有几个处于 RAID 模式的 SSD。
感谢所有尝试解决问题的人!
当我运行命令 cat /proc/swaps 时,我遇到了 ubnuntu 未显示活动交换空间的问题。这是我运行的命令列表。我什至添加了一个新的交换空间(文件:/swapfile1)只是为了确保至少有一个交换空间,但我仍然一无所获。
hebbo@ubuntu-12-lts:~$ sudo fdisk -l
[sudo] password for hebbo:
Disk /dev/sda: 26.8 GB, 26843545600 bytes
255 heads, 63 sectors/track, 3263 cylinders, total 52428800 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: 0x000e3a7a
Device Boot Start End Blocks Id System
/dev/sda1 * 46569472 52426751 2928640 82 Linux swap / Solaris
/dev/sda2 2046 46567423 23282689 5 Extended
/dev/sda5 2048 46567423 23282688 83 Linux
Partition table entries are not in disk order
hebbo@ubuntu-12-lts:~$ sudo su
root@ubuntu-12-lts:/home/hebbo# cat /proc/swaps
Filename Type Size Used Priority
root@ubuntu-12-lts:/home/hebbo# dd if=/dev/zero of=/swapfile1 bs=1024 count=524288
524288+0 records in
524288+0 records out
536870912 bytes (537 MB) copied, 1.18755 s, 452 MB/s
root@ubuntu-12-lts:/home/hebbo# mkswap /swapfile1
Setting up swapspace version 1, size = 524284 KiB
no label, UUID=cb846612-5f27-428f-9f83-bbe24b410a78
root@ubuntu-12-lts:/home/hebbo# chown root:root /swapfile1
root@ubuntu-12-lts:/home/hebbo# chmod 0600 /swapfile1
root@ubuntu-12-lts:/home/hebbo# swapon /swapfile1
root@ubuntu-12-lts:/home/hebbo# cat /proc/swaps
Filename Type Size Used Priority
root@ubuntu-12-lts:/home/hebbo#
知道如何解决这个问题吗?
这是在 vmware 虚拟机中运行内核 3.9.0 的 ubuntu 12.04 LTS。
提前致谢!
【问题讨论】:
-
最好试试askubuntu.com
-
您同时拥有交换分区 (
/dev/sda) 和交换文件 (/swapfile1) 是否有原因?我不认为这可能是您的/proc/swaps问题的原因,但也许您没有提到更大的事情? -
不,没有理由这样做。我添加了交换文件 /swapfile1 以进行验证。但是在我添加交换文件之前我应该有交换分区。
标签: linux ubuntu-12.04 swap