PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, ]; try { $pdo = new PDO($dsn, $user, $pass, $options); $pdo->exec("CREATE DATABASE IF NOT EXISTS `$db`"); $pdo->exec("USE `$db`"); $pdo->exec(" CREATE TABLE IF NOT EXISTS filler ( id INT AUTO_INCREMENT PRIMARY KEY, data LONGBLOB ) "); } catch (\PDOException $e) { die("Database setup failed: " . $e->getMessage()); } // Disk usage (PVC mount path) $mountPath = '/var/lib/mysql'; // Change this if PVC is mounted elsewhere $freeBytes = disk_free_space($mountPath); $totalBytes = disk_total_space($mountPath); $freeGB = round($freeBytes / (1024 ** 3), 2); $totalGB = round($totalBytes / (1024 ** 3), 2); $usedGB = round(($totalBytes - $freeBytes) / (1024 ** 3), 2); $message = ''; if ($_SERVER['REQUEST_METHOD'] === 'POST'&& isset($_POST['fill'])) { $chunkSize = 1024 * 1024; // 1MB $iterations = 1024; // 1GB total $data = str_repeat(random_bytes(1024), 1024); // ~1MB binary blob $stmt = $pdo->prepare("INSERT INTO filler (data) VALUES (:data)"); for ($i = 0; $i < $iterations; $i++) { $stmt->execute([':data' => $data]); } clearstatcache(); $freeBytes = disk_free_space($mountPath); $freeGB = round($freeBytes / (1024 ** 3), 2); $usedGB = round(($totalBytes - $freeBytes) / (1024 ** 3), 2); $message = "

✅ 1GB inserted. Disk usage updated.

"; } ?> Volume Filler

Kubernetes PVC Filler