3

I have resized the EBS volume using the AWS console Modify Volume. This is what the lsblk command returns before any change:

$ lsblk
NAME    MAJ:MIN  RM  SIZE RO TYPE  MOUNTPOINT
xvdn    202:208   0    4G  0 disk  
└─md0     9:0     0   16G  0 raid0 /mnt/data
xvdc    202:32    0   80G  0 disk  
└─md1     9:1     0  160G  0 raid0 /mnt/temp
xvda    202:0     0    8G  0 disk  
└─xvda1 202:1     0    8G  0 part  /
xvdp    202:240   0    4G  0 disk  
└─md0     9:0     0   16G  0 raid0 /mnt/data
xvdo    202:224   0    4G  0 disk  
└─md0     9:0     0   16G  0 raid0 /mnt/data
xvdb    202:16    0   80G  0 disk  
└─md1     9:1     0  160G  0 raid0 /mnt/temp
xvdq    202:4096  0    4G  0 disk  
└─md0     9:0     0   16G  0 raid0 /mnt/data

I have increased the size of xvdn(/dev/sdn) to 6G. After which I restarted the instance. Note xvdn is used to create a RAID 0 array of 4 devices.

$ sudo file -s /dev/xvd*
/dev/xvda:  DOS/MBR boot sector; GRand Unified Bootloader, stage1 version 0x3, stage2 address 0x2000, 1st sector stage2 0x800, stage2 segment 0x200, GRUB version 0.94, extended partition table (last)
/dev/xvda1: Linux rev 1.0 ext4 filesystem data, UUID=1afa51d9-105a-4c14-8f32-8b8b424b1c81 (needs journal recovery) (extents) (large files) (huge files)
/dev/xvdb:  Linux Software RAID version 1.2 (1) UUID=cbe5ee82:c33cad21:699bec71:b4cf4a63 name=dbx_head:head_ephem level=0 disks=2
/dev/xvdc:  Linux Software RAID version 1.2 (1) UUID=cbe5ee82:c33cad21:699bec71:b4cf4a63 name=dbx_head:head_ephem level=0 disks=2
/dev/xvdn:  Linux Software RAID version 1.2 (1) UUID=c42b27c0:3586d4c5:635e2925:39a006e5 name=dbx_head:head_ebs level=0 disks=4
/dev/xvdo:  Linux Software RAID version 1.2 (1) UUID=c42b27c0:3586d4c5:635e2925:39a006e5 name=dbx_head:head_ebs level=0 disks=4
/dev/xvdp:  Linux Software RAID version 1.2 (1) UUID=c42b27c0:3586d4c5:635e2925:39a006e5 name=dbx_head:head_ebs level=0 disks=4
/dev/xvdq:  Linux Software RAID version 1.2 (1) UUID=c42b27c0:3586d4c5:635e2925:39a006e5 name=dbx_head:head_ebs level=0 disks=4

Which is mounted on xfs file type:

$ mount
/dev/md0 on /mnt/data type xfs (rw,noatime,nodiratime,swalloc,attr2,largeio,inode64,logbsize=128k,sunit=256,swidth=1024,noquota)
/dev/md1 on /mnt/temp type xfs (rw,noatime,nodiratime,swalloc,attr2,largeio,inode64,sunit=256,swidth=512,noquota)
/dev/md0 on /xdlog type xfs (rw,noatime,nodiratime,swalloc,attr2,largeio,inode64,logbsize=128k,sunit=256,swidth=1024,noquota)

After restarting there's no change in the size, so I did

$ xfs_growfs -d /dev/md0
meta-data=/dev/md0               isize=2048   agcount=17, agsize=262112 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=4194176, imaxpct=25
         =                       sunit=32     swidth=128 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=32 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data size unchanged, skipping

Now, the lsblk returns:

NAME    MAJ:MIN  RM  SIZE RO TYPE  MOUNTPOINT
xvdn    202:208   0    6G  0 disk  
└─md0     9:0     0   16G  0 raid0 /mnt/data
xvdc    202:32    0   80G  0 disk  
└─md1     9:1     0  160G  0 raid0 /mnt/temp
xvda    202:0     0    8G  0 disk  
└─xvda1 202:1     0    8G  0 part  /
xvdp    202:240   0    4G  0 disk  
└─md0     9:0     0   16G  0 raid0 /mnt/data
xvdo    202:224   0    4G  0 disk  
└─md0     9:0     0   16G  0 raid0 /mnt/data
xvdb    202:16    0   80G  0 disk  
└─md1     9:1     0  160G  0 raid0 /mnt/temp
xvdq    202:4096  0    4G  0 disk  
└─md0     9:0     0   16G  0 raid0 /mnt/data

But when I the file size through df -h, it shows no change:

Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        7.4G   96K  7.4G   1% /dev
tmpfs           7.4G   55M  7.3G   1% /dev/shm
/dev/xvda1      7.8G  1.8G  6.0G  23% /
tmpfs           7.4G   24K  7.4G   1% /home/xdaux/tmp
tmpfs           7.4G  124K  7.4G   1% /home/xdcrm/tmp
/dev/md0         16G   35M   16G   1% /xdlog
/dev/md1        160G  3.1G  157G   2% /mnt/temp

What am I doing wrong/missing here?

devd
  • 133
  • 4

1 Answers1

6

xvdn is part of a RAID0 array (md0), which is used by the filesystem. To extend the filesystem, you need to extend the md0 array but this requires you to extend all four component devices first. Basically:

  • take an EBS volume snapshot and/or other backups. Do NOT skip this step!
  • resize all four devices
  • umount the filesystem (umount /dev/md0)
  • stop the array (mdadm -S /dev/md0)
  • re-assemble the array with the --update=devicesize option (mdadm --assemble --update=devicesize /dev/md0 /dev/xvdn /dev/xvdp /dev/xvdo /dev/xvdq)
  • remount the filesystem (mount /dev/md0 /xdlog)
  • grow the filesystem (xfs_growfs /dev/md0)

Please note that I posted the bash commands for convenience only, please triple check before doing destructive operations.

shodanshok
  • 47,711
  • 7
  • 111
  • 180