Resize encrypted disk
Automatic
There is a script available on the bacula directors named « resize_luks » that is in the PATH. You need to specify the VG you want to increase so that it can find the right partitions
For example if you want to increase the partition /opt/dedupRepl/containers its VG is containersRepl
-
Run sudo vgs :
$sudovgsVG#PV #LV #SN Attr VSize VFreecl 2 4 0 wz--n- 53.49g 0cl_data 1 1 0 wz--n- <90.00g 0containers 1 1 0 wz--n- <38.00t 0containersRepl 1 1 0 wz--n- <20.00t 0index 1 1 0 wz--n- <100.00g 0indexRepl 1 1 0 wz--n- <100.00g 0volumes 1 1 0 wz--n- <370.00g 0volumesRepl 1 1 0 wz--n- <400.00g 0 -
Run resize_luks:
sudoresize_luks containersRepl -
IF disk was full, restart service:
sudosystemctl restart bacula-sd@9103.service
Manual
We use LUKS on LVM for our encrypted Disks.
First you will need to increase the Disk size in VMWare Vcenter.
Then to resize the disk you will need to have two information:
- The disk letter
- The crypt device UUID
- The VG name
To get the disk letter and the crypt device UUID, you can use « lsblk » command:
[jte@p1baculadirector1a ~]$ lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT...sdf 8:80 0 40G 0 disk └─index-data 253:6 0 40G 0 lvm └─crypt-0815986c-39c2-4cfa-9c2f-935b4ee30255 253:9 0 40G 0 crypt /opt/dedup/index... |
In the example the disk letter is f, the device UUID is 0815986c-39c2-4cfa-9c2f-935b4ee30255 and the VG name is index
Then run the following script with your values:
echo 1 > /sys/block/sd<DISK_LETTER>/device/rescanpvresize /dev/sd<DISK_LETTER>lvextend -l+100%FREE /dev/<VG_NAME>/datacryptsetup resize /dev/mapper/crypt-<UUID> -vxfs_growfs /dev/mapper/crypt-<UUID> |
Add new disk to existing partition
We use LUKS on LVM for our Bacula setup. This lets us span our encrypted FS over multiple logical disks.
First add a new disk to your Bacula instance and make it appear in lsblk:
for host in /sys/class/scsi_host/*; do echo "- - -" | sudo tee $host/scan; ls /dev/sd* ; done |
Then use the following steps (e.g. for /dev/sde)
sudo pvcreate /dev/sde |
Then expand the correct volume group
sudo vgextend containers /dev/sde |
Then expand the data logical volume of this group
sudo lvextend -l+100%FREE /dev/containers/data |
We should now see that the underlying disk has expanded but the LUKS volume has not. We will refresh it
sudo cryptsetup resize /dev/mapper/crypt-XXX -v |
Finally we need to grow the filesystem
sudo xfs_growfs /dev/mapper/crypt-XXX |