[SOLVED] Mount a Ceph snapshot in a running LXC container

lucaferr

Renowned Member
Jun 21, 2011
71
9
73
Hi!
I have a big LXC container (2 TB) running on a Proxmox VE 5.4 with Ceph Luminous storage. The container is running mission critical services and cannot be stopped. Two days ago I took a snapshot from the Proxmox interface (you can see it named "pre_upgrade_tls" in the screenshot below).
Now, since by mistake I delete a folder, I would need to recover that folder from the snapshot...but I can't rollback the whole container: I just need that single folder.
Is it possible to mount the snapshot read-only somewhere, so I can rsync the folder I need to the running LXC container? Is this operation safe? (if it's not, I already have a plan B which is to uncompress the backups, but it's going to take several hours). As I mentioned, the container must continue to run and cannot be rebooted.
Thank you very much!
ceph snapshot lxc container.png
 
Is it possible to mount the snapshot read-only somewhere, so I can rsync the folder I need to the running LXC container?
You will need to map (read-only) the snapshot on the Proxmox VE node and then copy the folder into the container.

Is this operation safe? (if it's not, I already have a plan B which is to uncompress the backups, but it's going to take several hours).
Safe in what way?

And last but not least Proxmox VE 5.4 is long-time EoL.
 
You will need to map (read-only) the snapshot on the Proxmox VE node and then copy the folder into the container.
Thank you Alwin! Could you please tell me the steps to map in read-only on the Proxmox VE node?

Safe in what way?
I think you already answered "yes, this is safe". It was just a warning not to point me to an emergency hack if it involved any risk, since I have a plan B ;)

And last but not least Proxmox VE 5.4 is long-time EoL.
Yep, you're perfectly right, upgrade to 6.3 and latest Ceph is planned for 2021
 
Last edited:
Thank you Alwin! Could you please tell me the steps to map in read-only on the Proxmox VE node?
rbd map --read-only <pool>/<snapshot> and snapshots you get by rbd ls -l.
 
Many thanks, it worked! Here the steps that I followed, for anyone else interested:
  1. rbd ls -l <poolname> (to get the snapshot name)
  2. rbd showmapped (just to check that the snapshot is not already mapped)
  3. mkdir <mountpoint>
  4. rbd map --read-only <poolname>/<diskname>@snapname
  5. rbd showmapped (just to verify that the snapshot has been correctly mapped)
  6. mount -o noload /dev/rbd/<poolname>/<diskname>@snapname <mountpoint>
    (if it's a VM instead of a CT, you must also add partition ("-part1" after @snapname, if you want to mount the first partition)
  7. Mounted in read-only! Do what you need to do...
  8. umount <mountpoint>
  9. rbd unmap <poolname>/<diskname>@snapname
  10. rbd showmapped (just to verify that the snapshot is not mapped anymore)
Cheers!
 
  • Like
Reactions: bobmc and Alwin

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!