1

I recently realized that since I don't game much anymore there's a lot a lot holding me to Windows, so I've decided to make the switch to Ubuntu today.

My computer has a 60GB SSD which is my boot drive, and a 1TB hard drive which I install applications/games on. With Windows, installing applications to a separate hard drive is childs play, I just change the location during the install wizard. However I don't know how to do that with Ubuntu. As far as I know if I just run something like apt-get install package it will just be installed to its default directory, which would be my SSD since that's where Ubuntu is installed.

Is there a way I can mount directories like /opt on my 1TB drive rather than my SSD in order for large applications to exist on my hard drive? Or would there be a better way to go about doing this?

I don't mind small applications that I use frequently being installed on my SSD, in fact I prefer it. Packages like Chromium are ones that I'd like to have on the SSD.

1
  • bcache provides this kind of optimisation without the need for micromanagement
    – Gabriel
    Jan 7, 2014 at 18:57

1 Answer 1

2

If you want the files in /opt to be on your 1TB drive, then (1) move the current /opt and all its files to some location on your 1TB drive and (2) link that location back to /opt:

ln -s /some/location/on/1TB/drive /opt

If you really want to mount it, there are two options. First, you can:

mount --bind /some/location/on/1TB/drive /opt

This will make whatever is in /some/location/on/1TB/drive appear to be in /opt. Whatever was in /opt before is now hidden. To have this happen automatically on boot, put this line in your /etc/fstab file:

/some/location/on/1TB/drive /opt none bind

Secondly, if you want to devote the whole of your drive to /opt, you can:

mount /dev/sdb1 /opt

where you should replace /dev/sdb1 with the correct device for your 1TB drive. To make this happen automatically on boot, put something like the following line in your /etc/fstab:

/dev/sdb1 /opt  ext3    defaults        0    0

where /dev/sdb1 and ext3 and default should be replaced, respectively, with the correct device for your drive, the correct filesystem that it uses, and whatever options you prefer.

2
  • Okay, a symlink is a good idea. But is there a way to have /opt mounted on the 1TB drive anyway? Jan 4, 2014 at 23:46
  • @ChrisWhite Yes. Answer updated.
    – John1024
    Jan 5, 2014 at 0:33

You must log in to answer this question.

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