Server Management 2 min read Last updated: 2026-10-23

NVMe Storage Expansion, Disk Cleanup & TRIM Optimization

Resize partitions online with zero downtime after plan upgrades, analyze large directory usage with ncdu, prune system logs, and enable NVMe fstrim.

FlawlessNode instances are powered by enterprise PCIe 4.0 NVMe SSD arrays delivering hundreds of thousands of IOPS and sub-millisecond latency. When you upgrade your plan for additional storage or need to reclaim disk space during capacity alerts, follow this guide for online expansion and maintenance.

1. Online Partition Expansion After Plan Upgrades

After upgrading your server plan in the Client Portal, the underlying hypervisor expands the virtual block device immediately. To claim the newly allocated space inside your guest OS without downtime, extend the partition table and filesystem:

1.1 Inspect Current Block Devices & Mount Points

lsblk

Typical output after an upgrade from 30GB to 60GB:

NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
vda    252:0    0   60G  0 disk 
└─vda1 252:1    0   30G  0 part /

Notice that the parent virtual disk vda is now 60G, while the root partition vda1 still occupies 30G.

1.2 Install Cloud Partition Utilities

# Ubuntu / Debian
sudo apt update && sudo apt install -y cloud-guest-utils

# AlmaLinux / Rocky Linux 9 & 10
sudo dnf install -y cloud-utils-growpart

1.3 Expand the Partition Table (growpart)

Note the required space between the device path /dev/vda and the partition number 1:

# Expand partition 1 of /dev/vda to fill all available space
sudo growpart /dev/vda 1

1.4 Resize the Filesystem Online (Zero Downtime)

For ext4 Filesystems (Ubuntu / Debian Default):

sudo resize2fs /dev/vda1

For xfs Filesystems (AlmaLinux / Rocky Linux Default):

sudo xfs_growfs /

Run df -h to verify that / immediately reflects the full upgraded capacity without requiring a reboot.


2. Troubleshooting Disk Space Alerts & Cleanup

When disk usage exceeds 85%, follow these steps to pinpoint and remove unneeded files safely:

2.1 Locate the Largest Directories and Files

Install the interactive disk analyzer ncdu:

sudo apt install -y ncdu || sudo dnf install -y ncdu
sudo ncdu /

Alternatively, list the top 10 largest items on the root filesystem using native POSIX tools:

sudo du -ahx / | sort -rh | head -n 10

2.2 Prune Systemd Journal Archives

By default, systemd-journald retains extensive historical logs. Reclaim space immediately:

# Retain only the past 7 days of logs
sudo journalctl --vacuum-time=7d

# Or cap total journal storage at 200MB
sudo journalctl --vacuum-size=200M

2.3 Clean Package Manager Caches

# Ubuntu / Debian
sudo apt clean && sudo apt autoremove -y

# AlmaLinux / Rocky Linux
sudo dnf clean all

3. Enabling Periodic NVMe TRIM (fstrim.timer)

To maintain consistent 4K random write IOPS and allow the underlying NVMe storage controller to garbage-collect freed blocks efficiently, ensure the weekly fstrim.timer is enabled:

# Enable periodic weekly TRIM timer
sudo systemctl enable --now fstrim.timer

# Trigger an immediate online TRIM pass across all mounted filesystems
sudo fstrim -av
Was this page helpful?