Friday, January 30, 2009

Mounting extra disks on ec2 instances

First, compare available partitions with
 ~>  cat /proc/partitions
major minor #blocks name
8 16 440366080 sdb
8 32 440366080 sdc
8 48 440366080 sdd
8 64 440366080 sde
8 1 10485760 sda1
~> df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 9.9G 1.6G 7.9G 17% /
/dev/sdb 414G 199M 393G 1% /mnt
none 3.6G 0 3.6G 0% /dev/shm
Here we note that /dev/sda1 and /dev/sdb are in use, while /dev/sdc /dev/sdd and /dev/sde are not yet in use

We want to check the fstab to see what the disktypes are. Also edit this file if you want your mounted disk to come back up on a reboot! (In Ec2-land all of these filesystems are non-persistent, so if your machine more than reboots, you'll lose the data entirely.
 ~>  more /etc/fstab
/dev/sda1 / ext3 defaults 1 1
/dev/sdb /mnt ext3 defaults 0 0
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
Create your mount point:
 ~>  mkdir /mnt2
Mount the disk:
 ~>  mount -t ext3 /dev/sdc /mnt2
And check its availability:
 ~>  df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 9.9G 1.6G 7.9G 17% /
/dev/sdb 414G 199M 393G 1% /mnt
none 3.6G 0 3.6G 0% /dev/shm
/dev/sdc 414G 199M 393G 1% /mnt2

No comments:

Post a Comment