I know this question was asked on google a few times here and there but everywhere so far people just tell how it works on Linux and I've learned that already, so you don't have to tell me how partitions work nor how the operating system works :)

I want to know how to practically install my packages onto a sd/usb stick. I have only 16 GB available initially on my Chromebook's drive which is already occupied by both Chrome OS and Ubuntu, so I am pretty low on that and I would like not use any more of that drive space.

I would like to either:

1) Set a default installation path to that sd/usb drive


2) Enter the path manually each time. Both are okay with me.

If there is a piece of software which would allow you to do that in GUI - that'd be even better!

  • I assume you mean for installed software; to put it in, say, /opt, where /opt is on the sd/usb stick? And not to just store a respository of packages (RPM, DEB, etc) ? – Jeff Schaller Mar 2 '16 at 19:12
  • Whatever works just so the installed package does not take any storage on the local drive but on the sd card. I'm not sure if there is a way to specify path or something before apt-get install. But honestly, whatever will make it utilize space on the sd card and not my drive - works for me! – Micard Mar 2 '16 at 19:21
  • 1
    you're going to want to look into the relocation option for whatever package manager you use – Jeff Schaller Mar 2 '16 at 19:38

You can see if there is a docker container already for your software (now known to be GNU Octave). You store the container image on the USB device and launch it. It will actually use your main filesystem to store the running instance and virtual filesystem. To be able to use this container with your home directory, you would instruct docker to bind-mount your home volume at container-creation time.


A similar question was asked here and here. Basically, for Ubuntu based Linux's, the answer is no, not without compiling from source. However, there might be a way.

Ignoring the above, you could, for instance, set up fstab to auto mount the USB device under /usr/local. Make sure the exec option is set (or that noexec is not set) On the USB device, your directory structure should contain:


And maybe also /lib64. In /etc/ld.so.conf you would need


Somewhere in /etc/profile, or in your user's .bashrc, you would want:


now here's the tricky part: installation. As mentioned at the top, the apt/dpkg tool doesn't let you relocate a package's target installation directory. Solution 1: recompile from source. Solution 2: apparently a tool exists to facilitate this: dpkg-divert. http://manpages.ubuntu.com/manpages/hardy/man8/dpkg-divert.8.html However, the intent of this tool is to let multiple instances or versions of a package coexist alongside others. But in theory, it might work to the desired effect.

  • Well, I will am compiling the source GNU Octave 4.0.0 and this is a major piece of software I'd definitely like to have on an SD-card. So what would be my actions in this case? – Micard Mar 3 '16 at 4:05
  • Compile from source, follow the instructions regarding configure usually w.r.t --prefix. – Otheus Mar 3 '16 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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