Skip to content

Add Data Disk

mFusion, HSG and mlog appliances keep their database (monitoring history, syslog, RADIUS accounting, reports) on the system disk by default, where the data partition is small. When the database grows, add a second, larger disk and move the database onto it. This guide explains how to prepare the disk, mount it, and move the MySQL database onto it with the disk show, disk create, disk mount and disk data commands.

Note

disk data replaces the older data-path command under mfusion mysql-server. See Upgrading from data-path if your appliance used it.


Overview

Adding a data disk takes four commands, run in enable mode:

Step Command What it does
1. Find the disk disk show Lists the disks and partitions, and shows where the MySQL data is stored
2. Prepare the disk disk create <disk> Creates one partition over the whole disk and formats it (ext4)
3. Mount the disk disk mount <folder> <partition> Mounts the partition on a folder, permanently (survives reboots)
4. Move the database disk data <folder> Moves the MySQL database onto the mounted disk

After step 3 the disk can also hold other large data, such as NetFlow collector files and backups. Step 4 is what moves the MySQL database.

The database keeps its usual location, /var/lib/mysql. disk data copies it to <folder>/mysql on the new disk and mounts that folder in its place, so MySQL settings, backups, restores and HA sync work the same as before.

The setting belongs to the appliance's hardware, not to its configuration: it is not saved in the startup configuration. Restoring a configuration backup onto another appliance therefore never tries to move its database to a disk that appliance may not have.


Use Cases

  • Growing monitoring history: an mFusion appliance monitoring thousands of devices, where the monitoring history no longer fits the system disk.
  • Log collector: an mlog or HSG appliance receiving syslog from many devices.
  • Hotspot accounting: an HSG appliance keeping months of RADIUS session and usage records.
  • Virtual appliances: adding a second virtual disk to an appliance running on VMware, Proxmox or a cloud platform.

Requirements

Requirement Details
Appliance mFusion, HSG or mlog on Debian 10 or later, running a firmware release later than 20261028-2330
Disk A second, empty disk, larger than the current database plus room to grow. All data on it is erased in step 2
Free space The new disk needs room for the current database plus 10% and 1 GB
Maintenance window MySQL and the services that use it (monitoring, RADIUS, GUI) are stopped while the database is copied, typically 1–2 minutes per 3 GB
Access CLI access in enable mode (console or SSH)

Step 1: Add the Disk and Find It

Attach the new disk to the appliance: install the drive, or add a virtual disk in the hypervisor or cloud console. Then list the disks:

mfusion# disk show

The new disk appears with its size and no partitions. In this example it is /dev/sdb, 500 GiB:

Disk /dev/sda: 120 GiB, 128849018880 bytes, 251658240 sectors
...
Device     Boot     Start       End   Sectors  Size Id Type
/dev/sda1  *         2048    976895    974848  476M 83 Linux
/dev/sda2          976896  32227327  31250432 14.9G 83 Linux
/dev/sda3        32227328  40228863   8001536  3.8G 82 Linux swap / Solaris
/dev/sda4        40228864 251656191 211427328 100.8G 83 Linux

Disk /dev/sdb: 500 GiB, 536870912000 bytes, 1048576000 sectors
...

MySQL data:   /var/lib/mysql (system disk)
my.cnf:       datadir=/var/lib/mysql
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda4        99G   12G   82G  13% /var

The last lines show where the MySQL data is stored now: on the system disk.

Warning

Make sure you pick the new, empty disk. /dev/sda is the system disk. disk create refuses to touch the system disk, but it erases any other disk you name.


Step 2: Prepare the Disk

Create one partition over the whole disk and format it:

mfusion# disk create /dev/sdb
all data on disk /dev/sdb will be lost. do you want to continue "y" or "n": y
...
[info] you can now map /dev/sdb1 to a folder.

The partition is /dev/sdb1. On NVMe and eMMC disks the partition name has a p, for example /dev/nvme1n1p1.

Skip this step if the disk already has an ext4 partition you want to use.


Step 3: Mount the Disk

Mount the partition on a folder. /data is the usual choice:

mfusion# disk mount /data /dev/sdb1
[info] creating a new folder /data
[info] mounting /data to /dev/sdb1...
[info] /data is mounted to /dev/sdb1 successfully.
[info] task executed successfully.

The mount is saved and comes back after every reboot. If the disk ever fails or is removed, the appliance still boots normally and stays reachable remotely; whatever stores data on the disk stops until the disk is back.

Only ext4 partitions are accepted.


Step 4: Move the Database

Move the MySQL database onto the mounted disk:

mfusion# disk data /data
MySQL (and the services using it) will be stopped while 2765MB of data is copied to /data/mysql. continue? "y" or "n": y
...
[info] copying /var/lib/mysql to /data/mysql...
...
[info] MySQL data is now on /data/mysql.
[info] removed /var/lib/mysql.pre-datadisk-20261030-134235
[info] task executed successfully.

