Well this is simple and will document it just for fun! =)
You can attach a volume to an EC2 instance by:
1. creating the volume at EC2 - > Volumes -> Create volume
Select the size and create it. It is IMPORTANT that the volume is created in the same Geography and lab, i.e. If an instance is un us-east-1a and your volume is in us-east-1b you will not be able to attach the volume; use us-east-1a for both for example.
Once it is created
2. Right click on the volume -> Attach Volume
Then select the instance you want to attach to.
See that volume state will be attaching for a while; in my case I did it when the instance was running, I guess this also works for stopped instances.
Ok, so now we have to format, mount and att to fstab our new device:
ssh your EC2 instance.
If our Volume is named: /dev/xvdf and we want to use an ext4 filesystem:
sudo mkfs.ext4 /dev/xvdf
Then mount to a particular directory
mkdir /mnt_large
sudo mount /dev/xvdf /mnt_large
Finally add to fstab:
Follow is the original content:
LABEL=cloudimg-rootfs / ext4 defaults 0 0
/dev/xvdb /mnt auto defaults,nobootwait,comment=cloudconfig 0 2
Add your device line and final result will be:
For details on fstab see: https://help.ubuntu.com/community/Fstab
Why do we add it to fstab? well if you reboot you can make sure that your device will be automatically mounted.
That's it!
P.D. I should say that there are not ugly flags.
You can attach a volume to an EC2 instance by:
1. creating the volume at EC2 - > Volumes -> Create volume
Select the size and create it. It is IMPORTANT that the volume is created in the same Geography and lab, i.e. If an instance is un us-east-1a and your volume is in us-east-1b you will not be able to attach the volume; use us-east-1a for both for example.
Once it is created
2. Right click on the volume -> Attach Volume
Then select the instance you want to attach to.
See that volume state will be attaching for a while; in my case I did it when the instance was running, I guess this also works for stopped instances.
Ok, so now we have to format, mount and att to fstab our new device:
ssh your EC2 instance.
If our Volume is named: /dev/xvdf and we want to use an ext4 filesystem:
sudo mkfs.ext4 /dev/xvdf
Then mount to a particular directory
mkdir /mnt_large
sudo mount /dev/xvdf /mnt_large
Finally add to fstab:
Follow is the original content:
LABEL=cloudimg-rootfs / ext4 defaults 0 0
/dev/xvdb /mnt auto defaults,nobootwait,comment=cloudconfig 0 2
Add your device line and final result will be:
LABEL=cloudimg-rootfs / ext4 defaults 0 0
/dev/xvdb /mnt auto defaults,nobootwait,comment=cloudconfig 0 2
/dev/xvdb /mnt auto defaults,nobootwait,comment=cloudconfig 0 2
/dev/xvdf /mnt_large auto defaults,nobootwait,comment=cloudconfig 0 2
For details on fstab see: https://help.ubuntu.com/community/Fstab
Why do we add it to fstab? well if you reboot you can make sure that your device will be automatically mounted.
That's it!
P.D. I should say that there are not ugly flags.
No hay comentarios:
Publicar un comentario