2

I'm sure the problem appears because of my misunderstanding of Ec2+EBS configuring, so answer might be very simple.

I've created RedHat ec2 instance on the Amazon WS with 30GB EBS storage. But lsblk shows me, that only 6GB of total 30 is available for me:

xvda    202:0    0  30G  0 disk
└─xvda1 202:1    0   6G  0 part /

How can I mount all remaining storage space to my instance?

[UPDATE] commands output:

mount:

/dev/xvda1 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

sudo fdisk -l /dev/xvda:

WARNING: GPT (GUID Partition Table) detected on '/dev/xvda'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/xvda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 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

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1               1        1306    10485759+  ee  GPT

resize2fs /dev/xvda1:

resize2fs 1.41.12 (17-May-2010)
The filesystem is already 1572864 blocks long.  Nothing to do!
ozahorulia
  • 9,798
  • 8
  • 48
  • 72

2 Answers2

2

I believe you are experiencing an issue that seems specific to EC2 and RHEL* where the partition won't extend using the standard tools.

If you follow the instructions of this previous answer you should be able to extend the partition to use the full space. Follow the instructions particularly carefully if expanding the root partition!

unable to resize root partition on EC2 centos

Community
  • 1
  • 1
1

If you update your question with the output of fdisk -l /dev/xvda and mount it should help provide any extra information if the following isnt suitable:

I would assume that you could either re-partition xvda to provision the space for another mount point (/var or /home for example) or grow your current root partition into the extra space available - you can follow this guide here to do this

Obviously be sure to back up any data you have on there, this is potentially destructive!

[Update - how to use parted]

The following link will talk you through using GNU Parted to create a partition, you will essentially just need to create a new partition, then I would temporarily mount this to a directory such as /mnt/newhome, copy across all of the current contents of /home (recursively as root keeping permissions with cp -rp /home/* /mnt/newhome), then I would rename the current /home to /homeold, then make sure you have set up Fstab to have the correct entry: (assuming your new partition is /dev/xvda2)

/dev/xvda2    /home    /ext4     noatime,errors=remount-ro 0     1

the1dv
  • 893
  • 7
  • 14
  • Thanks for the extra info, I've updated my answer to be a little bit more specific, if you dont want to use the extra space for a different mount point as specified above you will need to follow the steps in that link to resize your root partition, it's a lot more work - what are you planning on using the extra space for? – the1dv Feb 16 '15 at 10:46
  • Since the extending of the root partition requires to make backups, attaching the volume to another instance, etc. I would like to allocate all remaining space to another mount point (eg /home). How can I do that? Can you provide some manual for redhat? – ozahorulia Feb 16 '15 at 11:16
  • I've updated my answer for this, it is pretty simple stuff, just basic partitioning :) – the1dv Feb 16 '15 at 11:50
  • No, sorry, I still have a problem. It seemed to be working, but after restart I can't connect to ssh as I used to. It gives me the following error: "Permission denied (publickey,gssapi-keyex,gssapi-with-mic).". Any idea what could went wrong? – ozahorulia Feb 16 '15 at 12:40
  • Update again, I've made it work. I should have created /home directory again, before rebooting. And after that I run `restorecon -R -v /home`, but I'm not sure if it helped or not. You might want to update your answer for the further users. – ozahorulia Feb 16 '15 at 14:02
  • `cp` is better to substitute by `tar` or `rsync`. – 0andriy Feb 17 '15 at 08:51