IBM Support

Linux on Z: resize btrfs filesystem on LVM2 logical volume

How To


Summary

How to add another DASD disk to LVM and resize a btrfs filesystem onto it.

Steps

We assume the disk has already been made available to the system.
First, we need to partition it so LVM can use the partition. 
Remember under z the entire DASD cannot be used as-is, so typically we make one large partition that spans the DASD.
zlinux:~ # lsdasd
Bus-ID     Status      Name      Device  Type  BlkSz  Size      Blocks
==============================================================================
0.0.f60b   active      dasda     94:0    ECKD  4096   7043MB    1803060
0.0.f60c   active      dasdb     94:4    ECKD  4096   7043MB    1803060
0.0.f61c   active      dasdc     94:8    ECKD  4096   7043MB    1803060
dasdc is the new one we've added
zlinux:~ # vgs
VG #PV #LV #SN Attr VSize VFree
rootvg 2 1 0 wz--n- 12.59g 8.00m
zlinux:~ # pvs
PV VG Fmt Attr PSize PFree
/dev/dasda3 rootvg lvm2 a-- 5.71g 8.00m
/dev/dasdb1 rootvg lvm2 a-- 6.88g 0
Add a partition to the DASD:
zlinux:~ # fdasd -a /dev/dasdc
reading volume label ..: VOL1
reading vtoc ..........: ok
auto-creating one partition for the whole disk...
writing volume label...
writing VTOC...
rereading partition table...
Add the partition dasdc1 to the LVM disk list:
zlinux:~ # pvcreate /dev/dasdc1
Physical volume "/dev/dasdc1" successfully created
zlinux:~ # pvs
PV VG Fmt Attr PSize PFree
/dev/dasda3 rootvg lvm2 a-- 5.71g 8.00m
/dev/dasdb1 rootvg lvm2 a-- 6.88g 0
/dev/dasdc1        lvm2 --- 6.88g 6.88g
Now add that pv to rootvg:
zlinux:~ # vgextend rootvg /dev/dasdc1
  Volume group "rootvg" successfully extended
zlinux:~ # vgs
  VG     #PV #LV #SN Attr   VSize  VFree
  rootvg   3   1   0 wz--n- 19.46g 6.88g
Notice PV count is now 3
zlinux:~ # pvs
  PV          VG     Fmt  Attr PSize PFree
  /dev/dasda3 rootvg lvm2 a--  5.71g 8.00m
  /dev/dasdb1 rootvg lvm2 a--  6.88g    0
  /dev/dasdc1 rootvg lvm2 a--  6.88g 6.88g
Now grow the logical volume. I think you can specifically say to grow it onto dasdc1 but we’ll let LVM handle that detail:
zlinux:~ # lvextend /dev/rootvg/rootfs -L +2G
  Size of logical volume rootvg/rootfs changed from 12.58 GiB (3221 extents) to 14.58 GiB (3733 extents).
  Logical volume rootfs successfully resized
zlinux:~ # btrfs filesystem resize max /
Resize '/' of 'max'
zlinux:/ # df -h .
Filesystem                 Size  Used Avail Use% Mounted on
/dev/mapper/rootvg-rootfs   15G   13G  2.3G  85% /

Document Location

Worldwide

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SGMV168","label":"SUSE Linux Enterprise Server"},"Component":"","Platform":[{"code":"PF051","label":"Linux on IBM Z Systems"},{"code":"PF048","label":"SUSE"},{"code":"PF037","label":"z\/VM"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"LOB57","label":"Power"}}]

Document Information

Modified date:
01 April 2021

UID

ibm10967709