0

Is it possible to mount an already mounted LVM volume somewhere else ?

I have LXC using an LVM volume as storage, and I would mount the volume on the host for easier backup management.

When I try to mount the volume, here is what I got :

# mount /dev/lxc/bdd /mnt/bdd
mount: /mnt/bdd : /dev/mapper/lxc-bdd already mounted or mount point busy.

If it's not possible, how can I managed "persistent volume" with LXC using LVM backend storage ?

Shengis
  • 23
  • 1
  • 6

1 Answers1

3

One does not "mount" LVM logical volumes or any other block abstraction. Those are block devices, which can contain filesystems on them. These filesystems can be mounted to directory hierarchies.

However, if you wish to mount a filesystem on more than one machine, then that filesystem needs to be clustered or shared in some way.

NFS, CIFS, and GlusterFS are examples of filesystems that are shared. These filesystems can me mounted by any number of machines, and follow a client / server model. These shared filesystems are backed by more "traditional" filesystems on machines that are being used as fileservers.

Alternatively, there are clustered filesystems, such as OCFS2 or GPFS. These filesystems can be mounted to multiple machines at one time in a cluster, and internally handle the details of cross-node replication or distribution and resource locking.

If you try to mount a filesytsem that is not shared or clustered (such as traditional filesystems like EXT{3,4}, BTRFS, XFS) multiple times on one machine, it will fail with the error you see above. Most filesystems like this will also fail to mount on another separate machine while it's mounted elsewhere (in the case of shared block storage across mutiple nodes with a non-clustered filesystem on top). However, in a worst case scenario another machine won't be aware that a local filesystem has been mounted by another, and both will mutually destroy the dual-mounted filesystem.

The long and short of it is, all actions done to a filesystem must be accounted for. Actions that are not caught by an accountability mechanism are effectively corruptions. Accountability mechanisms on local-only filesystems are not designed to be clustered, and are restricted to a single kernel and a single mount point.

Spooler
  • 7,046
  • 18
  • 29
  • Thanks for your response ! I suspected it was something like that. I considered to use NFS, but I ended up on articles saying it's not working (https://www.reddit.com/r/Proxmox/comments/71yej6/mount_nfs_inside_lxc_noob_question/). – Shengis Oct 07 '17 at 09:34