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?
1 Answer
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
/dev/xvda2/
drive irrespective of the AMI itself.