Jump to content

How do I change the location where Ubuntu installs programs.

I have 2 drives, 1 for the OS and the other one  for data/programs. I would like to store programs on the other drive but I don't know how.

Thanks in advance.

Link to comment
Share on other sites

Link to post
Share on other sites

You'd want to link the folder to the location on the other drive using ln

 

https://shapeshed.com/unix-ln/

PLEASE QUOTE ME IF YOU ARE REPLYING TO ME

Desktop Build: Ryzen 7 2700X @ 4.0GHz, AsRock Fatal1ty X370 Professional Gaming, 48GB Corsair DDR4 @ 3000MHz, RX5700 XT 8GB Sapphire Nitro+, Benq XL2730 1440p 144Hz FS

Retro Build: Intel Pentium III @ 500 MHz, Dell Optiplex G1 Full AT Tower, 768MB SDRAM @ 133MHz, Integrated Graphics, Generic 1024x768 60Hz Monitor


 

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, rcmaehl said:

You'd want to link the folder to the location on the other drive using ln

 

https://shapeshed.com/unix-ln/

I don't think you can symlink /usr/bin to something else. You'd need to make a dedicated partition for it but I don't think that's what OP wants. I think what they actually want is to have their home folder on the other drive.

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Sauron said:

I don't think you can symlink /usr/bin to something else. You'd need to make a dedicated partition for it but I don't think that's what OP wants. I think what they actually want is to have their home folder on the other drive.

I mean, it's not the smartest move, but I don't see why not. Regardless, /home directory on another drive is a lot more common (and natively supported by the installer)

PLEASE QUOTE ME IF YOU ARE REPLYING TO ME

Desktop Build: Ryzen 7 2700X @ 4.0GHz, AsRock Fatal1ty X370 Professional Gaming, 48GB Corsair DDR4 @ 3000MHz, RX5700 XT 8GB Sapphire Nitro+, Benq XL2730 1440p 144Hz FS

Retro Build: Intel Pentium III @ 500 MHz, Dell Optiplex G1 Full AT Tower, 768MB SDRAM @ 133MHz, Integrated Graphics, Generic 1024x768 60Hz Monitor


 

Link to comment
Share on other sites

Link to post
Share on other sites

5 minutes ago, rcmaehl said:

I mean, it's not the smartest move, but I don't see why not.

The system straight up won't let you, at least according to stackexchange.

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to comment
Share on other sites

Link to post
Share on other sites

Programs are spread across the root partition, between man files, libraries, etc, so you can't really achieve this.  Plus if you do manage it and the second drive fails, your whole OS breaks down.

Router:  Intel N100 (pfSense) WiFi6: Zyxel NWA210AX (1.7Gbit peak at 160Mhz)
WiFi5: Ubiquiti NanoHD OpenWRT (~500Mbit at 80Mhz) Switches: Netgear MS510TXUP, MS510TXPP, GS110EMX
ISPs: Zen Full Fibre 900 (~930Mbit down, 115Mbit up) + Three 5G (~800Mbit down, 115Mbit up)
Upgrading Laptop/Desktop CNVIo WiFi 5 cards to PCIe WiFi6e/7

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, Sauron said:

The system straight up won't let you, at least according to stackexchange.

that link is for osx, where there is SIP that keeps you from touching system files, most distros don't have. that. but if you mess with any of the system directories it will have issues, and normally /usr isn't that big, so I wouldn't worry about it.

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, Electronics Wizardy said:

that link is for osx, where there is SIP that keeps you from touching system files, most distros don't have. that. but if you mess with any of the system directories it will have issues, and normally /usr isn't that big, so I wouldn't worry about it.

Oh you're right. Still, it's a very bad idea.

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to comment
Share on other sites

Link to post
Share on other sites

You can't. Location is handle by the package manager. Applications that you built from source or download in raw binary forms can be place where ever you want however. 

 

Usually you don't want to just symbolic link. Many programs rely on files and libraries that they may not find if you move them elsewhere and symbolic link them. 

 

If you want all the programs package manager install to a 2ndary drive, you can boot into a live USB and then mount partitions in your 2nd drive to usr/bin and usr/sbin. 

 

Important: move everything from the bin into your partitions on your 2nd drive before mounting. Don't forget to edit the fstab file. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, wasab said:

You can't. Location is handle by the package manager. Applications that you built from source or download in raw binary forms can be place where ever you want however.  

 

Usually you don't want to just symbolic link. Many programs rely on files and libraries that they may not find if you move them elsewhere and symbolic link them. 

 

If you want all the programs package manager install to a 2ndary drive, you can boot into a live USB and then mount partitions in your 2nd drive to usr/bin and usr/sbin. 

  

Important: move everything from the bin into your partitions on your 2nd drive before mounting. Don't forget to edit the fstab file. 

Thank you very much.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×