/Chef 12

Server Data Storage

Managing how data is stored on the Chef server is sometimes necessary, such as rezising DRBD logical volumes, volume groups, and space available on the primary backend machine.

Resize DRBD

DRBD may be resized. First, make a backup of the Chef server data.

  • The mounted filesystem on the primary backend server is ext4
  • The backing device for the mounted ext4 filesystem is an LVM2 volume named /dev/opscode/drbd


For more information about logical volume manager (LVM), see http://www.tldp.org/HOWTO/LVM-HOWTO/. For more information about DRBD, see http://drbd.linbit.com/users-guide/s-resizing.html.


After backing up the Chef server data, make a note of the current size of the /dev/opscode/drbd logical volume and mountpoint. Run the following commands:

sudo lvdisplay -v --units 4096k /dev/opscode/drbd

and then:

df -k /var/opt/opscode/drbd/data

Verify that DRBD is in good shape on both backend machines. Both the primary and secondary machines should show states similar to Primary/Secondary UpToDate/UpToDate.

Run the following command:

cat /proc/drbd


Save these results to compare them to the same data post-resize.

Volume Groups

Resize the volume group on both backend systems. Run the following commands and replace sdb1 for the correct device name:

pvcreate /dev/sdb1

and then:

vgextend opscode /dev/sdb1

Logical Volumes

Resize the logical volumes identically on both backend machines. Due to differences in the space available for logical volumes on the primary and secondary backend machines (which is typically caused by existing snapshots), the size of the logical volume should be specified in absolute terms on both sides of the DRBD link, rathern than in percentages. Be sure to leave about 20% of the total available space free on both sides of the DRBD link, minus any existing snapshots. Run the following command and replace SIZE with a value similar to 10GiB:

lvextend -LSIZE /dev/opscode/drbd

For example, if the volume group has 10GB total, only 8GB should be allocated to the logical volume, which leaves 20% of the volume group available:

lvextend -L8GiB /dev/opscode/drbd

Primary Backend

Resize DRBD on the current primary backend to extend the size of the DRBD device. Run the following command:

sudo drbdadm resize pc0

The size of the /dev/drbd0 backing device’s mountpoint should grow. This change may take some time to complete, as DRBD may want to synchronize the changes across the network, even though they are empty blocks.

Primary File System

Resize the file system only on the current primary backend. Run the following command:

sudo resize2fs /dev/drbd/by-disk/opscode/drbd

Verify Resize

To verify the results of resizing DRBD, run the following commands and compare the results to the same data that was collected prior to resizing DRBD:

sudo lvdisplay -v --units 4096k /dev/opscode/drbd

and then:

df -k /var/opt/opscode/drbd/data

© Chef Software, Inc.
Licensed under the Creative Commons Attribution 3.0 Unported License.
The Chef™ Mark and Chef Logo are either registered trademarks/service marks or trademarks/servicemarks of Chef, in the United States and other countries and are used with Chef Inc's permission.
We are not affiliated with, endorsed or sponsored by Chef Inc.