1

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?

6
  • What region and AMI id are you starting with? Oct 18, 2012 at 17:37
  • @EricHammond - us-east but we are using a custom AMI that we built ourselves.
    – anonymous
    Oct 18, 2012 at 18:53
  • Did you start with a public AMI or did you build it from scratch? Oct 18, 2012 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.
    – anonymous
    Oct 18, 2012 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. Oct 18, 2012 at 20:12

1 Answer 1

1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .