Add EBS to Ubuntu EC2 Instance

前端 未结 2 1481
迷失自我
迷失自我 2020-12-04 04:29

I\'m having problem connecting EBS volume to my Ubuntu EC2 Instance.

Here\'s what I did:

  1. From the Amazon AWS Console, I created a EBS 150GB volume a

相关标签:
2条回答
  • 2020-12-04 05:19

    Since this is a new volume, you need to format the EBS volume (block device) with a file system between step 1 and step 2. So the entire process with your sample mount point is:

    1. Create EBS volume.

    2. Attach EBS volume to /dev/sdf (EC2's external name for this particular device number).

    3. Format file system /dev/xvdf (Ubuntu's internal name for this particular device number):

      sudo mkfs.ext4 /dev/xvdf
      

      Only format the file system if this is a new volume with no data on it. Formatting will make it difficult or impossible to retrieve any data that was on this volume previously.

    4. Mount file system (with update to /etc/fstab so it stays mounted on reboot):

      sudo mkdir -m 000 /vol
      echo "/dev/xvdf /vol auto noatime 0 0" | sudo tee -a /etc/fstab
      sudo mount /vol
      
    0 讨论(0)
  • 2020-12-04 05:22

    Step 1: create volume
    step 2: attach to your instance root volume
    step 3: run sudo resize 2fs -p /dev/xvde
    step 4: restart apache2 sudo service apache2 restart
    step 4: run df -h

    You can see total volume attached to your instance.

    0 讨论(0)
提交回复
热议问题