# Bigger disk for GELI partition



## weberjn (Mar 6, 2022)

I have a system on a disk with an unencrypted start partition to reboot -r into the main GELI partion.

How would one move these disk to a bigger one? How would one resize the GELI partition?
I have another FreeBSD system that I could mount the disks.


----------



## T-Daemon (Mar 6, 2022)

weberjn said:


> How would one move these disk to a bigger one? How would one resize the GELI partition?


1 - Boot into the geli(8) encrypted system
2 - Insert a external USB device, mount device
3 - Backup geli(8) metadata of provider to file:

```
# geli backup -v ada0p4 /mnt/ada0p4.key
```
4 - Insert a FreeBSD installer image, reboot system into installer image
5 - At the installer images "Welcome" dialog window drop to "Live CD"
6 - Clone the system from the small disk to big disk:

```
dd if=/dev/small_disk of=/dev/big_disk bs=1m status=progress
```
7 - Recover corrupted GPT/MBR partition table of big disk (assuming here ada0)

```
# gpart recover ada0
```
8 - Resize partition of geli(8) provider (there might be error messages, ignore them):

```
# gpart resize -i 4 ada0        (resize to remaining free space or specify size, see below)
                                        
# gpart resize -s 10g -i 4 ada0  (resize partion 4 + 10GB)
```
9 - Mount USB device with the backed up geli(8) metadata
10 - Restore geli(8) metadata of provider:

```
# geli restore -vf /mnt/ada0p4.key ada0p4
```
10 - Reboot into big disk geli(8) encrypted system

*EDIT:* In addition the file systems size needs to be increased as well, for UFS growfs(8), for ZFS zpool-online(8) `-e`.


----------

