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

Want to support HowtoForge? Become a subscriber!
Submitted by falko (Contact Author) (Forums) on Tue, 2009-01-06 17:54. ::

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


root@Knoppix:~# 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


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.

Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.