2

I am working on expanding a currently attached volume to one of my Ubuntu Amazon AWS servers, but I am having some problems. I already created a new volume from a snapshot, then attached the newly created volume to the EC2 instance. I prepare the volume for use by the following commands:

sudo vgchange -a y
sudo cryptsetup luksOpen /dev/mapper/vgdata2-lvdata cryptmnt

This volume was originally 600GB and is now 700GB. After mounting the volume with

sudo mount /dev/mapper/cryptmnt /mnt/ebs1

I try to expand the volume using

sudo xfs_growfs -d /mnt/ebs1/

Which results in this output

meta-data=/dev/mapper/cryptmnt   isize=256    agcount=4, agsize=39321280 blks
         =                       sectsz=512   attr=2
data     =                       bsize=4096   blocks=157285119, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal               bsize=4096   blocks=76799, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data size unchanged, skipping

I have no idea if I'm doing something wrong or if there are steps that I am missing. Running df -h after this results in the following output

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             7.9G  4.8G  2.7G  65% /
none                  827M  124K  827M   1% /dev
none                  833M     0  833M   0% /dev/shm
none                  833M   52K  833M   1% /var/run
none                  833M     0  833M   0% /var/lock
/dev/mapper/cryptmnt  600G  598G  2.3G 100% /mnt/ebs1

Which shows that the volume was not resized.

1 Answer 1

3
+50

When resizing a volume, you need to resize all the layers, starting from the bottom up.

In this case you have 6 layers:

  • EC2 volume
  • LVM physical volume
  • LVM volume group (automatic upon resizing the physical volume)
  • LVM logical volume
  • LUKS volume
  • XFS filesystem

In this case "bottom" means the first one

Resize the LVM physical volume:

pvresize /dev/xvdH

(replace with the actual device path)

Resize the logical volume

lvresize -l +100%FREE vgdata2-lvdata

(adjust to how much space you want the volume to use if not 100%)

Resize the luks volume

cryptsetup resize /dev/mapper/cryptmnt

Resize the filesystem

xfs_growfs /mnt/ebs1
5
  • As far as I know, cryptsetup resize is for old, non-LUKS volumes only. For LUKS you don't have to do anything.
    – bseibold
    May 15, 2014 at 21:08
  • 2
    @bseibold last time I did my luks volume (couple months ago) I had to do it.
    – phemmer
    May 15, 2014 at 21:16
  • Well ok, I always close the volume during resize, so it's not necessary. If you have it opened, you might need it.
    – bseibold
    May 15, 2014 at 21:20
  • There is a detailed description avaiable here: help.ubuntu.com/community/ResizeEncryptedPartitions
    – bseibold
    May 15, 2014 at 21:21
  • @bseibold Ah yes, I always resize online. So that would probably be it.
    – phemmer
    May 15, 2014 at 22:57

You must log in to answer this question.

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