Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save daubac402/db4b281ae901dc70b5f0cd28a45fb10f to your computer and use it in GitHub Desktop.
Save daubac402/db4b281ae901dc70b5f0cd28a45fb10f to your computer and use it in GitHub Desktop.
AWS - EC - EBS - Expand /dev/xvda + Make an Amazon EBS volume (/dev/xvdb) available for use to CentOS
# Check current partitions status
lsblk
# Expand /dev/xvda from 8GB (default) to your current EBS size (please increase your EBS volume in AWS Console then run these below commands)
sudo yum install -y epel-release
sudo yum install -y cloud-utils-growpart
growpart /dev/xvda 1
reboot
# Make an Amazon EBS volume available for use on Linux (for eg: /dev/xvdb)
sudo yum install -y xfsprogs
sudo mkfs -t xfs /dev/xvdb
sudo mkdir /your_mount_destination_folder_path
sudo mount /dev/xvdb /your_mount_destination_folder_path
# Auto mount that Amazon EBS volume when stating
cp /etc/fstab /etc/fstab.old
blkid
/dev/xvda1: UUID="92c597ca-70f5-48ee-a173-64188df8ca24" TYPE="ext4"
/dev/xvdb: UUID="afe95686-8a5f-480f-aeb3-012bee11b523" TYPE="xfs"
vim /etc/fstab
append this line
UUID=afe95686-8a5f-480f-aeb3-012bee11b523 /your_mount_destination_folder_path xfs defaults,nofail 0 2
Then test
sudo umount /your_mount_destination_folder_path
mount -a
df -h