[SOLVED] LXC Backup from my TrueNas

Nass

Member
Oct 25, 2022
40
1
13
I want to perform a backup to my lxc container from my TrueNAS manually.
What are the files that sould i back them?
is the disk file (.raw) sufficient or there are other file ?
Thank you
 
Hi,

is there any specific reason why you don't want to use the built-in backup feature?

Anyway, make sure that you also backup the container's configuration file, stored in /etc/pve/lxc/<id>.conf.
 
Hi,

is there any specific reason why you don't want to use the built-in backup feature?

Anyway, make sure that you also backup the container's configuration file, stored in /etc/pve/lxc/<id>.conf.
Thank you for your reply, i don't want to use the built-in backup feature because i want store my backup on AWS S3 not on local disk.

what about do a backup for the (.vma.zst ) instead of backing the disk file (.raw) ? is it sufficient or there are other file ?
 
what about do a backup for the (.vma.zst ) instead of backing the disk file (.raw) ? is it sufficient or there are other file ?
This is what I would do. I'd use the built-in backup mechanism to backup to a local disk, and then I'd sync the local contents to S3. You could perform the last step with the aid of a backup hook script [1,2]. The .vma.* files contain everything needed to restore a VM/container - images for all disks, as well as the configuration.

You could also look into using rclone as a backing directory storage for your backups [3]

[1] https://forum.proxmox.com/threads/triggering-some-script-at-the-end-of-the-backups.59905/
[2] https://pve.proxmox.com/pve-docs/pve-admin-guide.html#_hook_scripts
[3] https://rclone.org/
 
This is what I would do. I'd use the built-in backup mechanism to backup to a local disk, and then I'd sync the local contents to S3. You could perform the last step with the aid of a backup hook script [1,2]. The .vma.* files contain everything needed to restore a VM/container - images for all disks, as well as the configuration.

You could also look into using rclone as a backing directory storage for your backups [3]

[1] https://forum.proxmox.com/threads/triggering-some-script-at-the-end-of-the-backups.59905/
[2] https://pve.proxmox.com/pve-docs/pve-admin-guide.html#_hook_scripts
[3] https://rclone.org/
Thank you
 
I used this and it works.

For anyone stumbling in this topic, as of 2022 seems the s3fs-mounted folder is working smoothly, I can backup all my VMs without issues.

A quick recap:

  1. Log into AWS Console
  2. Create a non-admin user
  3. Go to security Credentials and create a new Access Key, take note of the ID and password
  4. Go to the S3 service and create a new bucket, let's call it proxmoxstorage
  5. The in the bucket's Management tab create a new Lifecycle rule, I move files to the Glacier with Instant Retrieval after 7 days to greatly reduce the costs but still fast retrieval when needed. It's your choice.
  6. Go to your Proxmox PVE server and open the Shell console
  7. Create a variable with the Access Ke you've just noted down:
echo AKIAWGD5EOSK NSHMW:KL9Y7yur39jsDHalsk laAJLrHTwi9crV > /etc/passwd-s3fs
9. Change permissions:

chmod 640 /etc/passwd-s3fs
9. update your apt

apt update
10. Install s3fs

apt install -y s3fs
11. create the folder where you want to mount the s3 bucket, I call it s3-bucket

mkdir /mnt/s3-bucket
12. Enable user_allow_other option by removing the trailing # in the Fuse config file (CTRL+X to exit and Y to save)

nano /etc/fuse.conf
13. Put an entry into fstab to mount the folder at startup:

nano /etc/fstab
add this line (insert your bucket name and mount folder name):

s3fs#proxmoxstorage /mnt/s3-bucket/ fuse _netdev,allow_other,url=https://s3.amazonaws.com 0 0
14. Reboot your server (!)

15. In the Datacenter Storage section add a new storage of type Directory and insert your mounted dir (/mnt/s3-bucket), choose a meaningful ID like AWS-s3, and select all the content types
 
  • Like
Reactions: Lukas Wagner