By default, no CPU or memory limits are applied so that part is covered.
For storage, it depends on the storage driver, but generally we similarly don’t apply space limits unless configured to do so.
Where are the lxc container such as my-ubuntu all data stored?
In my physical machine, the “/” directory only has 37GB usable, and an additional hard drive has 1.1TB usable. I worry about that if lxc container data are stored below the “/” directory instead of the hard drive, so the space is not enough to use soon.
Here is command df -h result in my physical machine:
I have other files in /dev/sda . So the commands you recommend will not delete or destroy my files in /dev/sda, right?
And when I finish typing those commands, I can just type lxc launch local:ubuntu18-tang ubt-1, without other parameters, right?
It would have been best to partition that drive, splitting it between host storage and LXD but that’s probably a bit late for that…
So one option would be to use the dir storage backend, that will let you use your current drive as it is, but container creation will be slow, snapshots will be extremely slow and wasteful and you won’t be able to set quotas. If none of those matter to you, then you can do:
lxc storage create default dir source=/media/admin1/bf1debbd-17d1-4f71-a00a-37f049fb597e/lxd to have LXD use a directory on it for container storage.
So you mean that every time I am going to do lxd init on a machine, I should prepare a clean hard drive partition first? For my situation now,I only have 1 hard drive connecting to my machine, and there has been already 70% used. So I need to copy all those files to another mobile hard drive temporarily, and then I make the original hard drive into 2 partitions. One partition is going to store my old files back,and the other partition is for lxd pool. Is this procedure correct? And another question,is it enough to be only one partition for lxd pool in my machine? I mean maybe I will have several images and many containers in my one machine. So all those containers use 1 partition,is there any problem?
And I think maybe it’s risky for me to do partition with my only one hard drive. I am afraid of that there will be problem after the data migration. So I wonder is there technique in lxd/lxc just like data volume in docker tech? At present, my purpose of using lxc container is to do data analyzing. Thus in the container I will deploy many environments and software and personal codes. I think these things could be not greater than 30GB. But the input files and intermediate files,I guess they will occupy at least 100GB,and even 200GB maybe. So can I set up a sharing directory outside the container,just for storing those big data. If you know docker data volume tech, maybe you can understand my idea.
If you use other storage backends (like zfs and btrfs) in my understanding you can limit how big the storage size will be.
Update: Don’t try the below (striked out) method right now, it caused the author of this issue problems. I solved the problem of to less space on host root, by adding a link.
So I simply linked the lxd-folder in /var to a folder on my second drive.
So “/var/snap/lxd/” is pointing to “/media/seconddrive/lxd_data2/lxd” for example.
As far as I remember I just copied all content to the new folder.
So you do the following: 1. Stop LXD.
2. copy the whole LXD-folder into the new location (see also Docs: Backup)
3. Then delete the old LXD-folder (should be empty now anyway).
4. Then apply the link.
5. Start LXD again.
Maybe @stgraber could say whether this method is ok .
Maybe you could consider adding an option to set the folderpath of LXD in lxd-init?
Because some distros suggest to partition the harddrive during installation, and the resulting root-partition (or even a seperate var-partititon) is often too small.
Also a method to split the lxd folder would be convenient, so that:
Some storage pools could be on one harddrive and other storage pools could be on a different harddrive.
Update2: Now I am confused.
Lets put it into a question:
So it is not possible to create a storage pool (with something different than “dir”-backend) on a second harddrive?
Without creating a new partition on it?
Is this the right variable for setting the lxd folder: "LXD_DIR" - The LXD data directory
And how do I set it?
I guess via snap: sudo snap set lxd LXD_DIR=/media/example/lxd ?