访问 AWS EC2 实例上的其他驱动器?

访问 AWS EC2 实例上的其他驱动器?

我在 Amazon EC2 的 Ubuntu 实例上运行了一个应用程序,但内存不足。

以下是 df 显示的内容:

ubuntu@ip-172-31-9-56:~/layers/punctuation$ df
Filesystem     1K-blocks    Used Available Use% Mounted on
udev            16465276       0  16465276   0% /dev
tmpfs            3294652    8808   3285844   1% /run
/dev/xvda1       8065444 8049064         0 100% /
tmpfs           16473244       0  16473244   0% /dev/shm
tmpfs               5120       0      5120   0% /run/lock
tmpfs           16473244       0  16473244   0% /sys/fs/cgroup
tmpfs            3294652       0   3294652   0% /run/user/1000

我的应用程序在文件夹中存储了很多大文件/tmp,所以我猜测该/tmp文件夹在/dev/xvda1

其他卷似乎还有更多的空间。

  • 这些卷是什么(tmpfsudev)?
  • 我如何访问这些卷?

答案1

  • tmpfs是基于 RAM 的虚拟内存文件系统
  • udev供应动态设备管理使用虚拟文件

那些没有使用实际磁盘,无法满足您的需求

注意:如果你想转换额外的 RAM 并将其用作临时磁盘空间(又称内存盘),你可以使用以下命令执行此操作:

$ sudo mount -t tmpfs -o size=10M tmpfs /mnt/mytmpfs

虽然使用部分 RAM 作为 RAM DISK 可能会有效,但它会消耗分配为 DISK 的那部分 RAM,并且您的程序将无法再将其用作 RAM。

你需要确保在分配内存后,还有足够的内存用于你的任务/处理内存盘

为了拥有更多的磁盘存储空间,并且仍然能够使用 RAM 来满足程序的需求 -简单的解决方案是添加磁盘/ 使用具有更大磁盘的其他机器,或任何其他 AWS 解决方案,以便在您的机器中拥有额外的磁盘存储。


来自 Ubuntu Man 页面的更多信息:

人 tmpfs

姓名

   tmpfs - a virtual memory filesystem

描述

   The  tmpfs  facility  allows the creation of filesystems whose contents
   reside  in  virtual  memory.   Since  the  files  on  such  filesystems
   typically reside in RAM, file access is extremely fast.

   The filesystem is automatically created when mounting a filesystem with
   the type tmpfs via a command such as the following:
   $ sudo mount -t tmpfs -o size=10M tmpfs /mnt/mytmpfs

人udev

姓名

   udev - Dynamic device management

描述

   udev supplies the system software with device events, manages
   permissions of device nodes and may create additional symlinks in the
   /dev directory, or renames network interfaces. The kernel usually just
   assigns unpredictable device names based on the order of discovery.
   Meaningful symlinks or network device names provide a way to reliably
   identify devices based on their properties or current configuration.

相关内容