Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I know you can do this on Windows (which is helpful since I have a small OS partition) but is it possible to do this on Linux?

share|improve this question
    
Do you mean from source or using a package manager? –  Aluísio A. S. G. Jan 24 '13 at 22:56

2 Answers 2

Of course it's possible.

At its most basic, this could consist of nothing more than creating an appropriate directory (/bin, say) on the desired volume, adding this to your environment's $PATH variable, and then putting some binary executables in there.

If you're using one of the package managers which puts all its binaries in a special place (like the /opt directory) you can always modify your fstab so that your external volume (or a partition on it) mounts to /opt, which means that /opt is now magically on your external volume: How to edit and understand fstab

share|improve this answer
    
I understand that would work if I had "portable" binary files (like ones I've built from source) but what about when using apt-get or yum? Do these not install to already defined default directories? :) –  Geesh_SO Jan 24 '13 at 23:12
    
They do. Usually, the directory structure of the package manager is carefully controlled so as to help managing dependencies etc. It's not the sort of thing that can be straightforwardly answered in the general case. In the case of apt-get, I'm fairly certain that it pretty much requires everything to be in an expected place. –  marshaul Jan 25 '13 at 3:15
    
In many/most cases you may be able to move the compiled binaries to your external volume and then use the package manager to clean up the build files/dependencies etc. –  marshaul Jan 25 '13 at 3:22
    
If you're using one of the package managers which puts all its binaries in a special place (like the /opt directory) you can always modify your fstab so that your external volume (or a partition on it) mounts to /opt, which means that /opt is now magically on your external volume. This is probably your best bet. –  marshaul Jan 25 '13 at 3:24

If you want all of your software to be installed on a different partition automatically, the easyest way would be a partition containing the content of /usr. This way, nearly every big file being installed with software is put on the separate partition. When doing this, your system won't start properly if the partition can't be mounted on boot, but all the important tools for rescue should be in /bin and /sbin, so this should be fine.

For doing this you have to boot from a livecd and copy the whole content of the /usr directory to the other partition and then edit /etc/fstab of your system to contain the line:

UUID=InsertYourUUIDhere    /usr    FileSystemType  MountOptions

Replace "InsertYourUUIDhere" by the UUID of the partition (you get it by using the command "blkid"). Replace "FileSystemType" by the filesystem type of the partition and replace "MountOptions" by the mount options found in the line with your root filesystem (/).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.