Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

We are using Amazon c1.medium instances which come with 350GB of ephemeral storage that is mounted as /dev/xvda2 on our Debian images. We need this to be partitioned into two parts, one of which is 80 GB and the other with the remaining space. How can I partition that space on a running instance?

share|improve this question
What region and AMI id are you starting with? – Eric Hammond Oct 18 '12 at 17:37
@EricHammond - us-east but we are using a custom AMI that we built ourselves. – rjzii Oct 18 '12 at 18:53
Did you start with a public AMI or did you build it from scratch? – Eric Hammond Oct 18 '12 at 19:22
@EricHammond - It was built from scratch but my understanding is that we should be able to manipulate the /dev/xvda2/ drive irrespective of the AMI itself. – rjzii Oct 18 '12 at 19:59
Sure, I'm just trying to get a better understanding of what you're starting with so that the commands match your environment. Each AMI can be built with different attach points, mount points, installed software, etc. – Eric Hammond Oct 18 '12 at 20:12

1 Answer 1

up vote 1 down vote accepted

In this instance, lvm is the best way to approach the problem and there are a lot of good tutorials out there that go into the workings of lvm.

From the standpoint of this problem, once you have lvm figured out, things are fairly straightforward:

# Create the partitions that are needed for scratch space
pvcreate /dev/xvda2
vgcreate /dev/vg_xvda2 /dev/xvda2
lvcreate -L 80G -n scratch /dev/vg_xvda2
lvcreate -l 100%FREE -n large_scratch /dev/vg_xvda2

# Format the scratch space 
mkfs.ext3 /dev/vg_xvda2/scratch
mkfs.ext3 /dev/vg_xvda2/large_scratch

For reasons of convenience you may want to add a link to the partitions that were created so that they look like a drive, in which case:

# Create a link to the scratch space allocated 
ln -s /dev/vg_xvda2/scratch /dev/scratch
ln -s /dev/vg_xvda2/large_scratch /dev/large_scratch
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.