I'm using Ubuntu 10.10 - the Maverick Meerkat. Whenever I install software using the Software Center, it installs it to /usr/lib. I have less space in this drive. Is it possible to change the default installation path to any other place? And how?

| improve this question | | | | |

Debian/Ubuntu use a standard directory hierarchy. The command man hier will describe this for you. It is common for packages to create symlinks to place files in the correct place when the program expects them elsewhere.

There are two options I use to increase space on a partition: - As a temporary solution I create a directory on another partition for a directory like /var/cache/apt/archives which can take a fair amount of space. I then move the contents of the directory to the new partition and replace the directory with a sumlink.
- A permenant solution is to create a new partition for a large moveable directory like home, var or usr. Then I rsync the directory onto the new partition and mount it. Cleanup is done by mounting the root partition on /mnt and removing the files from the directory under /mnt.

Cleaning up /tmp and moving it to a tmpfs mount can free up space if it is on disk.

You may also free up space with the apt autoclean or apt clean commands. The second option will remove all download debs for /var/cache/apt/archives.

Running apt and removing obsolete kernels may also free up space. Usually two are sufficient, and they don't always get removed automatically. Don't remove the current kernel. If you haven't rebooted for a long time you may want to reboot to the newest kernel before removing old kernels.

The command du -sk /usr /home /var | sort -n will tell you how large those directory trees are.

| improve this answer | | | | |
  • Mounting filesystems as tmpfs is only recommended when you've spare RAM. I wouldn't do it on my 1GB 32 bits installation. – Lekensteyn Feb 2 '11 at 8:50
  • @Lekensteyn /tmp usually has very little active data. As long a swap space is sufficient, impact of using /tmpfs at worst would be the same as having it as a disk partition. Best case, no I/O is required. I have and do use /tmpfs with much less RAM. – BillThor Feb 2 '11 at 20:28

There is no facility to change the installation structure. They are hard-coded in the installation packages. What you can do is find a way to increase the size of your root partition. You can do this if you boot with your Ubuntu installation CD.

If you can provide the output of the command

sudo fdisk -l

we might be able to help on how to resize.

| improve this answer | | | | |
  • Hi.. Thanx for ur reply. I'm totally new for Linux os. so can u give full details for increase the root partition. – Silambarasan Feb 2 '11 at 2:53
  • Open a Terminal window (Applications » Accessories » Terminal) and run the above command. You will be prompted to write your password (when you type your password nothing appears, then press Enter). The output of the command will help to give advice. You can also read the other answers for background information for the next steps. – user4124 Feb 2 '11 at 3:23

The installation path is a standard location and cannot be changed. If you have another drive that has space, you can move any amount of your files to that drive by mounting your big directories at partitions on that drive (this is easiest to do when you are first installing Ubuntu). It's usually a good idea to move your /home directory to a different partition/drive rather than trying to move your OS files.

Detailed instructions can be found here: https://help.ubuntu.com/community/Partitioning/Home/Moving

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.