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 have a netbook with a tiny hard drive, and an external drive to go with it. It's running Ubuntu. I want to be able to install some packages to that external hard drive, so that when the hard drive is not plugged in the netbook still functions, just with out some functionality. It doesn't have to be this way exactly, I just want the effect of offloading some of my installed libraries and programs onto the portable hard drive. In other words, just mounting some directories from the external drive wont work because I at least need some basic programs to run normally.

Here are some things I was thinking about but wasn't able to find enough information to actually understand if they are feasible, or how to go about doing them. Comments on how to do any of these or on alternate methods are greatly appreciated.

  1. Can I do something like this if I use the --root=/media/external switch of dpkg install and then add /media/external/ to my system path?
  2. What if I create some kind of wrapper for dpkg that will install the package into an alternate root (--root=/media/external) and then create a symlink in the internal file system to every file that was just installed on the external file system?
  3. How about something where I chroot into the external drive?
  4. How about something using LVM?
share|improve this question
add comment

2 Answers

You can use --root to install packages into another directory, but you can't use most programs from there as most programs look for some files in fixed places (like /etc). The option is there for cases like installing packages into a NFS root for diskless clients.

Maybe you could use something like UnionFS to merge the two file systems.

share|improve this answer
    
Yeah, that's what I figured would be the problem. At first glance, UnionFS looks like it might work very well. I'll see if I can give that a try. –  cheshirekow Jun 24 '10 at 16:01
    
So it appears that UnionFS was dropped from ubuntu since Karmic and replaced with unionfs-fuse (a fuse implementation rather than a kernal module). I like the idea of a kernel module better but this seems to be working quite well. This is, at least, exactly what I wanted so thanks for the good answer :). –  cheshirekow Jun 24 '10 at 19:15
    
Ok, I'm un-answering this. UnionFS, it seems, is only a half answer. It does mostly what I want, but it appears that you can't unionfs two directories together, and then mount the union to one of the two.. which is what I would need. One way (possibly) to finish the answer would be to do something with a chroot? i.e. create a fakeroot as the union of the roots of each drive, and then chroot into that. Will this work? I don't know how to use chroot. –  cheshirekow Jun 25 '10 at 19:44
    
aufs2 is what's used for union mounts in ubuntu livecds IIRC. –  Tobu Jun 25 '10 at 21:46
add comment

If you want a simple answer that doesn't make you work your away around the debian package management, just use mount and symlinks. You could mount your external drive using /etc/fstab and have some symlinks that point into that drive. NOTE: You shouldn't blindly symlink, be sure before you change something ;)

A rather save suggestion would be to put your /tmp into a ramfs (which you should be doing anyways on many netbooks with SSD).

Are you sure your programs need the most space on your internal drive? Did you check it using a tool like xdiskusage?

share|improve this answer
add comment

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.