Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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%
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:-

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:

sudo fdisk -l [sudo] password for

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:

   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:

   Device Boot      Start         End 
Blocks   Id  System /dev/sdb1         
1        4862    39053983+   7 


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.

My current situation:

Hi ,

This is just my current situation post the initial problem faced by me(as per the question posted) and how I actually tried to get around it...

Thank you for your answers and comments, I am sorry, I have already tried something else which seems to have zeroed down my chances of getting back Ubuntu up & running for me now on my PC.

Every time now I try booting Ubuntu, I guess due to lack of space it no more boots on my PC. All this happened after I made one change in the system mount file located at /etc/fstab.

I changed the default location where my new hard disk was originally mounted. Originally it was mounted in /media/ubuntulinuxstore, I changed it to /usr. In other words I mounted /usr on this new hard disk and I guess also ended up making it a mount point for the hard disk.

Very soon after, the entire behavoir of Ubuntu OS and various simple commands like sudo, vi etc. stopped functioning. Files could no longer be detected from how they were initially. I couldn't undo the changes I made to /etc/fstab as I was no more the su wasn't working any more and hence making me devoid of all write permissions wrt system files..

I thought in this position a reboot would be the only last resort kind of a rescue.

I was in a position of having only around 10 MB free on my Ubuntu system. I tried booting it, the booting didn't succeed , it seemed to be stuck. This could be now because the /dev/sda2 was now 100% full leaving no memory ( may be virtual in particular to boot the OS ).

I performed a memory test wrt Ubuntu OS, that was 100% successful for me, but of no avail. This test I could perform wrt an option I got in the GRUB when starting my PC.

I tried booting via Ubuntu recovery mode, which I always get through GRUB as an option while starting my PC, this initially took me to a kind of interface. I tried vi /etc/fstab... to edit the mount location of the new hard disk( /dev/sdb1 ) to what it was originally ( /dev/sdb1 37G 214M 35G 1% /media/ubuntulinuxstore - as shown in the question above). But the only command that worked for me at that point of time was cat /etc/fstab. Even pico /dev/sdb1 didn't work for me.

I also via GRUB typed 'e'( for edit ) and then tried to edit the kernel( again made use of 'e' ) with the intention to boot for a single user( I typed single next to the already existing lines written for a file that I obtained on typing 'e' wrt the kernel). Finally on pressing enter, I was at a step higher, at the parent directory where the option of kernel was originally present , from there I entered option b( to boot ). But this didn't help at all.

Now finally every time i try booting Ubuntu via the grub, I am put in a loop due to errors wrt hard disk and I end up back at the original GRUB option. All this atleast didn't have an impact on my Windows OS. But it seems that I have almost lost Ubuntu and have to format it now freshly.

I even tried out a whacky idea of disconnecting the new hard disk from the Cpu, but that went in vain and my problem still continues to persist..

Only seems like a miracle will save me now to retain Ubuntu. Any feedback or tips which I can carry to avoid such blunders in the future?

I know this leaves me with almost no hope of getting back Ubuntu, but still I would gather some courage to ask one last time.. is there a way around this..??

Thank you very much for your patient reading and for any feedback obtained wrt my post..

share|improve this question
your Ubuntu system is broken because you've used a NTFS filesystem for /usr. That will always break your system as NTFS does not support file permissions as required for Ubuntu. You should format it to ext4 using a LiveCD in which you can undo your changes to /etc/fstab as well. If you need more instructions, please reply. Will your external HDD always be connected to the machine? As an alternative to mounting the external HDD on /usr, you can use LVM. I've just successfully combined two disks for one logical partition using LVM. – Lekensteyn Apr 12 '11 at 17:29
@Lekensteyn: Thanks a lot for all your help, I shall do my homework on LVM and then surely revert back to you in case I have any doubts.. I plan to use my external HDD for both the desktop and laptop. The above question was wrt another m/c at office.. I wasn't able to undo my wrong and had to format it.. luckily i had backed up most of my data on windows, by copying files containin code/other related info..:) I just don't want to repeat the same scenario @ home, thus I am being extra cautious now.. – boddhisattva Apr 13 '11 at 17:38

you can not set or otherwise move the location of the software installed via the system package manager (APT), Linux unlike Windows stores application components grouped by type, not by application, for example, executables go into /usr/bin, volatile content into /var, you can read more about it at .

Now back to your problem, do you really need more space for applications or you need it for user data ? For user data you can relocate /home to the new partition, for applications you could relocate the entire /usr dir. Both require copying the contents to the new disk mount location (rsync is a good utility for that), then edit your /etc/fstab to mount those directories on the new device, and reboot.

share|improve this answer
Hi Joao, I mainly require more space for application and app specific softwares that need to be installed, – boddhisattva Feb 24 '11 at 10:20
I edited the same file you mentioned above when I wanted to mount this new hard disk to ubuntu. could you please tell me the command or line I would need to add to this that /usr always mounts on the new hard disk. Can I just copy /usr to this new hard disk? – boddhisattva Feb 24 '11 at 10:29
Don't mount /usr, mount / and /home and then / will contain the applications. Otherwise it will be a pain if he wants to use /opt. – mathepic Feb 24 '11 at 11:54
@mathepic: you mean I need to give some command like:/dev/sdb1 / ext3 defaults 0 0 Is this correct..? will this if added in /etc/fstab file help? this will even take care of mounting /home right..? So I don't have to repeat another line in the code for that. – boddhisattva Feb 24 '11 at 13:41
Run "sudo du -sh /home" in a terminal to see how much space is being used by your home directory. It probably is a good chunk of that space which you could move to the other disk. Or you might just dedicate one drive to Windows and the other to Ubuntu, then it can have the full 40gb. – psusi Feb 24 '11 at 14:59

Your Answer


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.