Skip to content

Latest commit

 

History

History
60 lines (39 loc) · 1.22 KB

File metadata and controls

60 lines (39 loc) · 1.22 KB

Amazon EBS Volume Setup

Create an Amazon EBS Volume

  1. Launch an EC2 instance in your preferred AWS region.

  2. Create an Amazon EBS volume with the desired size and type (SSD or HDD) in the same availability zone as your EC2 instance.

Attach EBS Volume to EC2 Instance

  1. Attach the newly created EBS volume to your EC2 instance.

  2. Verify that the volume is successfully attached and visible to the instance.

Commands

# List block devices
lsblk

# Check file system type of the attached volume
sudo file -s /dev/xvdf

# Format the EBS volume with XFS file system
sudo mkfs -t xfs /dev/xvdf

# Check file system type again after formatting
sudo file -s /dev/xvdf

# Create a directory to mount the EBS volume
sudo mkdir /testebs

# List root directory contents
ls /

# Mount the EBS volume to the created directory
sudo mount /dev/xvdf /testebs

# Display disk space usage
df -k

# View UUID for the mounted volume
sudo blkid

# Edit /etc/fstab to automatically mount the EBS volume on boot
sudo vi /etc/fstab

# Additional commands for demonstration
sudo /ebsdemo
sudo vi file1
cd ..

# Unmount the volume
sudo umount /ebsdemo

# Check disk space after unmounting
df -k

# List block devices
lsblk