0

I bought a new pc and i installed Ubuntu to my 60gb ssd.Now, i have another disk (1 Tb hdd).My question is how to install programmes to my HDD an not to my SSD.Can i change the installation directory of UBUNTU SOFTWARE CENTER?Or else how can i install other programmes to my HDD?please help me.

2 Answers2

0

You need to put the folder /usr onto your other HDD. Depending on whether you already installed Ubuntu or are about to install it, the steps are different. I'll help you with both, just write a comment to this answer.

However, I want to tell you that you probably will be happier with having your programs on the SSD and instead putting your home folder onto the HDD. Your programs need to read information from there when they start and operate. And I'm guessing that you want your applications to start quickly and to operate fast.


So you got your ext4 partition on your HDD. Now boot a live system.

I recommend backing your entire SSD up to an external HDD. To do this (in the live session) make sure no partition of your SSD is mounted: Open GParted and make sure there aren't any lock symbols. If there is a swap-partition, just right-click it and choose "swap off". For everything else: Right-click it and choose "unmount".

Then open Nautilus and navigate to your destination on the HDD. When you are there, press Ctrl+L and copy the path. Then type in sudo su into a terminal and execute this command:

dd if=/dev/sda bs=8M | gzip -9 > "[the path you copied]/image.gz"

Assuming /dev/sda is your SSD, otherwise change it. GParted will help you to figure out which one it is.

This will take some time since your entire SSD has to be copied. If you have a slow CPU, change -9 to -3.

Do not mount any partitions on your SSD while this command runs. This would render your backup useless.

When it's done and the numbers for in and out match, you successfully created a backup. You can now proceed in you actual edeavor.


Make sure GParted is closed by now. Open Nautilus and go to your system partition on the SSD, press Ctrl + L, copy the path, I'll call it [systemPath]. Do the same thing with the partition on your HDD, I'll call this path [targetPath]. Make sure there is nothing on the partiton on the HDD except for the folder "lost+found" (press Ctrl + H to show hidden files). Open a terminal and enter this command:

sudo cp -p -R "[systemPath]/usr/*" "[targetPath]"

If this command shows any errors, DO NOT PROCEED. Nothing is lost if it fails and you'll be able to use your system just as you used to. (Plus, you made a solid backup which is always a nice thing to have.) Post the errors here if there are any. Otherwise continue.

Open GParted again and right-click on the partition of your HDD. Choose "Information. There is a field called "UUID". You need this string. Copy it to GEdit and then close GParted so you can mount partitions with Nautilus.

Open Nautilus and go to your system partition on the SSD, press Ctrl + L, copy the path. Then open a terminal and enter this:

sudo gedit "[systemPath]/etc/fstab"

GEdit will open and show you a file. Enter this line immediately after the line which says / after the UUID (where this line says /usr) (The UUIDs have to be different. If they are the same, you copied the wrong one.):

UUID=c368e545-6d5d-3cc3-b9da-8e3fe347930d /usr               ext4    errors=remount-ro 0       1

where you substitude the UUID with the one you copied from GParted.

UTF-8
  • 5,910
  • 10
  • 34
  • 68
0

Many programs are stored in /usr/bin, /usr/sbin or /bin. Due to this fact I have two solutions:

Firstly you can copy your complete /usr folder to the HDD and rename the old one to /usr_old or something. Then you can create a new usrdirectory.

mkdir /usr

Now you can unmount your HDD from the old mountpoint and mount it as the new /usr directory.

mount <device> /bin

Don't forget to edit fstab in order to make the changes permanent. With the /bin directory you can proceed identically. Matter, that the complete folder is now on your HDD and therefore programs, which belong to the OS, too. So if you notice some performance-decreases in some programs I'd copy it back to the SSD and combine this method with the second one.


The other solution, if you don't want to change the current mountpoint etc. is creating symlinks for the directories above. Copy them onto your HDD and create a symlink in the old place. Vice versa you can proceed for programs which you want to keep on the SSD.