What can I do to give some more love and disk space to my database on Ubuntu?

4

I'm new to linux. I've deployed a db to ubuntu server on amazon and found out I'm low on disk space. did df (see below) - and found out that I'm 89% capacity on one file system, but less on others. What does this mean? Do I have a few partitions and can now utilize others besides /dev/xvda1? Also /dev/xvdb seems large, is it safe to put the db in it and only use it? If so do I need to mount it or do something special?

$> df -lah

Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1      8.0G  6.7G  914M  89% /
proc               0     0     0    - /proc
sysfs              0     0     0    - /sys
none               0     0     0    - /sys/fs/fuse/connections
none               0     0     0    - /sys/kernel/debug
none               0     0     0    - /sys/kernel/security
udev            3.7G  8.0K  3.7G   1% /dev
devpts             0     0     0    - /dev/pts
tmpfs           1.5G  164K  1.5G   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            3.7G     0  3.7G   0% /run/shm
/dev/xvdb       414G  199M  393G   1% /mnt

Yaron Naveh

Posted 2012-09-22T14:41:51.057

Reputation: 253

Answers

2

There are a couple recommended options for dealing with your situation running out of space on the root EBS volume of an instance:

  1. Attach a new EBS volume to the instance and put your database on it. Here's an article I wrote for Amazon back in 2008 that describes the recommend approach to do this: http://aws.amazon.com/articles/1663 (Note that /dev/sdh needs to be changed to /dev/xvdh on the newer Ubuntu instances).

  2. Increase the size of your root EBS volume so that you have room to grow your database. This can be done by stopping the instance, snapshotting the volume, creating a larger volume from the snapshot, attaching it to the instance, and starting the instance. Here's an article I wrote that describes the steps in detail: http://alestic.com/2010/02/ec2-resize-running-ebs-root

If you care about preserving your data, I do not recommend putting it on /mnt (/dev/xvdb) as that disk is ephemeral storage. All data on ephemeral storage will disappear forever whenever the instance is stopped, terminated, or fails.

Data on EBS volumes is preserved when an instance is stopped or fails. By default the root EBS volume will be deleted on instance termination, but that can be changed by clearing the delete-on-termination property on the EBS volume. Here's an article I wrote that includes information on the delete-on-termination flag and how to change it: http://alestic.com/2010/01/ec2-instance-locking

Eric Hammond

Posted 2012-09-22T14:41:51.057

Reputation: 286

thanks, while the root ESB is almost full, is there a performance penalty? e.g. does this reduce the available virtual memory? – Yaron Naveh – 2012-09-22T15:14:56.783

@YaronNaveh: The biggest problem is the fact that you might run out of disk space. The EBS volume has nothing to do with memory unless you have created a swap file on it. – Eric Hammond – 2012-09-22T15:17:51.697

thanks, where is the swap by default? – Yaron Naveh – 2012-09-22T15:19:49.103

@Naveh: That's probably worth creating a new question. Feel free to reference it here. – Eric Hammond – 2012-09-22T20:01:51.653

3

What does this mean?

What does what mean, this sounds like a rhetorical question to me. Have you read the man pages?

man df

will bring you to more information about the df command.

Do I have a few partitions and can now utilize others besides /dev/xvda1?

You can utilize them. But whether you do is completely up to you.

Just avoid things that are mounted on /proc, /sys, /dev and /run and you'll be safe...

Also /dev/xvdb seems large, is it safe to put the db in it and only use it?

We don't know for sure. That's completely up to you to figure out...

If so do I need to mount it or do something special?

Read it again, here are the outer ends of your table:

Filesystem      Mounted on
/dev/xvdb       /mnt

Tamara Wijsman

Posted 2012-09-22T14:41:51.057

Reputation: 54 163