Create an EBS Volume and attach it to an EC2 instance
Create an EBS Volume and attach it to an EC2 instance
In the control console, Volumes of ELASTIC BLOCK STORE in the left menu. Click Create Volume. Fill the forms, and select Availability Zone where your instance is located. Then click Yes, Create. In the list, you can see the volume you just create. Assign a name to it for easy to remember.
In the popup list, select Attach Volume to attach this volume to your instance. Note that, you can assign a device name, but for the current new Linux kernel, the name will be renamed to /dev/xvd?.
Login to your instance. Find the name of the device ls -l /dev/xvd? , for example, it is /dev/xvdj. This is the new device.
Now, you should format it and mount it to a directory.
Format it in ext3:
# mkfs.ext3 /dev/xvdj
Mount it to a directory:
# mkdir /mnt/mydir
# mount /dev/xvdj /mnt/mydir
If you can not use df to list device, try following to create mtab:
# grep -v rootfs /proc/mounts > /etc/mtab
# df
Detach Volume or Force Detach Volume. It seems that the device is not removed from the instnace.
Sometimes the volume stays in Attaching or Detaching state for a long time. You have to Force Detach Valume and restart the instance. It seems that you can not really detach a volume from an instance. You have to manually unmont the device from the instance.
Labels: Amazon EBS

0 Comments:
Post a Comment
<< Home