disk data:

  1. Checks that /data is a separately mounted disk and has enough free space.
  2. Stops MySQL and the services that use it.
  3. Copies the database to /data/mysql and verifies the copy.
  4. Mounts /data/mysql in place of /var/lib/mysql and starts the services again.
  5. Checks that MySQL serves the same databases and tables as before, then deletes the old copy from the system disk.

If any check fails, the appliance is rolled back to the database on the system disk and the copy on /data is left for inspection.

Note

MySQL does not start while the data disk is missing. This is deliberate: it prevents MySQL from starting with an empty database on the system disk and collecting new data in the wrong place. Restore or reconnect the disk and MySQL starts normally again.


Verification

Items to Test Command Expected Outcome
Disk is mounted disk show MySQL data: /var/lib/mysql -> /data/mysql (data disk) and Status: mounted
Database is on the new disk disk show The filesystem line under the MySQL status shows /dev/sdb1 with the new disk's size
MySQL is running show mfusion mysql MySQL is active
Services are back show mfusion server / show security radius-server (as installed) Each service shows running
Survives a reboot reboot, then disk show Status: mounted, MySQL running

Example disk show ending after step 4:

MySQL data:   /var/lib/mysql -> /data/mysql (data disk)
Status:       mounted
my.cnf:       datadir=/var/lib/mysql
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb1       492G  2.8G  464G   1% /var/lib/mysql

Moving the Database Back

To move the database back to the system disk, for example before removing or replacing the data disk:

mfusion# no disk data
MySQL (and the services using it) will be stopped while 2765MB of data is copied back to /var/lib/mysql. continue? "y" or "n": y
...
[info] MySQL data is back on /var/lib/mysql.
[info] removed /data/mysql
[info] task executed successfully.

The system disk must have enough free space for the database. The disk itself stays mounted on /data.


HA Pairs

On an HA pair (mfusion sync), each appliance has its own disks, so run the steps on each appliance. The disk layouts do not need to match: HA sync copies the data through MySQL, not as files.

  1. Do the secondary first. Replication pauses while its MySQL is stopped and catches up when it starts again.
  2. Then do the primary in a maintenance window, or fail over first so the appliance you work on is the secondary.
  3. Check show mfusion sync on both appliances: replication running, no replication error, the secondary read-only.

An HA rejoin (mfusion sync rejoin) also works on an appliance with a data disk. It keeps its temporary copy of the old database on the data disk and removes it once the rejoin succeeds.


Upgrading from data-path

Older firmware moved the database with data-path under mfusion mysql-server:

mfusion mysql-server
 data-path /data
 start
!

When an appliance that used data-path is upgraded, the upgrade converts it to the disk data setup automatically. Nothing needs to be done:

  • The database stays where it is (/data/mysql). Nothing is copied.
  • The stale copy left on the system disk when data-path was first set is deleted.
  • The data-path line is removed from the startup configuration.

After the upgrade, data-path is no longer saved. A data-path line in an older configuration or backup is accepted and ignored, with a reminder to use disk data. Use disk show to check where the database is.


Troubleshooting

Symptom Likely Cause Solution
<folder> is not a mounted disk - use "disk mount" first. The folder is not a mount point Run step 2 and step 3 first
<folder> is on the system disk - choose a separately mounted disk. The folder is on the system disk, for example /var Mount the new disk on its own folder (step 3)
not enough space on <folder> The disk is smaller than the database plus headroom Use a larger disk, or reduce data retention first
<folder>/mysql already exists and is not empty Data from an earlier attempt or another appliance Move or delete that folder after checking its contents, then retry
Status: NOT mounted - data disk missing? and MySQL not running The data disk failed, was detached or was not attached to the virtual machine Reattach the disk and reboot, or run disk mount again; MySQL starts once the disk is back
<partition> is formatted as "<type>", not ext4. Refusing to mount. The partition has another file system Run disk create on the disk to reformat it (erases it)
data-path is no longer used warning An older configuration still contains data-path No action needed; use disk data for new setups

Best Practices

  • Size for growth: choose a disk several times larger than today's database. Monitoring history and syslog grow with every device added.
  • Use one data disk: keep the database, NetFlow files and backups on the same mounted data disk, and keep an eye on its usage with disk show.
  • Plan a maintenance window: the services that use MySQL stop while the database is copied.
  • Back up first: take a configuration and database backup (Admin → General → Backup & Restore) before moving the database.
  • Monitor the disk: a failing data disk stops MySQL. Check its usage and health regularly, and replace it before it fills up.
  • Protect the console: disk create erases disks. Limit CLI enable-mode access to administrators.