Overview

This article walks through adding a new virtual disk to a Versa VOS appliance (FlexVNF / SASE Gateway) and extending the root (/) filesystem using the built-in lvm-extend.sh script.

This is useful when the root partition is running low on space and you have the ability to attach an additional virtual disk to the VM (e.g., via KVM, VMware, AWS, Azure, etc.).

Prerequisites

  • Admin or sudo access on the VOS appliance
  • Ability to attach a new virtual disk to the VM from your hypervisor or cloud console
  • The appliance must be using LVM (default for VOS deployments)

Procedure

Step 1 — Verify Current Disk Layout

Before adding the new disk, confirm your existing layout:

[admin@VOS-Node: ~] $ lsblk
NAME              MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                 8:0    0   80G  0 disk
`-sda1              8:1    0   80G  0 part
  |-system-root   253:0    0   79G  0 lvm  /
  `-system-swap_1 253:1    0  980M  0 lvm  [SWAP]
sr0                11:0    1  3.8G  0 rom

Note the existing volume group (system), root LV size, and available disks.

You can also verify LVM details:

[admin@VOS-Node: ~] $ sudo pvs
  PV         VG     Fmt  Attr PSize   PFree
  /dev/sda1  system lvm2 a--  <80.00g    0

[admin@VOS-Node: ~] $ sudo vgs
  VG     #PV #LV #SN Attr   VSize   VFree
  system   1   2   0 wz--n- <80.00g    0

[admin@VOS-Node: ~] $ sudo lvs
  LV     VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root   system -wi-ao---- <79.04g
  swap_1 system -wi-ao---- 980.00m

Step 2 — Attach a New Disk from Your Hypervisor

Add a new virtual disk to the VM from your hypervisor or cloud console. In this example, a 24 GB disk is added.

Once attached, verify the new disk is visible:

[admin@VOS-Node: ~] $ lsblk
NAME              MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                 8:0    0   80G  0 disk
`-sda1              8:1    0   80G  0 part
  |-system-root   253:0    0   79G  0 lvm  /
  `-system-swap_1 253:1    0  980M  0 lvm  [SWAP]
sdb                 8:16   0   24G  0 disk
sr0                11:0    1  3.8G  0 rom

The new disk (sdb) should appear with no partitions or mount points.

Note: The device name may vary depending on your environment (e.g., /dev/vdb, /dev/xvdb, /dev/nvme1n1). Adjust accordingly.

Step 3 — Run the LVM Extend Script

VOS ships with a built-in script that handles partitioning, PV creation, VG extension, LV extension, and filesystem resize in a single step.

The script is located at:

/opt/versa/scripts/lvm-extend.sh

Run the script with the new disk device as the only argument:

[admin@VOS-Node: ~] $ sudo /opt/versa/scripts/lvm-extend.sh /dev/sdb
 => Creating partition on /dev/sdb
 => Initializing partition /dev/sdb for LVM use
 => Adding partition /dev/sdb to volume group
 => Extending logical volume
 => Extending filesystem

 => Success extending LVM

Filesystem               Size  Used Avail Use% Mounted on
udev                     5.7G     0  5.7G   0% /dev
tmpfs                    1.6G  5.0M  1.6G   1% /run
/dev/mapper/system-root  101G   18G   79G  18% /
tmpfs                    7.8G  112K  7.8G   1% /dev/shm
tmpfs                    5.0M     0  5.0M   0% /run/lock
tmpfs                    7.8G     0  7.8G   0% /sys/fs/cgroup
tmpfs                     16M     0   16M   0% /mnt/versa_ramdisk
tmpfs                    1.6G     0  1.6G   0% /run/user/1001

The root filesystem has grown from 78 GB to 101 GB.

Important: Pass the raw disk device (e.g., /dev/sdb), not a partition (e.g., /dev/sdb1). The script handles partitioning internally.

Step 4 — Verify

Confirm the extension was successful:

[admin@VOS-Node: ~] $ df -kh /
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/system-root  101G   18G   79G  18% /

No reboot is required. The additional space is available immediately.

What the Script Does

For reference, lvm-extend.sh performs the following operations under the hood:

  1. Partitions the new disk using fdisk
  2. Creates a physical volume (pvcreate) on the disk
  3. Extends the volume group (vgextend) to include the new PV
  4. Extends the root logical volume (lvextend -l+100%FREE) with all available space
  5. Resizes the filesystem (resize2fs) to use the new space

Note: This version of the script always allocates 100% of the new disk to the root LV. It does not support splitting across multiple logical volumes or specifying a percentage.

Troubleshooting

Script ignores --hdd-location or --lv-name flags

The version of lvm-extend.sh shipped with VOS takes a single positional argument only. Named flags such as --hdd-location, --lv-name, and --percentage are not supported. Use:

sudo /opt/versa/scripts/lvm-extend.sh /dev/<disk>

"Please provide HDD location" error

This means the script did not receive exactly one argument. Ensure you are passing only the disk device path and nothing else.

fdisk warnings about "Value out of range" or "No free sectors available"

This can happen if the disk was already partitioned (e.g., manually via cfdisk or fdisk) before running the script. The script will still proceed and use the disk. Verify with df -kh / that the extension completed.

Applies To

  • Versa VOS (FlexVNF / SASE Gateway)