Mount a folder of your second drive where your package is located and copy the package beeforehand onto this folder. You will need a mount for every package.
This is not a really common scenario and for a reason.
Like others said, move different stuff to your second drive for ease of mind.
This isn’t a normal setup, and while it’s not impossible it’s not easy or simple. System Packages aren’t self contained, they throw files all around the filesystem so you can’t just move a single folder and be done, you need to basically have mirror copies of multiple folders and then modify the way pacman installs things if you really want to.
There is not a simple way to "move" where packages are installed. Since they will have files in multiple different paths. But usually packages aren't specifically huge so if you're space constrained maybe you can move something else to the second drive. A classic example is having the /home directory on a separate drive since this is were most of you personal data (documents, pictures, videos) are likely stored and also where programs generally store their data.
If you want to use pacman to install packages to a different location, read the following man page. Note: -b, -r, --cachedir, --config, --gpgdir, --hookdir, --logfile, and --sysroot.
$ pacman -Sh
usage: pacman {-S --sync} [options] [package(s)]
options:
-b, --dbpath <path> set an alternate database location
-c, --clean remove old packages from cache directory (-cc for all)
-d, --nodeps skip dependency version checks (-dd to skip all checks)
-g, --groups view all members of a package group
(-gg to view all groups and members)
-i, --info view package information (-ii for extended information)
-l, --list <repo> view a list of packages in a repo
-p, --print print the targets instead of performing the operation
-q, --quiet show less information for query and search
-r, --root <path> set an alternate installation root
-s, --search <regex> search remote repositories for matching strings
-u, --sysupgrade upgrade installed packages (-uu enables downgrades)
-v, --verbose be verbose
-w, --downloadonly download packages but do not install/upgrade anything
-y, --refresh download fresh package databases from the server
(-yy to force a refresh even if up to date)
--arch <arch> set an alternate architecture
--asdeps install packages as non-explicitly installed
--asexplicit install packages as explicitly installed
--assume-installed <package=version>
add a virtual package to satisfy dependencies
--cachedir <dir> set an alternate package cache location
--color <when> colorize the output
--config <path> set an alternate configuration file
--confirm always ask for confirmation
--dbonly only modify database entries, not package files
--debug display debug messages
--disable-download-timeout
use relaxed timeouts for download
--gpgdir <path> set an alternate home directory for GnuPG
--hookdir <dir> set an alternate hook location
--ignore <pkg> ignore a package upgrade (can be used more than once)
--ignoregroup <grp>
ignore a group upgrade (can be used more than once)
--logfile <path> set an alternate log file
--needed do not reinstall up to date packages
--noconfirm do not ask for any confirmation
--noprogressbar do not show a progress bar when downloading files
--noscriptlet do not execute the install scriptlet if one exists
--overwrite <glob>
overwrite conflicting files (can be used more than once)
--print-format <string>
specify how the targets should be printed
--sysroot operate on a mounted guest system (root-only)
Is it dual booted arch installs? If so you can use pacstrap or chroot to do it.
If it's just another drive, it's a whole lot more difficult. You need to configure the drive to be one or more of your root folders, or more often your home dir can be on another drive
8 comments
You can set a custom directory on Flatpak, I don't think you can do that easily on Pacman though
Mount a folder of your second drive where your package is located and copy the package beeforehand onto this folder. You will need a mount for every package.
This is not a really common scenario and for a reason.
Like others said, move different stuff to your second drive for ease of mind.
Flatpaks or system packages?
Also why?
This isn’t a normal setup, and while it’s not impossible it’s not easy or simple. System Packages aren’t self contained, they throw files all around the filesystem so you can’t just move a single folder and be done, you need to basically have mirror copies of multiple folders and then modify the way pacman installs things if you really want to.
There is not a simple way to "move" where packages are installed. Since they will have files in multiple different paths. But usually packages aren't specifically huge so if you're space constrained maybe you can move something else to the second drive. A classic example is having the /home directory on a separate drive since this is were most of you personal data (documents, pictures, videos) are likely stored and also where programs generally store their data.
Depends on yout mounting of drives. Check fstab and make decisions how to split your root, home, and other folders to both drives...
If you want to use pacman to install packages to a different location, read the following man page. Note: -b, -r, --cachedir, --config, --gpgdir, --hookdir, --logfile, and --sysroot.
I use pacman to work with non default locations in my AUR helper. https://github.com/Cody-Learner/aurch
Is it dual booted arch installs? If so you can use pacstrap or chroot to do it.
If it's just another drive, it's a whole lot more difficult. You need to configure the drive to be one or more of your root folders, or more often your home dir can be on another drive
you can't. it's possible to keep /usr on separate partition (therefore drive) though.