Home/Server & Website Managed Operations/Mounting EBS on CentOS
Server & Website Managed Operations

Mounting EBS on CentOS

EBS (Elastic Block Store) is a persistent, block-level storage volume for Amazon EC2 instances.

Here is a brief introduction to how to mount an EBS volume to an EC2 instance after purchase.

Environment: CentOS 6.5

EBS: 300GB

Mounting EBS on CentOS 6.5

1. Use the fdisk command to check the device name.

# fdisk -l

Disk /dev/xvdg: 40.3 GB, 40256929792 bytes
255 heads, 63 sectors/track, 4894 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/xvde: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/xvdf: 322.1 GB, 322122547200 bytes
255 heads, 63 sectors/track, 39162 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Based on the capacity, /dev/xvdf is the purchased EBS.

2. Create an ext4 file system

# mkfs -t ext4 /dev/xvdf

3. Create a directory and mount

# mkdir /data
# mount /dev/xvdf /data

4. Verify

# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvde       7.9G  650M  6.9G   9% /
tmpfs           7.4G     0  7.4G   0% /dev/shm
/dev/xvdf       296G  191M  281G   1% /data

5. Modify /etc/fstab

Add the following line at the end of the /etc/fstab file.

# vi /etc/fstab
/dev/xvdf  /data     ext4    defaults         0 0

6. Reboot the system to verify

# shutdown -r now
# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvde       7.9G  651M  6.9G   9% /
tmpfs           7.4G     0  7.4G   0% /dev/shm
/dev/xvdf       296G  191M  281G   1% /data
FREE CHECKUP

Free server checkup

We will send a problem checklist and remediation advice within one business day — no obligation to engage.

135 410 16684
Weekdays Mon – Fri 10:00 – 22:00 (UTC+8) · 7×24 emergency response
Call now
CONTACT

Contact Us

How can we help?

* Required