"use client" import React, { useState } from "react" import Link from "next/link" import { Archive, ArrowLeft, Copy, Check, Terminal } from "lucide-react" import { Button } from "@/components/ui/button" import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table" import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion" export default function BackupRestorePage() { const [viewMode, setViewMode] = useState<"table" | "accordion">("table") // Group commands by category for better organization const commandGroups = [ { title: "VM Backup", commands: [ { command: "vzdump ", description: "Create a backup of a specific VM/CT" }, { command: "vzdump --storage ", description: "Backup VM to specific storage" }, { command: "vzdump --mode snapshot", description: "Create snapshot backup (for VMs)" }, { command: "vzdump --mode suspend", description: "Suspend VM during backup" }, { command: "vzdump --mode stop", description: "Stop VM during backup" }, { command: "vzdump --all", description: "Backup all VMs and containers" }, { command: "vzdump --exclude ,", description: "Backup all except specified VMs" }, ], }, { title: "Backup Options", commands: [ { command: "vzdump --compress zstd", description: "Use zstd compression for backup" }, { command: "vzdump --pigz ", description: "Use pigz with multiple threads" }, { command: "vzdump --notes ", description: "Add notes to backup" }, { command: "vzdump --mailto ", description: "Send notification email" }, { command: "vzdump --maxfiles ", description: "Keep only n backups per VM" }, { command: "vzdump --stdexcludes 0", description: "Don't exclude temporary files" }, { command: "vzdump --quiet 1", description: "Suppress output messages" }, ], }, { title: "Restore Backups", commands: [ { command: "qmrestore ", description: "Restore VM from backup" }, { command: "qmrestore --storage ", description: "Restore to specific storage" }, { command: "qmrestore --unique", description: "Create a VM with unique ID" }, { command: "pct restore ", description: "Restore container from backup" }, { command: "pct restore --storage ", description: "Restore container to specific storage", }, { command: "pct restore --rootfs ", description: "Restore to specific rootfs" }, { command: "pct restore --unprivileged 1", description: "Restore as unprivileged CT" }, ], }, { title: "Backup Management", commands: [ { command: "ls -la /var/lib/vz/dump/", description: "List backups in default location" }, { command: 'find /var/lib/vz/dump/ -name "*.vma*"', description: "Find VM backups" }, { command: 'find /var/lib/vz/dump/ -name "*.tar*"', description: "Find container backups" }, { command: "pvesm list ", description: "List backups in specific storage" }, { command: "rm /var/lib/vz/dump/", description: "Delete a backup file" }, { command: "cat /etc/vzdump.conf", description: "Show backup configuration" }, ], }, { title: "Scheduled Backups", commands: [ { command: "cat /etc/cron.d/vzdump", description: "Show backup schedule" }, { command: "nano /etc/vzdump.conf", description: "Edit backup configuration" }, { command: "systemctl list-timers", description: "List all scheduled tasks" }, { command: "systemctl status cron", description: "Check cron service status" }, { command: "grep vzdump /var/log/syslog", description: "Check backup logs in syslog" }, { command: "tail -f /var/log/vzdump.log", description: "Monitor backup log in real-time" }, ], }, { title: "Advanced Operations", commands: [ { command: "qmrestore --force", description: "Force restore, overwriting existing VM" }, { command: "vzdump --dumpdir ", description: "Specify custom backup directory" }, { command: "vzdump --script