To initialize an EBS volume that was manually attached.
Note: Some ServerTemplates, such as RightScale's "MySQL" ServerTemplates contain scripts that will attach and initialize EBS Volumes to a Server at boot and runtime.
Table of Contents
Perhaps you used the Attach Blank Volume action button to Attach an EBS Volume to an Instance. But, before you can use an attached EBS Volume as a normal disk drive, you must first initialize or format it.
Note: The following steps were tested on an instance running CentOS 5.2
- Go to the Volumes tab of the Server that has the unitialized/unformatted EBS Volume. If you just attached the EBS Volume to the instance, you must wait for its status to be "attached" to the instance before attempting to initilize the volume. If the volume still says "pending" you must wait a couple more minutes.
- SSH into the Server and run the following shell commands to initialize the EBS Volume:
fdisk /dev/sdj (You must specify which mounted volume you want to format.
- Enter m for a menu
- Enter n to add a new partion
- Enter p for a primary partition
- Enter 1 for the first partion on the disk
- Click 'Enter' to accept the default First Cylinder
- Select 'Enter' to accept the default Last Cylinder
- Enter w to write the partition table (You will be returned to the Unix shell)
mkfs.xfs -f /dev/sdj
If you do not have mkfs.xfs installed, you will need to install it using a command similar to the following:
# yum install kmod-xfs xfsdump xfsprogs dmapi
- mkdir /mnt/ebs
To test, you can type df -k to see the mounted devices. At this point, you will not see the file system that's on your EBS volume.
- mount /dev/sdj /mnt/ebs
Run the test again using df -k but this time you should see the filesystem on your EBS volume with the correct mount point (e.g. /mnt/ebs).
- Close your SSH session. You can now save data to the EBS Volume and take a backup, which will create an EBS Snapshot of the volume which can later be used to restore your volume's data on another instance.