Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I recently ran out of space on a c1.medium EC2 instance store root partition. I did some cleaning and freed some space, but I still want to resize the partition. In fact, I would prefer to remove the /dev/xvda2 partition and allocate all free space to the /dev/xvda1 partition. Here are the details on the current set up:

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1      9.9G  3.0G  6.4G  32% /
tmpfs           858M     0  858M   0% /dev/shm
/dev/xvda2      335G  195M  318G   1% /media/ephemeral0

I've found plenty of examples of resizing EBS backed instances, but nothing on instance store. Is this possible?

Update: Using fdisk -l shows three disks rather than partitions (unless I'm reading it wrong). Amazon's docs say there should be one drive.

# fdisk -l

Disk /dev/xvda1: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/xvda2: 365.0 GB, 365041287168 bytes
255 heads, 63 sectors/track, 44380 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/xvda3: 939 MB, 939524096 bytes
255 heads, 63 sectors/track, 114 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
share|improve this question
    
xvda2 is your ephemeral storage. You can't boot from it! –  Michael Hampton Jan 8 at 0:48

3 Answers 3

It's not possible to resize instance backed root volumes on the fly. You'll need to launch a new instance. I've done something similar by creating an AMI and then launching a new instance from that AMI and giving it a bigger instance store. Official AWS doc here:

Amazon Resizing Instances Store Backed Instances

share|improve this answer

If the disk is recognized as xvda, you should be able to remove the xvda2 using fdisk and create it again using the entire free space. You will need to reboot so that the kernel can see the new size, then you will need to run resize2fs on the partition before you mount it.

If you want to use the entire disk for xvda1, you can remove all partitions and create xvda1 using the whole partition. Just pay attention when recreating partitions, they must have the same starting block, otherwise you risk losing your data.

share|improve this answer
    
I tried the fdisk option you mentioned, but it lists three drives instead of partitions. –  iJeep Jan 7 at 22:52
    
did you try something like fdisk -l /dev/xvda? Or what else? –  Renan Jan 7 at 22:58
2  
fdisk -l /dev/xvda doesn't return anything because /dev/xvda doesn't exist. I think part of the problem is that these are "virual" disks, not actual physical disks. –  iJeep Jan 7 at 23:26

Are you sure your root filesystem is on the instance store? The instance store of c1.medium should be around 350GB large, which correspond to /dev/xvda2 while your root filesystem is in /dev/xvda1.

Please check on the AWS console whether there is any EBS attached, which I would guess there is one on /dev/xvda1.

share|improve this answer

Your Answer

 
discard

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.