User Tools

Site Tools


other:networking:opnsense:resizevirt

Resizing opnSense virtual

Steps are mostly as follows

  1. shutdown the vm & snapshot or back up image
  2. resize the disk image. NOTE: must be larger to retain contents. Use one of the following, depending on where the disk image is stored
    1. truncate -s 10G target.img # local image as a file
    2. lvextend -L 10G /dev/vgname/lvname # an LVM volume
    3. zfs set quota=10G storage/target # a ZFS volume
  3. boot up resized opnsense
  4. Find
    gpart show               #Show all to select the correct target drive
    gpart show vtbd0         #Will likely show a corrupted GPT ....
    gpart recover vtbd0      #Repair the "corrupted" GPT
    gpart show vtbd0         #Show again to verify and find the partition we're interested in
  5. This will show something similar to the following
    =>      40  20971440  vtbd0  GPT  (10G)
            40    532480      1  efi  (260M)
        532520      1024      2  freebsd-boot  (512K)
        533544  20437936      3  freebsd-ufs  (9.7G)
  6. Now, resize the partition
    gpart resize -i 3 vtdb0  #Resize the freebsd-ufs partition (free space MUST be below the partition)
    gpart show vtbd0         #Verify resize is what we expect
    growfs /dev/gpt/rootfs   #Grow the filesystem
    fsck -y /dev/gpt/rootfs  #Force a filesystem check/repair
  7. df should now show expanded file space – reboot for good measure
other/networking/opnsense/resizevirt.txt · Last modified: 2022/11/09 23:41 by rodolico