An exclusive partition for Docker, Podman, DevContainers, KVM storage

Finally, after few weeks of learning a better way of doing Linux with Fedora Silverblue, I managed to get a very stable and production ready machine. In few words, how motivating is not developing anything on the core operating system but on containers or virtual machines! Once you get the OS tuned and working, atomic OS are unstoppable.

That productivity rush, though, starts showing it on how fast images start eating the disk. I work with machine learning models. I have five partitions for Silverblue 40: /efi, /boot/, root, /var, and /home. And that works well until it doesn’t. Container images really are not critical to backup because they are reproducible from code. KVMs, with some difficulty and effort, can be made reproducible too. Images and VMs should have its own storage volume, which shouldn’t be /root, nor /var, nor /home. A partitions you wouldn’t be sad to lose or not migrating during an atomic OS disaster.

This is complicated by the fact that every container or VM tool has its own favorite place for storage: by default QEMU/KVM/Virtual Manager stores in /var; Distrobox, Podman, DevContainers, and Docker store in /home

Has anyone in the Silverblue community have come with a way to migrate image/VM storage to a separate partition? How do you start?

Added devel, partitioning and removed engineering

You can symlink different locations to the same filesystem, or use Btrfs subvolumes, or try the X-mount.subdir option.

It should be relatively simple to implement:

  • create and format the partition,
  • stop the related services,
  • temporarily mount the filesystem,
  • move the data,
  • unmount the filesystem,
  • configure fstab,
  • prepare the mount point,
  • mount all fstab entries,
  • create symlinks as needed,
  • restart the stopped services.

Use a live session if you are not sure which services to stop/start.

I know and understand the underlying concepts.
That is different from practical implementation.
Have you done the migration with Docker, DevContainers, KVM?

I have tried and miserably failed.

I have experience migrating some services to dedicated LVs.
If there’s a problem, you should isolate and troubleshoot it, starting with specific error messages, using debugging options, and increasing log verbosity if necessary.
In particular, switching to permissive SELinux mode helps rule out related issues.

I was able to migrate the storage and image folders for Docker, Podman, and QEMU/KVM libvirt.

I used part of the instructions here:

  1. For Docker: Relocating /var/lib/docker directory | Sisense. Method-2 will work in Silverblue.

  2. For Podman: Adventures with rootless Podman containers -

  3. For KVM/QEMU/libvirt: Similar to step 2 but on a different folder and modifying the storage location using virsh pool-edit default.

If there is interest, I could make time and publish the three procedures.

PS. My only regret is making the new partition ext4 instead of btrfs. You can tell by the extra 50% disk space taken in ext4.

1 Like