AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题

问题[swap](ubuntu)

Martin Hope
N Papa
Asked: 2025-03-13 02:11:44 +0800 CST

磁盘分析器中的 swap.img 是什么

  • 9

我打开了磁盘使用情况分析器,第二大项目是 swap.img。用鼠标右键单击甚至无法从外部打开它。它像 Ubuntu 的备份文件吗?我可以安全地删除它,而不会出现任何问题,还是我只能把它保留在那里。我对这个操作系统比较陌生,抱歉 🙃🤭

swap
  • 3 个回答
  • 585 Views
Martin Hope
porton
Asked: 2024-04-15 23:06:13 +0800 CST

交换到不工作的文件

  • 4

swapspace我已经使用了所有的交换(由 Rust 编译器),尽管我确实安装了软件包,但它并没有增长。

               total        used        free      shared  buff/cache   available
Mem:            15Gi        12Gi       2.4Gi       1.8Gi       2.5Gi       2.6Gi
Swap:          2.0Gi       2.0Gi          0B

时间稍晚一些:

$ swapon
NAME           TYPE      SIZE USED PRIO
/dev/nvme0n1p2 partition   2G   2G   -2

如何使交换文件工作?我需要编辑吗/etc/swapspace.conf?

/etc/swapspace.conf:

# This file is part of Swapspace.
# 
# Swapspace is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# Swapspace is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with swapspace; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA


# Swap path: location where swapspace may create and delete swapfiles.  For
# security reasons this directory must be accessible to root and to root only.
#swappath="/var/lib/swapspace"

# Lower free-space threshold: if the percentage of free space drops below this
# number, additional swapspace is allocated
#lower_freelimit=20

# Upper free-space threshold: if the percentage of free space exceeds this
# number, swapspace will attempt to free up swapspace
#upper_freelimit=60

# Percentage of free space swapspace should aim for when adding swapspace.  This
# should fall somewhere between lower_freelimit and upper_freelimit.
#freetarget=30

# Smallest allowed size for individual swapfiles
#min_swapsize=4m

# Greatest allowed size for individual swapfiles
#max_swapsize=2t

# Duration (roughly in seconds) of the moratorium on swap allocation that is
# instated if disk space runs out, or the cooldown time after a new swapfile is
# successfully allocated before swapspace will consider deallocating swap space
# again.  The default cooldown period is about 10 minutes.
#cooldown=600

还:

$ systemctl status swapspace.service 
● swapspace.service - Swapspace, a dynamic swap space manager
     Loaded: loaded (/lib/systemd/system/swapspace.service; enabled; preset: enabled)
     Active: active (running) since Sat 2024-04-06 12:25:27 IDT; 1 week 2 days ago
       Docs: man:swapspace(8)
   Main PID: 5007 (swapspace)
      Tasks: 1 (limit: 18672)
     Memory: 696.0K
        CPU: 56min 53.175s
     CGroup: /system.slice/swapspace.service
             └─5007 /usr/sbin/swapspace

Apr 15 22:57:50 victor swapspace[5007]: Error: Could not enable swapfile '1': Invalid argument
Apr 16 07:54:11 victor swapspace[2805427]: Setting up swapspace version 1, size = 6.6 GiB (7115493376 bytes)
Apr 16 07:54:11 victor swapspace[2805427]: no label, UUID=e4971b48-a25a-48bd-bba4-c612569f996a
Apr 16 07:54:11 victor swapspace[5007]: Error: Could not enable swapfile '1': Invalid argument
Apr 16 08:04:19 victor swapspace[2920343]: Setting up swapspace version 1, size = 6.1 GiB (6517428224 bytes)
Apr 16 08:04:19 victor swapspace[2920343]: no label, UUID=5e0ae6b7-9715-4882-8cda-51707e96fbaa
Apr 16 08:04:19 victor swapspace[5007]: Error: Could not enable swapfile '1': Invalid argument
Apr 16 08:14:26 victor swapspace[2939298]: Setting up swapspace version 1, size = 6.1 GiB (6539935744 bytes)
Apr 16 08:14:26 victor swapspace[2939298]: no label, UUID=1ba42fae-6106-450e-9d96-3cdc040c84c6
Apr 16 08:14:26 victor swapspace[5007]: Error: Could not enable swapfile '1': Invalid argument
swap
  • 2 个回答
  • 26 Views
Martin Hope
ssssstut
Asked: 2024-03-22 17:05:24 +0800 CST

将交换文件更改为交换分区 - 这可以轻松完成吗?

  • 5

我发现很多帖子如何将交换分区更改为文件,例如:交换分区到交换文件。由于 LUbuntu 的一些休眠问题,我想将交换文件更改为分区。这可以完成还是需要全新安装?

如果是:我必须执行哪些步骤?

谢谢你!

swap
  • 1 个回答
  • 68 Views
Martin Hope
Thomas Browne
Asked: 2022-03-29 03:11:21 +0800 CST

我可以同时使用 zRAM 和磁盘交换文件吗?

  • 0

