New volume created for EC2 when I stop / start

0

I created an EC2 instance, T2.nano, and had some files stored in it at the /home/ubuntu/folderA directory. I then stopped this instance because we do not have any running applications in it. After a few days, i turn it back on, and found out that all my files are gone. my /home/ubuntu/ directory is empty.

After some investigation, I noticed that this instance now has 2 attached volume: 2 volumes attached

Then i also found out that 1 of the volume is not mounted. result of sudo lsblk -f:

NAME     FSTYPE LABEL           UUID                                 FSAVAIL FSUSE% MOUNTPOINT
loop0                                                                      0   100% /snap/amazon-ssm-agent/7628
loop1                                                                      0   100% /snap/core18/2790
loop2                                                                      0   100% /snap/core20/2015
loop3                                                                      0   100% /snap/lxd/24061
loop4                                                                      0   100% /snap/snapd/20290
xvda                                                                                
├─xvda1  ext4   cloudimg-rootfs                                         5.5G    28% /
├─xvda14                                                                            
└─xvda15 vfat   UEFI                                                       
xvdf                                                                                
├─xvdf1  ext4   cloudimg-rootfs 
├─xvdf14                                                                            
└─xvdf15 vfat   UEFI                                                   98.3M     6% /boot/efi

I then proceed to mount the /dev/xvdf1 volume at /data, following this guide: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html and I can see my files at /data/home/ubuntu/folderA.

my questions are:

  1. I don't recall specifying 2 volumes for this instance when creating it. why did it create the new volume?
  2. Why did it make the "new" volume as the root device?
  3. Why did it not auto mount the "original" volume?
Harith
已提问 5 个月前276 查看次数
1 回答
1

Hello.

I don't recall specifying 2 volumes for this instance when creating it. why did it create the new volume?

Maybe you added EBS by mistake when creating EC2?
It will be added by clicking "Add new volume" as shown below when creating EC2 from the management console.
You may also be able to check when EBS was added from CloudTrail's API history.
a

Why did it make the "new" volume as the root device?

It is unclear why the home directory was created in the added EBS, but if you check the system logs when EC2 was created, you may be able to find out something.

Why did it not auto mount the "original" volume?

To automatically mount the added EBS volume, you need to add settings to "/etc/fstab".
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html#ebs-mount-after-reboot

profile picture
专家
已回答 5 个月前
profile pictureAWS
专家
已审核 5 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则