I have a computer with Ubuntu Linux, and I have no more room on PC, so I have a flash drive that I want to install packages onto, is there any way to install a package onto a flash drive?

1 Answer 1


Most pre-built packages (particularly in Debian-based systems) are not relocatable. You could build your own packages to suit your choice of directory layout. Lacking that, you have what's built. Those go into a limited set of directories.

You could mount the flash drive in your filesystem where the machine expects to own those files, e.g., /usr/bin, but that would confuse things when you took the drive out. It's best not to do that.

Conceivably you could have packages which install completely under /opt, and mount the flash drive there. It all depends on what packages you have (or build).

When you mount a filesystem on a mountpoint, the existing contents of the directory on the mountpoint are hidden.

  • You might find that expedient, e.g., if you wanted to make /var much larger by mounting a large filesystem there, it would be inconvenient to delete all of the existing files under /var before preparing to reboot with the large filesystem mounted.
  • In the case of /opt (or other useful places to put programs), you might decide to use rsync to copy the existing files from the mountpoint to the new filesystem and leave a copy of those intact, e.g., for system maintenance.

    Doing that does have the drawback that the hidden files would not be updated when you upgrade your system. Also, library upgrades may cause those hidden files to stop working properly—making them less useful in system maintenance.

    For that reason, it is usually preferable to install your add-on files in a directory which is not used for packages managed by the system.

  • So, If i want to mount a drive elsewhere, do I just use mount in the directory that I want it to mount in? Feb 25, 2016 at 14:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .