Sample Header Ad - 728x90

Is it possible to use a file as Filesystem?

1 vote
1 answer
197 views
Here is the origin of my question: * I'm running Linux containers with LXD snap version at Ubuntu 22.04 on a VPS. The root file system of the VPS is Ext4 and there is not additional storage attached. So the default LXD storage pool is created by the *dir* option. * When I'm taking a snapshots of these LXCs, the whole data is duplicated - i.e. the if the container is 6G the snapshot become another 6G. * I think if it was LVM filesystem the snapshots will be created in a different way. So my question is: * It possible to do something like fallocate -l 16G /lvm.fs, then format it as LVM, mount it and use it as storage pool for LXD? And of course, how can I do that if it is possible? --- Some notes: The solution provided by @larsks works as it is expected! Later I found, when we are using lxc storage create pool-name lvm without additional options and parameters, it does almost the same. I didn't test it before I published the question because I was thinking the lvm driver mandatory will require be in use a separate partition. However in both cases this approach, in my opinion, has much more cons than pros, for example: * The write speed is decreased with about 10% in comparison of the cases when we are using the dir driver. * Hard to recover situations when no space left on the *disk*, even when the overload data is located in /tmp... in contrast, when the dir driver is used, LXD prevents the consumption of the entire host's file system space, so your system and containers are still operational. This is much conviniant in my VPS case.
Asked by pa4080 (121 rep)
May 6, 2022, 09:10 AM
Last activity: May 9, 2022, 06:19 AM