l'essentiel est invisible pour les yeux

Wednesday, June 18, 2008

[EC2] mount /dev/sdc device since /dev/sdb is not available

AWS team announced about persistent storage, see below the link.

http://www.allthingsdistributed.com/2008/04/persistent_storage_for_amazon.html

That's looks like pretty cool, but it's closed beta now, so we should use S3 or EC2 ephemeral storage (aka. Instance Storage). The 160GB storage is available on m1.large AMI, and some below devices are available.

/dev/sda1 Formatted and mounted as root (/) on all instance types
/dev/sda2 Formatted and mounted as /mnt on small instances
/dev/sda3 Formatted and mounted as /swap on small instances
/dev/sdb Formatted and mounted as /mnt on large and extra large instances
/dev/sdc Available on large and extra large instances; not mounted
/dev/sdd Available on extra large instances; not mounted
/dev/sde Available on extra large instances; not mounted


ATTENTION: The /dev/sdb isn't mounted to /mnt on m1.large AMI, see below a link for more details.
But the /dev/sdb device looks like that isn't mounted to /mnt.


% df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 9.9G 8.6G 801M 92% /
tmpfs 3.8G 0 3.8G 0% /lib/init/rw
udev 10M 10M 0 100% /dev
tmpfs 3.8G 4.0K 3.8G 1% /dev/shm
%


/dev/sdb is recognized in /etc/fstab, but it isn't mounted.

# Default /etc/fstab
# Supplied by: ec2-ami-tools-1.3-20041
/dev/sda1 / ext3 defaults 1 1
/dev/sdb /mnt ext3 defaults 0 0
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0



% sudo mount /mnt
mount: /dev/sdb is not a valid block device


So we should initialize device to use as file system.
At first, optimize virtual devices before use them in production.

dd if=/dev/zero of=/dev/sdb bs=1M
dd if=/dev/zero of=/dev/sdc bs=1M
dd if=/dev/zero of=/dev/sdd bs=1M (m1.xlarge only)
dd if=/dev/zero of=/dev/sde bs=1M (m1.xlarge only)


Create a file system and mount it, and mounted /dev/sdc device is available now.

mkfs -t ext3 /dev/sdc
mount -t ext3 /dev/sdc /www



Filesystem Size Used Avail Use% Mounted on
/dev/sda1 9.9G 8.2G 1.2G 88% /
tmpfs 3.8G 0 3.8G 0% /lib/init/rw
udev 10M 10M 0 100% /dev
tmpfs 3.8G 4.0K 3.8G 1% /dev/shm
/dev/sdc 414G 6.7G 386G 2% /www