AWS-EC2挂载EBS卷
Posted gamedev˚
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了AWS-EC2挂载EBS卷相关的知识,希望对你有一定的参考价值。
在AWS控制台新建一个卷之后,并Attached到EC2实例上之后,登录该实例,通过命令lsblk
可以查看当前可用的卷信息
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 30G 0 disk
└─xvda1 202:1 0 30G 0 part /
xvdf 202:80 0 50G 0 disk
loop0 7:0 0 100G 0 loop
└─docker-202:1-466265-pool 253:0 0 100G 0 dm
└─docker-202:1-466265-07b91bd38d426f9da2428c068aa1b780e3ca2236a29cce6efba92c4143adf498 253:1 0 10G 0 dm
loop1 7:1 0 2G 0 loop
└─docker-202:1-466265-pool 253:0 0 100G 0 dm
└─docker-202:1-466265-07b91bd38d426f9da2428c068aa1b780e3ca2236a29cce6efba92c4143adf498 253:1 0 10G 0 dm
其中可以看到50G是我刚加入的,我现在需要将其挂载到实例上。现在需要通过下面命令初始化新卷
[centos@ip-172-31-10-1 ~]$ sudo mkfs -t ext4 /dev/xvdf
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
3276800 inodes, 13107200 blocks
655360 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2162163712
400 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
再通过命令sudo mount /dev/xvdf /data
就可以挂载上了,重新通过命令查看挂载情况:
[centos@ip-172-31-10-1 ~]$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 30G 0 disk
└─xvda1 202:1 0 30G 0 part /
xvdf 202:80 0 50G 0 disk /data
loop0 7:0 0 100G 0 loop
└─docker-202:1-466265-pool 253:0 0 100G 0 dm
└─docker-202:1-466265-07b91bd38d426f9da2428c068aa1b780e3ca2236a29cce6efba92c4143adf498 253:1 0 10G 0 dm
loop1 7:1 0 2G 0 loop
└─docker-202:1-466265-pool 253:0 0 100G 0 dm
└─docker-202:1-466265-07b91bd38d426f9da2428c068aa1b780e3ca2236a29cce6efba92c4143adf498 253:1 0 10G 0 dm
[centos@ip-172-31-10-1 ~]$ df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 30G 11G 20G 37% /
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.7G 0 3.7G 0% /dev/shm
tmpfs 3.7G 17M 3.7G 1% /run
tmpfs 3.7G 0 3.7G 0% /sys/fs/cgroup
tmpfs 757M 0 757M 0% /run/user/1000
/dev/xvdf 50G 53M 47G 1% /data
以上是关于AWS-EC2挂载EBS卷的主要内容,如果未能解决你的问题,请参考以下文章
在启动 Amazon EC2 Linux 实例时自动挂载 EBS 卷
如何在 Kubernetes 中使用 Aws EBS 挂载 postgresql 卷
在 AWS beanstalk 下将特定的 EBS 卷挂载到 Docker