Skip to content

Docker Swarm on Debian 12 (Bookworm)

Part 1: VM Setup

Partition layout

The VM is cloned from a template, which now includes:

  • CPU: 2
  • Memory: 4GB
  • NIC: 1 (VMXNET3 with DirectPath I/O)
  • Hard disk 1: 50GB
    • /boot: 1GB (ext4)
    • / (root partition): 19GB (ext4, LVM mapped to /dev/vg0/lvroot)
    • The root partition will be extended to cover the remaining space
  • Hard disk 2: 100GB
    • Will be formatted by cephadm for CephFS usage

Resize the root partition

Install the parted package

sudo apt update
sudo apt install -y parted

Use parted to resize the physical volume

Note

It is possible to use pvcreate to create another physical volume with the remaining space, and add it to the volume group. But in this example, we extend the existing physical volume instead.

sudo parted

# The print command checks for the current partition layout
print

# Use resizepart to resize the partition to 100%
resizepart
# Partition number: 2
# End? 100%

# Check the partition layout again with print
print

quit

Extend the physical volume

sudo pvs

# Assuming the physical disk is /dev/sda2
sudo pvresize /dev/sda2

Extend the volume group

sudo vgs

# Assuming the physical disk is /dev/sda2
sudo vgextend vg0 /dev/sda2

Extend the logical volume

sudo lvs

# Note the plus (+) sign
sudo lvextend -l +100%FREE /dev/vg0/lvroot

Extend the root partition with resize2fs

sudo resize2fs /dev/vg0/lvroot

# Re-check the root partition with df command
df -h