How To Resize LVM Software RAID1 Partitions (Shrink & Grow) - Page 2

2.2 Growing An Intact Array

Boot into your rescue system and activate all needed modules:

modprobe md
modprobe linear
modprobe multipath
modprobe raid0
modprobe raid1
modprobe raid5
modprobe raid6
modprobe raid10

Then activate your RAID arrays...

cp /etc/mdadm/mdadm.conf /etc/mdadm/mdadm.conf_orig
mdadm --examine --scan >> /etc/mdadm/mdadm.conf

mdadm -A --scan

...and start LVM:

/etc/init.d/lvm start

Now we can grow /dev/md1 as follows:

mdadm --grow /dev/md1 --size=max

--size=max means the largest possible value. You can as well specify a size in KiBytes (see previous chapter).

Then we grow the PV to the largest possible value...

pvresize /dev/md1

... and take a look at

vgdisplay

[email protected]:~# vgdisplay
  --- Volume group ---
  VG Name               server1
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  29
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               4.75 GB
  PE Size               4.00 MB
  Total PE              1217
  Alloc PE / Size       1023 / 4.00 GB
  Free  PE / Size       194 / 776.00 MB
  VG UUID               X3ZYTy-39yq-20k7-GCGk-vKVU-Xe0i-REdEu0

[email protected]:~#

We have 194 free PE that we can allocate to our /dev/server1/root LV:

lvextend -l +194 /dev/server1/root

Then we run a file system check...

e2fsck -f /dev/server1/root

..., resize the file system...

resize2fs /dev/server1/root

... and check the file system again:

e2fsck -f /dev/server1/root

Afterwards you can boot back into your normal system.

Falko Timme

About Falko Timme

Falko Timme is an experienced Linux administrator and founder of Timme Hosting, a leading nginx business hosting company in Germany. He is one of the most active authors on HowtoForge since 2005 and one of the core developers of ISPConfig since 2000. He has also contributed to the O'Reilly book "Linux System Administration".

Share this page:

Suggested articles

0 Comment(s)

Add comment

Comments

By: Falko Timme