如何分配内存以用作 Amazon EC2 上的交换空间?

问题描述

我正在尝试使用硬盘驱动器上的分区分配内存以用作 Amazon EC2 实例上的交换空间。我正在按照 here

列出的说明进行操作

但是这样做会导致出现错误消息并且不会创建分区。这是我尝试的结果:

sudo fdisk /dev/xvda1

Welcome to fdisk (util-linux 2.30.2).
Changes will remain in memory only,until you decide to write them.
Be careful before using the write command.

The old xfs signature will be removed by a write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x59fc670b.

Command (m for help): n
Partition type
   p   primary (0 primary,0 extended,4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4,default 1): 2
First sector (2048-16773086,default 2048):
Last sector,+sectors or +size{K,M,G,T,P} (2048-16773086,default 16773086): +4G

Created a new partition 2 of type 'Linux' and of size 4 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Invalid argument

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

事情是,重新启动后似乎没有应用beeb。并且尝试设置交换区域失败:

mkswap /dev/xvda2
mkswap: cannot open /dev/xvda2: No such file or directory

有人知道为什么指南中列出的步骤在这种情况下不起作用吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...