attach EBS volume to EC2 instance

628 views Asked by At

I create a Linux Amazon Instance with default 8G EBS volume. After that, I create a new 20G EBS volume and mount it to /mnt/my-data.

When I run $ df -h. It's show:

/dev/xvda1 7.9G Mounted on /
/dev/xvdf  20G  Mounted on /mnt/my-data

I am very new with Linux, so I just want to know:

  1. The folder /mnt/my-data can hold the file with maximize volume is 20G or 28G ?
  2. The folder /var can hold the file with maximize volume is 8G or 28G ?
  3. Now I want to mount /dev/xvdf to /var, what should I do?

Thanks so much!

1

There are 1 answers

2
slayedbylucifer On BEST ANSWER

The folder /mnt/my-data can hold the file with maximize volume is 20G or 28G ?

20GB. what you see is what you get. (in fact a little less than 20GB as some space will be eaten up by filesystem metadata

The folder /var can hold the file with maximize volume is 8G or 28G ?

8GB. again same reasoning as above

Now I want to mount /dev/xvdf to /var, what should I do?

umount from /mnt/my-data and the mount it on /var. By doing this , you will lose all the stuff you have in /var.

cd /
umount /mnt/my-data
mount /dev/xvdf /var