Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为Linux虚拟机增加swap空间 #105

Open
imuncle opened this issue Mar 4, 2020 · 0 comments
Open

为Linux虚拟机增加swap空间 #105

imuncle opened this issue Mar 4, 2020 · 0 comments
Labels
ROS 向ROS发起请求

Comments

@imuncle
Copy link
Owner

imuncle commented Mar 4, 2020

不得不在家办公,给电脑装了个Ubuntu虚拟机跑ROS,结果在编译的时候遇到了问题:
image

原因是没有足够的运行内存给编译程序用,我参考这篇博客:Linux虚拟机增加内存后增加swap空间,成功扩大了内存。

其实swap空间就是把硬盘上的空间用来当内存使用,是一种折中的处理方法。

1. 用dd命令创建一个2G的文件(2G=1024×1024×2=2097152)

sudo dd if=/dev/zero of=/var/swapfile bs=1024 count=2097152

2. 将它创建为Linux Swap虚拟交换文件

sudo mkswap /var/swapfile

3. 激活并使用/var/swapfile交换文件

sudo swapon /var/swapfile1

4. 设置系统启动后自动激活虚拟交换文件。

sudo gedit /etc/fstab

里面写入如下内容

/var/swapfile1 swap swap defaults 0 0
@imuncle imuncle added the ROS 向ROS发起请求 label Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ROS 向ROS发起请求
Projects
None yet
Development

No branches or pull requests

1 participant