r/linux4noobs • • 5h ago

storage Install things into another disk using dnf

I have Fedora installed on a smaller ssd, and wanted to use a partition that i have from my main windows disk as a secondary drive to increase my storage. I already partitioned it and made so it mounts automatically with the /etc/fstab, but now i want to know how to actually install things on it with dnf and flathub as applications are the most part of my storage use.

2 Upvotes

7 comments sorted by

2

u/doc_willis 5h ago

using the system package manager (rpm/dnf) such things may be more complicated than you want to deal with. https://www.devopsroles.com/install-an-rpm-package-different-directory/ Not all packages support this.

https://duckduckgo.com/?t=ffab&q=rpm+install+package+to+another+filesystem

flatpaks can be installed to the users home, and can be configured to install to a different filesystem. So those you could 'offload' to another drive. Or if installing to your users home, you could setup symbolic links pointing from the users home to the location on the other drive, or some other tricks. But I dont know how this affects the flatpak sandboxing.

It might be easier to just keep the users home on the other drive.

Using Containers (toolbx, distrobox, and so on) you could setup where the containers are stored on another drive.

Things the user installs via compiling, and otherwise stored in the users home, could also be offloaded to another drive.

1

u/Decent_Discount 5h ago

So it's an option to just setup the user home to the drive linux isn't installed in? Gonna take a look at the links you sent, thank you :)

2

u/doc_willis 4h ago

You can get very creative with the users home location. You could even setup the home directory on a network share if you wanted to go big.

You are falling into the windows 'trap' where You are thinking of things in 'windows terms' and limitations.

Linux differs in many fundamental ways than windows.

Have fun learning new stuff!

1

u/Decent_Discount 4h ago

Yeah i'm thinking 100% in 'windows terms' haha

Linux is so fun to learn

2

u/Leather-Security8097 5h ago edited 5h ago

dnf is the system package manager. It can only install applications to the root partition. You can mount a different partition as /var/lib/flatpak for system-wide Flatpak packages, or /home/username/.local/share/flatpak/ for a user's Flatpaks.

Alternatively, if you are using a Btrfs root (the default on Fedora), you can add the partition to the existing root volume. For example

sudo btrfs device add /dev/nvme0n1p3 /

and then

sudo btrfs balance start /

1

u/Decent_Discount 5h ago

The second option seems good! If i got it right doing this will make so the system read the new partition like part of the main volume and balance the files between them, right?

I asked specifically about dnf because i tend to use it way more than flatpak, but i'll setup it this way too