Install software via dnf into a separate directory/partition?


I upgraded yesterday from Fedora 36 to 37.
I got an error about running out of space and installing needed 1.5GB
of more space on my root partition. I was finally able to delete apps
and files to reclaim enough space to proceed with the install.
But the process was inconsistent. I will come back to that later.

My question: Since my root partition is different from other
partitions like /home, is there anyway to force fedora (dnf) to NOT install third
party apps on the root partition and insted to install into a separate
directory on another partition, specified by some env var ?? like
THIRD_PARTY_APPS=/home/apps ??

I really would like to keep the root partition for fedora OS files and
settings only.

It might depend a bit on the kind of third-party apps you are wanting to relocate.

For containers, there is the graphroot setting in /etc/containers/storage.conf (overridden by $HOME/.config/containers/storage.conf for user containers).

Many third-party programs that you install from source install themselves under /usr/local. You might be able to move your /usr/local content via something like mount /dev/<your-new-partition> /mnt && cp -a /usr/local/* /mnt && umount /mnt && mv /usr/local /usr/local.bak && mkdir /usr/local && mount /dev/<your-new-partition> /usr/local. You would then add an entry to your /etc/fstab so that /usr/local would be mounted on system boot and rm -rf /usr/local.bak once you’ve confirmed that everything is working properly.


As for RPM packages, this is problematic and not really supported since the contents of each package are split across different directories according to the FHS.

But you can utilize free space with the following methods:

  • Expand your root partition and filesystem, possibly with non-contiguous space and additional block devices using Btrfs/LVM.
  • Split and mount/symlink some bulky directories, like /opt, /var, etc.

I’m not using containers. But I can think of a few apps/packages that really could be on a separate partition so that the OS partition doesnt get affected: emacs, eclips, vlc, etc…

Nicely put together series of commands. Could be scripted so its repeatable.


Dnf might be slipping a few flatpaks in on you without your knowing it. Just to be sure, you might run sudo du -chs /var/lib/containers/storage and du -chs ~/.local/share/containers.

Edit: Scratch that, flatpaks go under $HOME/.local/share/flatpak and /var/lib/flatpak. It’s podman containers that use those other directories.

The file system has pretty much been arbitrary from the start with some conventions being followed. According to the FHS link, /bin is where all essential binaries be placed and /usr/bin is where non essential binaries reside. But on my system, /bin is a link to /usr/bin.
I see what you are saying though. However, ive had some disasters when playing with resizing of partitions. So im going to have to be extra careful, but will try this.


Ok. Just checked. Those dirs dont exist. I’ll keep an eye out for these vagrant dirs from now on.

I just re-checked after you updated your suggestion. ~/.local/share/flatpak doesnt exit. BUT /var/lib/flatpak EXISTS! This is becoming unruly now. I have no idea what these sub dirs are. appstream, oci, repo.

Thanks for the heads up!

FWIW, there is some documentation about changing the default flatpak install directory here: Tips and Tricks — Flatpak documentation

You can use that same du (disk usage) command to check how much space is being used by your currently-installed flatpaks.

$ sudo du -chs /var/lib/flatpak
1.3G	/var/lib/flatpak
1.3G	total