Friday, September 2, 2016

Adding disk space to a graylog 1.x OVA without creating a new drive

There are a few tutorials out there that explain how to do this by adding a new drive. Most notably:

However, I found you can skip the hassle of a second drive by following these steps:

1. Extend Disk in VMWare

2. Parted

Run the following command

sudo parted

Then inside parted, run:

print

This will list your volumes. For me it was:

Number  Start   End     Size    Type      File system  Flags
 1      1049kB  256MB   255MB   primary   ext2         boot
 2      257MB   21.0GB  20.7GB  extended
 5      257MB   21.0GB  20.7GB  logical                lvm

Next, inside parted, run:

resizepart
Partition number? 2
End? [21.0GB]? 50000 (to extend to 50,000mb ~50gb)
resizepart
Partition number? 5
End? [21.0GB]? 50000 (to extend to 50,000mb ~50gb)
exit

If you want, you can run print again to see the new sizes


3. lvm

Launch LVM:

sudo lvm

Then inside LVM, run: pvdisplay

This shows all of the physical volumes. In my case:

 --- Physical volume --- 
  PV Name               /dev/sda5 
  VG Name               graylog-vg 
  PV Size               19.29 GiB / not usable 2.00 MiB 
  Allocatable           yes (but full) 
  PE Size               4.00 MiB 
  Total PE              4938 
  Free PE               0 
  Allocated PE          4938 
  PV UUID               ifegZp-w4fj-zQwe-8DQW-LWaB-CxOo-mL3qLG 

Next, resize this volume by running:

pvresize /dev/sda5

This extends the physical volume to fill the rest of the space freed up via parted

Next, run the following command to show the new size:

pvdisplay

Next, run this command to show the logical volumes:

lvdisplay

Then resize the main logical volume:

lvresize -l +100%FREE /dev/graylog-vg/root

This resizes the selected volume to take up the rest of the free space

You can confirm the new size by running

lvdisplay


4. resize2fs

The problem now is that if you run "df -h" you still only see the originally-remaining free space. To fix that you have to run:

sudo resize2fs /dev/mapper/graylog--vg-root

No comments:

Post a Comment