- Create new EBS Volume in the correct Availability Zone
- Attach new EBS Volume to EC2 Instance
- Check filesystem type (ext4)
sudo file -s /dev/xvd*
- Find new disk
sudo fdisk -l
- Create filesystem
sudo mkfs -t ext4 /dev/xvdf
- Mount new fs
sudo mount /dev/xvdf1 /mnt/vol -t ext4
- Move/Bind
sudo mount --bind /mnt/vol /home/user/vol
available in both
sudo mount --move /mnt/vol /home/user/vol
available in moved - Confirm:
df -h
EBS Devices become unmounted again when the EC2 Instance reboots.
Append to the file /etc/rc.local
the mount command used:sudo mount /dev/xvdf1 /vol -t ext4
above exit 0
- Find UUID for device:
ls -al /dev/disk/by-uuid/
- Create backup of fstab:
cp /etc/fstab /etc/fstab.orig
- Add entry to fstab:
sudo vim /etc/fstab
UUID=de9a1ccd-a2dd-44f1-8be8-0123456abcdef /mnt/data-01 ext4 defaults,nofail 0 2
- Check mount errors by mounting all filesystems in
/etc/fstab
:sudo mount -a
sudo dd if=/dev/xvdx of=/dev/null bs=1M
- http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-initialize.html
Install the ebsmount package and create a hidden directory on the EBS volume and configure the system to automount using udev when the EBS volume is attached to the EC2 instance.
- Databases mount to
/var/data
- Web files
/srv