This script is designed to backup an LXC container from your Proxmox installation to a USB drive. It provides options for configuring the USB device, LXC container ID, and storage ID for the backup. Additionally, the script supports a dry mode, allowing you to preview the commands without executing them.
This script is generated by AI and is intended for general use. However, it is your responsibility to review, test, and customize the script to suit your specific needs. The author and OpenAI, the creator of the AI model, disclaim all warranties and shall not be liable for any damages resulting from the use of this script.
- Proxmox installed and configured on the host system.
- A USB drive connected to the Proxmox host system.
./backup_script.sh --device <usb-device> [--id <container-id>] [--storage <storage-id>] [--drymode]
-
--device
: Specifies the USB device to which the LXC container backup will be written. This option is mandatory and requires the path to the USB device (e.g., /dev/sdb1). -
--id
: (Optional) Specifies the ID of the LXC container to be backed up. If not provided, the default container ID is used (container ID 100). -
--storage
: (Optional) Specifies the storage ID where the backup will be stored in Proxmox. If not provided, the default storage ID is used (usb-drive). -
--drymode
: (Optional) When enabled, the script will run in dry mode, showing the commands that would be executed without actually performing the backup operations.
- Run the backup for LXC container 101 to the USB drive /dev/sdb1 with storage ID "my-usb-storage":
./backup_script.sh --device /dev/sdb1 --id 101 --storage my-usb-storage
- Preview the commands that would be executed without actually performing the backup:
./backup_script.sh --device /dev/sdb1 --id 101 --storage my-usb-storage --drymode
-
Make sure to provide the correct USB device path with the
--device
option. The script will attempt to mount and unmount the specified device. -
Ensure that the provided LXC container ID (
--id
) and storage ID (--storage
) are valid and match your Proxmox configuration. -
The script will automatically create a mount point at
/mnt/<storage-id>
based on the storage ID provided. Ensure that this directory is available and not in use before running the script. -
It is recommended to test the script in dry mode (
--drymode
) first to verify the commands and avoid any unintended consequences.
This script is distributed under the MIT License. See LICENSE for more information.
For any questions, issues, or suggestions related to this script, feel free to contact me at your-email@example.com.