我的机器中有 24GB 的可用 RAM,但我通常使用的内存远少于 8GB。但是,有时我涉及到大型数据文件,我突然需要 40GB,并且在极少数情况下,我希望能够访问更多(最多 60GB)。这主要是使用 numpy 和 Apache Arrow。

现在我有一个 20GB 的 ssd 交换文件,它工作正常,但显然很慢。我想用 zRAM 替换它,假设我在 16GB 上得到双重压缩,即 32GB,加上剩余的 8GB = 40GB 的“ram”。不过,理想情况下,我偶尔会想要超过 40GB,并想知道不适合 zRAM 的内容是否有可能进一步溢出到“传统”SSD 交换文件或分区中。

这是可行的吗?显然,我希望 zRAM 优先于磁盘交换文件。

swap
  • 1 个回答
  • 659 Views
Martin Hope
Deekshith Anand
Asked: 2021-12-07 12:40:32 +0800 CST

WSL2 上的 Swappiness 重置为 60

  • 4

我最近尝试在 Windows (WSL2) 上安装 Ubuntu。我尝试了该free命令,并使用了几块交换内存。我想减少交换,所以我vm.swappiness=10在/etc/sysctl.conf. 我尝试重新加载sysctl.conf,它似乎可以工作,但是当我尝试关闭 WSL 并开始一个新会话时,swappiness 被重置为默认值 60。

WSL2 上的 Ubuntu 是否会覆盖此设置以使其再次变为 60?

swap
  • 1 个回答
  • 964 Views
Martin Hope
itisyeetimetoday
Asked: 2021-11-21 16:30:25 +0800 CST

如何在不删除现有交换文件的情况下减小它的大小?

  • 0

看到这篇文章后:如何在 Ubuntu 18.04 中增加交换文件?,我想知道,如何在不删除交换文件的情况下减小它的大小?

swap
  • 1 个回答
  • 64 Views
Martin Hope
Rushi Kaneria
Asked: 2021-08-02 20:30:03 +0800 CST

如何在 Ubuntu 20.04 中休眠?

  • 2

我已经使用 Windows 几年了。有时我不得不因为断电或旅行而关闭笔记本电脑,而休眠功能帮助了我。现在切换到 Ubuntu 后,我发现没有休眠功能。我已经阅读了一些具体的问题。 如何在 Ubuntu 20.04 中启用休眠选项? 现在在阅读了这个人的回答后,他告诉我应该有交换分区而不是交换文件。现在不幸的是我有交换文件。现在如果我想用交换文件休眠怎么办?

swap
  • 3 个回答
  • 498 Views
Martin Hope
user1284092
Asked: 2021-05-29 03:04:59 +0800 CST

交换文件的默认位置 [重复]

  • 0
这个问题在这里已经有了答案:
默认 17.04 交换文件位置 1 个答案
去年关闭。

我刚刚创建了一个交换文件,现在我想检查这个交换文件的位置。

如何检查我的交换文件位于哪个分区?

swap
  • 1 个回答
  • 540 Views
Martin Hope
Root Loop
Asked: 2021-03-09 19:04:51 +0800 CST

即使我没有交换分区设置,Ubuntu 也会自动创建交换?

  • 1

我正在根据官方文档You MUST disable swap in order for the kubelet to work properly Ref here准备服务器以设置 Kubernetes 集群。

所以我一开始没有创建交换分区。(GPT - LVM - /boot & /) 在此处输入图像描述

安装完成后,我检查交换的状态,那里是“SWAP 2G”

在此处输入图像描述

但lsblk仍然显示没有交换

在此处输入图像描述

所以我猜操作系统中的交换和磁盘上的交换是不同的?

swap
  • 1 个回答
  • 1105 Views
Martin Hope
CFS
Asked: 2021-02-25 03:46:16 +0800 CST

为什么我的交换文件没有自动挂载?

  • 0

我总是必须在启动后手动激活交换文件。怎么了?这是我的/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/nvme0n1p3 during installation
UUID=65238893-d167-43fd-9c3d-489759c09f06 /               btrfs   defaults,subvol=@ 0       1
# /boot was on /dev/nvme0n1p2 during installation
UUID=4e5c83d5-a781-4af7-a205-f137974d998e /boot           ext4    defaults        0       2
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=68C0-029E  /boot/efi       vfat    umask=0077      0       1
# /home was on /dev/nvme0n1p3 during installation
UUID=65238893-d167-43fd-9c3d-489759c09f06 /home           btrfs   defaults,subvol=@home 0       2
UUID=65238893-d167-43fd-9c3d-489759c09f06 /swap           btrfs   defaults,noatime,subvol=swap  0   0
/swap/swapfile  none    swap    sw  0   0

这是输出sudo btrfs sub list /; ls /swap:

ID 256 gen 59227 top level 5 path home
ID 318 gen 62429 top level 5 path @
ID 319 gen 62429 top level 5 path @home
ID 330 gen 62180 top level 318 path swap
swapfile
swap
  • 1 个回答
  • 434 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve