I have encountered a sudden problem when moving containers to a new storage pool on a different drive - all actions related to moving containers or exporting and importing containers started producing MANY error messages such as “… failed: No space left on device (28)” and “… Cannot open: No space left on device”
I’m trying to import by backed-up or exported on another machine containers to /mnt/dev/lxd storate pool and there is plenty of space on that mounted device:
(base) leonid@xlr2:~$ lxc storage list
+---------+--------+--------------+-------------+---------+---------+
| NAME | DRIVER | SOURCE | DESCRIPTION | USED BY | STATE |
+---------+--------+--------------+-------------+---------+---------+
| default | dir | /mnt/dev/lxd | | 7 | CREATED |
+---------+--------+--------------+-------------+---------+---------+
(base) leonid@xlr2:~$
(base) leonid@xlr2:~$ df -Th /mnt/dev
Filesystem Type Size Used Avail Use% Mounted on
/dev/sdm ext4 931G 94G 837G 11% /mnt/dev
(base) leonid@xlr2:~$
(base) leonid@xlr2:/mnt/dev$ df -Th /var/snap/lxd/common/lxd/disks
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/ubuntu--vg-ubuntu--lv ext4 226G 91G 125G 43% /
(base) leonid@xlr2:/mnt/dev$
Here are the troubleshooting actions that I already attempted unsuccessfully:
rebooted machine
completely removed and re-installed LXD using snap
checked that there are no “deleted” files that are still being used (sudo lsof | grep deleted)
tried importing containers originally exported on this machine and also one exported on another machine and copied here
ran fsck on the device - all good
ran SMART checks on the SDD drive - no errors, all good
I appreciate your response and the information provided.
I decided to try migrating my setup to incus because I do not see LXD related support at the CanonicalUbuntu forums at present time.
Unfortunately, I get the same result/errors as shown below:
(base) leonid@xlr2:~$ incus --version
0.4
(base) leonid@xlr2:~$ sudo adduser leonid incus-admin
Adding user `leonid' to group `incus-admin' ...
Adding user leonid to group incus-admin
Done.
(base) leonid@xlr2:~$ newgrp incus-admin
(base) leonid@xlr2:~$
(base) leonid@xlr2:~$ incus info | grep version
api_version: "1.0"
driver_version: 5.0.3 | 8.1.3
kernel_version: 5.15.0-91-generic
os_version: "22.04"
server_version: "0.4"
storage_version: "1"
version: "1"
version: 2.03.11(2) (2021-01-08) / 1.02.175 (2021-01-08) / 4.45.0
version: 5.16.2
(base) leonid@xlr2:~$
(base) leonid@xlr2:~$ lxd-to-incus
Error: This tool must be run as root
(base) leonid@xlr2:~$
(base) leonid@xlr2:~$ sudo su -
root@xlr2:~#
root@xlr2:~# lxd-to-incus
=> Looking for source server
==> Detected: snap package
=> Looking for target server
==> Detected: systemd
=> Connecting to source server
=> Connecting to the target server
=> Checking server versions
==> Source version: 5.19
==> Target version: 0.4
=> Validating version compatibility
=> Checking that the source server isn't empty
=> Checking that the target server is empty
=> Validating source server configuration
The migration is now ready to proceed.
At this point, the source server and all its instances will be stopped.
Instances will come back online once the migration is complete.
Proceed with the migration? [default=no]: yes
=> Stopping the source server
=> Stopping the target server
=> Wiping the target server
=> Migrating the data
=> Migrating database
=> Writing database patch
=> Cleaning up target paths
=> Starting the target server
=> Checking the target server
Uninstall the LXD package? [default=no]: yes
=> Uninstalling the source server
root@xlr2:~# exit
logout
(base) leonid@xlr2:~$
(base) leonid@xlr2:~$ incus list
+------+-------+------+------+------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+------+-------+------+------+------+-----------+
(base) leonid@xlr2:~$
(base) leonid@xlr2:~$ incus storage list
+---------+--------+--------------+-------------+---------+---------+
| NAME | DRIVER | SOURCE | DESCRIPTION | USED BY | STATE |
+---------+--------+--------------+-------------+---------+---------+
| default | dir | /mnt/dev/lxd | | 7 | CREATED |
+---------+--------+--------------+-------------+---------+---------+
(base) leonid@xlr2:~$ incus storage info default
info:
description: ""
driver: dir
name: default
space used: 93.65GiB
total space: 930.32GiB
used by:
profiles:
- default
- largemacvlan
- macvlan
- mediummacvlan
- micromacvlan
- nanomacvlan
- smallmacvlan
(base) leonid@xlr2:~$
(base) leonid@xlr2:~$ df -Th /mnt/dev/lxd
Filesystem Type Size Used Avail Use% Mounted on
/dev/sdm ext4 931G 94G 837G 11% /mnt/dev
(base) leonid@xlr2:~$ cd /mnt/dev
(base) leonid@xlr2:/mnt/dev$ ls -lh lxd-tor-01-07-2024.tar.gz
-rw-rw-r-- 1 leonid leonid 2.2G Jan 7 11:41 lxd-tor-01-07-2024.tar.gz
(base) leonid@xlr2:/mnt/dev$ incus import ./lxd-tor-01-07-2024.tar.gz -s default
Error: Create instance from backup: Error starting unpack: Failed to run: tar -zxf - --xattrs-include=* --restrict --force-local --numeric-owner -C /var/lib/incus/storage-pools/default/containers/tor --strip-components=2 backup/container: exit status 2 (tar: rootfs/usr/lib/python3/dist-packages/launchpadlib/tests/test_credential_store.py: Cannot open: No space left on device
tar: rootfs/usr/lib/python3/dist-packages/launchpadlib/tests/test_http.py: Cannot open: No space left on device
tar: rootfs/usr/lib/python3/dist-packages/launchpadlib/tests/test_launchpad.py: Cannot open: No space left on device
tar: rootfs/usr/lib/python3/dist-packages/launchpadlib/uris.py: Cannot open: No space left on device
tar: rootfs/usr/lib/python3/dist-packages/launchpadlib-1.10.16.egg-info: Cannot mkdir: No space left on device
tar: rootfs/usr/lib/python3/dist-packages/launchpadlib-1.10.16.egg-info: Cannot mkdir: No space left on device
tar: rootfs/usr/lib/python3/dist-packages/launchpadlib-1.10.16.egg-info/PKG-INFO: Cannot open: No such file or directory
tar: rootfs/usr/lib/python3/dist-packages/launchpadlib-1.10.16.egg-info: Cannot mkdir: No space left on device
tar: rootfs/usr/lib/python3/dist-packages/launchpadlib-1.10.16.egg-info/dependency_links.txt: Cannot open: No such file or directory
tar: rootfs/usr/lib/python3/dist-packages/launchpadlib-1.10.16.egg-info: Cannot mkdir: No space left on device
tar: rootfs/usr/lib/python3/dist-packages/launchpadlib-1.10.16.egg-info/not-zip-safe: Cannot open: No such file or directory
tar: rootfs/usr/lib/python3/dist-packages/launchpadlib-1.10.16.egg-info: Cannot mkdir: No space left on device
tar: rootfs/usr/lib/python3/dist-packages/launchpadlib-1.10.16.egg-info/requires.txt: Cannot open: No such file or directory
tar: rootfs/usr/lib/python3/dist-packages/launchpadlib-1.10.16.egg-info: Cannot mkdir: No space left on device
tar: rootfs/usr/lib/python3/dist-packages/launchpadlib-1.10.16.egg-info/top_level.txt: Cannot open: No such file or directory
tar: rootfs/usr/lib/python3/dist-packages/lazr: Cannot mkdir: No space left on device
tar: rootfs/usr/lib/python3/dist-packages/lazr: Cannot mkdir: No space left on device
tar: rootfs/usr/lib/python3/dist-packages/lazr/restfulclient: Cannot mkdir: No such file or directory
tar: rootfs/usr/lib/python3/dist-packages/lazr: Cannot mkdir: No space left on device
tar: rootfs/usr/lib/python3/dist-packages/lazr/restfulclient/__init__.py: Cannot open: No such file or directory
tar: rootfs/usr/lib/python3/dist-packages/lazr: Cannot mkdir: No space left on device
The fact that the unpack is failing on things as small as directory entries makes it quite plausible that you’re running out of inodes rather than bytes.
It’s definitely a bit light on inodes, though should only start failing when unpacking another 60k files. I guess a container with a bunch of files could reach that.
It’s been a long time since I last ran into that with ext4 but at least back then, there was no way to increase the inode count after initial mkfs.ext4. The -i flag can be used during mkfs to get more inodes out of the filesystem.
AFAIK XFS has the advantage of not having a set inode count, so it avoids that particular problem, though I’ve got very little experience with XFS in general.
Thank you very much for pointing me into the right direction!
The root cause of all my issues was the fact that I originally formatted the SSD using command that I used for another use-case where I only needed to store a small number fo very large (~100GB) files - I used “-T largefile4”.
The “largefile4” type has very high inode_ratio compared to the default - 4M+ vs 16K+ - which results in less inodes available:
I have successfully reformatted the drive and tested importing the LXD containers created on this and another machine into 2 storage pools - everything is working as expected:
leonid@xlr2:~$ incus storage list
+---------+--------+-----------------+-------------+---------+---------+
| NAME | DRIVER | SOURCE | DESCRIPTION | USED BY | STATE |
+---------+--------+-----------------+-------------+---------+---------+
| default | dir | /mnt/dev/incus/ | | 8 | CREATED |
+---------+--------+-----------------+-------------+---------+---------+
| ssd | dir | /mnt/ssd/incus/ | | 1 | CREATED |
+---------+--------+-----------------+-------------+---------+---------+
leonid@xlr2:~$ df -Th /mnt/ssd /mnt/dev
Filesystem Type Size Used Avail Use% Mounted on
/dev/md0 xfs 3.7T 1.1T 2.6T 31% /mnt/ssd
/dev/sdm ext4 916G 5.6G 911G 1% /mnt/dev
leonid@xlr2:~$ df -ih /mnt/ssd /mnt/dev
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/md0 373M 270K 373M 1% /mnt/ssd
/dev/sdm 59M 117K 59M 1% /mnt/dev
leonid@xlr2:~$
I will be using Incus for my Linux Container now !!!