Monthly Archives: July 2012

ubuntu static ip address

 1. Open /etc/network/interfaces for editing
 # vi /etc/network/interfaces

2. Edit the section for the primary network interface to make it look like the one below.

auto eth0
 iface eth0 inet static
 address 192.168.1.2
 netmask 255.255.255.0
 gateway 192.168.1.1

3. Restart the interface
 # /etc/init.d/networking restart
 

new EBS volume for /var

Amazon EC2 AMIs have minimal amount of non-volatile disk space on its instances. You’re free to use it’s ethereal volume (/mnt) but bear in mind that in case the instance is stopped or rebooted a certain way, the contents of the volume will be wiped out.

One solution is to use EBS for additional storage. Taking it one step further, let’s mount the new EBS volume on /var and make the bigger disk space available to MySQL and apache httpd.

 1. Create new EC2 instance (ec2new)
 Note: I use the AMIs posted at http://cloud.ubuntu.com/ami/. Match the region and architecture with the version that you need.

2. Update ec2new
 # apt-get update && apt-get upgrade -y

3. Create the new EBS volume (ebsnew)
 Note: Use the AWS Management Console for Elastic Block Storage. Take note of the device label (i.e. /dev/xyz).

4. Check the device label for the new volume.
 # fdisk -l
 Note: /dev/xyz should match the new volume size.

4. Format ebsnew
 # mkfs.ext3 /dev/xyz

5. Temporarily mount ebsnew to /srv
 # mount /dev/xyz /srv

6. Backup /var to /srv
 # rsync -avr /var/ /srv/

7. Edit /etc/fstab
 /dev/xyz /var auto defaults,nobootwait,noatime 0 0

8. Reboot ec2new