How to Connect EBS Volume to AWS Instance
Nir edited this page Jul 27, 2016
·
13 revisions
How to add EBS volume using AWS GUI
This wiki describe how to add EBS to an instance and copy the data between instances
- Create EBS volume using AWS GUI - make sure to notice the availability zone.
- Attach the EBS volume to the instance using GUI
- SSH to the instance
- Run lsblk to see available mount disks
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNT POINT
xvda1 202:80 0 10G 0 disk
xvdf 202:1 0 8G 0 disk
Here the EBS is 8GB size
- Run
$ sudo file -s /dev/xvdf
/dev/xvdf: data - meaning that there is no file system on the EBS - Run $ sudo mkfs -t xfs device_name
For example
$ sudo mkfs -t xfs /dev/xvdf
- Create new folder $ mkdir <your_folder>
$ mkdir scylla_data
- Mount the new directory
$ mount /dev/xvdf scylla_folder
- Run all the needed commands: copy / delete etc
- Once done, umout is needed for the mounted folder
$ umount scylla_folder
- Go to AWS GUI
- Detach the EBS (right click on the volume), Wait till the volume become available (it may take some time)
- Attach the EBS volume to the instance that you want to work with (it may take some time)
- Run lsblk to see available mount disks
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNT POINT xvda1 202:80 0 10G 0 disk xvdm 202:1 0 8G 0 disk - Create new folder
$ mkdir new_scylla_data
- Mount the EBS volume to the new folder that you created
$ mount /dev/xvdm new_scylla_data
EBS Location US East (N. Virginia)
https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#Volumes:search=bench;sort=tag:Name Volume name Benchmark_data - Don't delete Snapshot Benchmark_snap_dont_delete_25.7
Please take snapshots if you are doing any changes. Also deattach and attach are long process - make sure not to do hasty action (it can ruin the EBS - it happens to me one time on small volume).