Is there way to install an app in a specific folder in a specific hard disk from pacman?


I would like to install an app from pacman into a specific in the HDD (/data/Gustavo/opt/) instead of the SSD. I do not want to install anything on my SSD.

Only yay can hold the installation of app in the specific folder in the HDD, but the app I am searching for is outdated in AUR.

I want TeXStudio.


-r, --root

I haven't tried this myself, report if it works in this case.

Unfortunately, here is the error:

sudo pacman --root texstudio /data/Gustavo/opt/
error: failed to initialise alpm library
(could not find or read directory: /var/lib/pacman/)

You could mount an empty partition on another drive in the empty opt folder

I did not understand...

You meant:

  1. create a new folder called app inside the folder /mnt in the SSD
  2. create a new folder app inside /data/Gustavo/opt in the HDD
  3. sudo mount /mnt/app /data/Gustavo/opt/app

Is it right?

I meant mounting the entire opt folder to another partition.

System does not care everything is a file.


When Linux was young disks was not as big as they are know.

To minimize the load and wear on server disks it was common to place various system folders on separate disks.

Create a partition on your HDD - give it an adequate amount of space.

Ensure that the system folder /opt is empty.

Get the UUID of the partition you created using the command

lsblk -o UUID /dev/sdXy

Add an entry in /etc/fstab

# /dev/sdxY            mountpoint filesystem options pass
UUID=your-disk-uuid    /opt       ext4       rw      0 0

Mount it

sudo mount -a

You can know install any application to /opt and rely on it residing on your harddrive and not your ssd.

You can do the editing of your fstab using these three commands in your terminal - remember to replace /dev/sdXy with your actual drive and partition

$ su - 
# echo "UUID=$(lsblk -no UUID /dev/sdXy) /opt $(lsblk -no FSTYPE /dev/sdXy) defaults,noatime 0 0" >> /etc/fstab
# mount -a

The information in these howto's might be of inspiration :slight_smile:

Ah, HDD's /data/Gustavo has already been mounted as /dev/sdb which is HDD and it is already in /etc/fstab one month ago when I followed your tutorial of permanent mount of an HDD, but I do not know why there is something wrong with that command if it is already mounted.

Using GPT you can create up to 128 partitions on a disk.

I will recommend shrinking the partition on your harddrive and create an extra partition for opt.

Do I need to backup something from my HDD before partitioning the HDD? In my HDD, I have folder opt and other folders which are syminked to the home folders in the SSD.

Backup is always great.

But if your harddrive has a lot of empty space then resizing the partition using gparted should not pose any danger to your data.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by