Changing the default installation path to a newly installed hard disk

Posted by mgj on Ask Ubuntu See other posts from Ask Ubuntu or by mgj
Published on 2011-02-24T09:19:00Z Indexed on 2011/02/24 15:33 UTC
Read the original article Hit count: 534

Hi,

I am currently working on a dual-booted PC. I am using Windows XP and Ubuntu 10.04 Lucid Lynx released in April 2010.

The allocated partition to Ubuntu that I am making use of has almost exhausted. Current memory allocations on the PC wrt Ubuntu OS looks like this:

bodhgaya@pc146724-desktop:~$ df -h
Filesystem            Size  Used Avail
Use% Mounted on /dev/sda2            
8.6G  8.0G  113M  99% / none                  998M  268K  998M   1% /dev none       
1002M  580K 1002M   1% /dev/shm none  
1002M  100K 1002M   1% /var/run none  
1002M     0 1002M   0% /var/lock none 
1002M     0 1002M   0% /lib/init/rw
/dev/sda1              25G   16G  9.8G
62% /media/C /dev/sdb1             
37G  214M   35G   1%
/media/ubuntulinuxstore
bodhgaya@pc146724-desktop:~$ cd /tmp

I am trying to mount a 40GB(/dev/sdb1 - given below) new hard disk along with my existing Ubuntu system to overcome with hard disk space related issues.

I referred to the following tutorial to mount a new hard disk onto the system:- http://www.smorgasbord.net/how-to-in...untu-linux%20/

I was able to successfully mount this hard disk for Ubuntu 0S. I have this new hard disk setup in /media/ubuntulinuxstore directory.

The current partition in my system looks like this:

bodhgaya@pc146724-desktop:/media/ubuntulinuxstore$
sudo fdisk -l [sudo] password for
bodhgaya: 

Disk /dev/sda: 40.0 GB, 40000000000
bytes 255 heads, 63 sectors/track,
4863 cylinders Units = cylinders of
16065 * 512 = 8225280 bytes Sector
size (logical/physical): 512 bytes /
512 bytes I/O size (minimum/optimal):
512 bytes / 512 bytes Disk identifier:
0x446eceb5

   Device Boot      Start         End 
Blocks   Id  System /dev/sda1   *     
2        3264    26210047+   7 
HPFS/NTFS /dev/sda2            3265   
4385     9004432+  83  Linux /dev/sda3
4386        4863     3839535   82 
Linux swap / Solaris

Disk /dev/sdb: 40.0 GB, 40000000000
bytes 255 heads, 63 sectors/track,
4863 cylinders Units = cylinders of
16065 * 512 = 8225280 bytes Sector
size (logical/physical): 512 bytes /
512 bytes I/O size (minimum/optimal):
512 bytes / 512 bytes Disk identifier:
0xfa8afa8a

   Device Boot      Start         End 
Blocks   Id  System /dev/sdb1         
1        4862    39053983+   7 
HPFS/NTFS
bodhgaya@pc146724-desktop:/media/ubuntulinuxstore$

Now,

I have a concern wrt the "location" where the new softwares will be installed. Generally softwares are installed via the terminal and by default a fixed path is used to where the post installation set up files can be found (I am talking in context of the drive).

This is like the typical case of Windows, where softwares by default are installed in the C: drive. These days people customize their installations to a drive which they find apt to serve their purpose (generally based on availability of hard disk space). I am trying to figure out how to customize the same for Ubuntu.

As we all know the most softwares are installed via commands given from the Terminal. My road block is how do I redirect the default path set on the terminal where files get installed to this new hard disk.

This if done will help me overcome space constraints I am currently facing wrt the partition on which my Ubuntu is initially installed. I would also by this, save time on not formatting my system and reinstalling Ubuntu and other softwares all over again.

Please help me with this, your suggestions are much appreciated.

© Ask Ubuntu or respective owner

Related posts about installation

Related posts about terminal