Recently i have found out that ‘lxc storage create’ has a key ‘source’ to create new storage pool based on source (as i understand just by binding to that?). So i have created a test case to check how it works and will it work.
First i have
- created a dir storage ‘lxc storage create messangers_dirpool14G dir’,
- launched there a container ‘lxc launch messangers-latest messangers --storage=messangers_dirpool14G’,
- checked it and stopped everything including snap lxd.
- moved /var/snap/lxd/common/lxd/storage-pools/messangers_dirpool14G to a backup location and created at its place empty folder to be able to remove storage and container by lxc … delete
Finally, i have tried to create new storage pool by issuing
$ lxc storage create testdir dir source=/media/backup/images/var/snap/lxd/common/lxd/storage-pools/messangers_dirpool14G
and have received an aforementioned
Error: Source path '/var/lib/snapd/hostfs/media/local_disk_data/images/var/snap/lxd/common/lxd/storage-pools/messangers_dirpool14G' isn't empty
$ sudo ls -la /var/snap/lxd/common/lxd/storage-pools/messangers_dirpool14G
ls: cannot access ‘/var/snap/lxd/common/lxd/storage-pools/messangers_dirpool14G’: No such file or directory
$ sudo ls -la /var/lib/snapd/hostfs/media/local_disk_data/images/var/snap/lxd/common/lxd/storage-pools/messangers_dirpool14G
ls: cannot access ‘/var/lib/snapd/hostfs/media/local_disk_data/images/var/snap/lxd/common/lxd/storage-pools/messangers_dirpool14G’: No such file or directory
Please, help me to do it right with dir storage type.
Mainly i choose dir for this task, because i can put it to cloud disk to sync seamlessly on the other end - only changed files will update, not the whole image (if i’ll use btrfs or other types). I want it to happen automatically. Maybe you can advice another option for this task.
os_name: Arch Linux