2

We have a VM in AWS that is running Red Hat Enterprise Linux Atomic Host 7.7.3.1. AWS shows this EBS volume attached to it:

enter image description here

And the size of the volume is 60 GB:

enter image description here

I do not know who set up the VM or how they installed RHEL Atomic. But the instance only has a 10 GB partition as you can see from these commands:

[atomic@xyz ~]$ df
Filesystem                1K-blocks    Used Available Use% Mounted on
devtmpfs                    3719976       0   3719976   0% /dev
tmpfs                       3745696       0   3745696   0% /dev/shm
tmpfs                       3745696    1000   3744696   1% /run
tmpfs                       3745696       0   3745696   0% /sys/fs/cgroup
/dev/mapper/atomicos-root  10164224 5374036   4790188  53% /sysroot
/dev/xvda1                   303780  117520    186260  39% /boot
tmpfs                        749140       0    749140   0% /run/user/1001
[atomic@xyz ~]$ sudo pvs
  PV         VG       Fmt  Attr PSize PFree
  /dev/xvda2 atomicos lvm2 a--  9.70g    0 
[atomic@xyz ~]$ sudo lvs
  LV   VG       Attr       LSize Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root atomicos -wi-ao---- 9.70g                                                    
[atomic@xyz ~]$ sudo vgs
  VG       #PV #LV #SN Attr   VSize VFree
  atomicos   1   1   0 wz--n- 9.70g    0 
[atomic@xyz ~]$ sudo parted /dev/xvda "print free"
Model: Xen Virtual Block Device (xvd)
Disk /dev/xvda: 64.4GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
        32.3kB  1049kB  1016kB           Free Space
 1      1049kB  316MB   315MB   primary  xfs          boot
 2      316MB   10.7GB  10.4GB  primary               lvm
        10.7GB  64.4GB  53.7GB           Free Space

How can I extend the root partition to take up the entire 60 GB of the EBS volume? I already tried sudo lvextend -l +100%FREE /dev/atomicos/root and that didn't do anything.

pacoverflow
  • 261
  • 2
  • 3
  • 17

1 Answers1

2

I did the following to resize it:

  1. sudo cfdisk /dev/xvda, selected the Free Space, New, Primary, entered the size, Write, Quit
  2. reboot the server
  3. sudo pvcreate /dev/xvda3
  4. sudo vgextend atomicos /dev/xvda3
  5. sudo lvextend -l +100%FREE /dev/atomicos/root
  6. sudo xfs_growfs /dev/atomicos/root

Now the partition is using the full EBS volume:

[atomic@xyz ~]$ df
Filesystem                1K-blocks    Used Available Use% Mounted on
devtmpfs                    3719976       0   3719976   0% /dev
tmpfs                       3745696       0   3745696   0% /dev/shm
tmpfs                       3745696     916   3744780   1% /run
tmpfs                       3745696       0   3745696   0% /sys/fs/cgroup
/dev/mapper/atomicos-root  62588928 5245548  57343380   9% /sysroot
/dev/xvda1                   303780  117520    186260  39% /boot
tmpfs                        749140       0    749140   0% /run/user/1001
[atomic@xyz ~]$ sudo pvs
  PV         VG       Fmt  Attr PSize   PFree
  /dev/xvda2 atomicos lvm2 a--    9.70g    0 
  /dev/xvda3 atomicos lvm2 a--  <50.00g    0 
[atomic@xyz ~]$ sudo lvs
  LV   VG       Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root atomicos -wi-ao---- <59.70g                                                    
[atomic@xyz ~]$ sudo vgs
  VG       #PV #LV #SN Attr   VSize   VFree
  atomicos   2   1   0 wz--n- <59.70g    0 

References:

pacoverflow
  • 261
  • 2
  • 3
  • 17