Monday, October 9, 2017

Why does 12.04 upgrade abort with out of space error when I have lots of it?


When upgrading Ubuntu from 11.10 to 12.04 I discovered an unexpected problem. The upgrade was stopped because there wasn't enough free space for the installation. I managed to free some space and do the upgrade but now a prompt appears after logging in saying I'm out of space. This prompt asks me if I want to examine the problem. The "Disk Usage Analyser" is opened. In the top it says:


Total filesystem capacity: 47.0 GB (used: 13.5 GB available: 33.4 GB)


Folder -- Usage -- Size



  • / -- 100% -- 12.5 GB


    • usr -- 44.8 % -- 5.6 GB



    • home -- 30.3 % -- 3.8 GB



    • lib -- 13.0 % -- 1.6 GB



    • var -- 9.1 % -- 1.1 GB



    • boot 2.5 % 309.5 GB



    • and a lot of small contributors like: etc, opt, sbin, bin etc.



I do not really understand this problem since the analyser in the top says that I have 33.4 GB left in this file system. What can I do to make Ubuntu use the remaining space?


Running
df -i
in the terminal gives:



Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda7 610800 576874 33926 95% /
udev 213451 563 212888 1% /dev
tmpfs 218524 486 218038 1% /run
none 218524 3 218521 1% /run/lock
none 218524 7 218517 1% /run/shm
/dev/sda8 2264752 16371 2248381 1% /home

The output of
df -h



Filesystem Size Used Avail Use% Mounted on
/dev/sda7 9,3G 7,8G 1,1G 88% /
udev 993M 4,0K 993M 1% /dev
tmpfs 401M 884K 400M 1% /run
none 5,0M 0 5,0M 0% /run/lock
none 1003M 152K 1002M 1% /run/shm
/dev/sda8 35G 4,0G 29G 13% /home
/dev/sda2 101G 64G 37G 64% /media/A2C8E28BC8E25CD3

Running
sudo fdisk -l
gives



Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000080
Device Boot Start End Blocks Id System
/dev/sda1 63 96389 48163+ de Dell Utility
/dev/sda2 * 98304 210434488 105168092+ 7 HPFS/NTFS/exFAT
/dev/sda3 210436094 312576704 51070305+ f W95 Ext'd (LBA)
/dev/sda5 306279288 312576704 3148708+ dd Unknown
/dev/sda6 210436096 214341631 1952768 82 Linux swap / Solaris
/dev/sda7 214343680 233873407 9764864 83 Linux
/dev/sda8 233875456 306278399 36201472 83 Linux
Partition table entries are not in disk order


I'm seeing that you are using a separate partition for your home directory.


It's true that you have much unused space in your home, as shown by your df -i:


Filesystem      Inodes  IUsed   IFree IUse% Mounted on
/dev/sda8 2264752 16371 2248381 1% /home

However it's also true that you have low space available in your root filesystem:


Filesystem      Inodes  IUsed   IFree IUse% Mounted on
/dev/sda7 610800 576874 33926 95% /

If you run df -h, you'll see exactly how much space is left on the root device.


To resolve the issue, there are many, many ways you can proceed. In my opinion, the most simple are three:



  1. uninstall some unused programs to free some space;

  2. repartition your hard disk in order to make sda7 bigger;

  3. reinstall Ubuntu, but this time creating a unique partition for everything.


If you want to go with the way 2 and need support, please provide the output full of sudo fdisk -l /dev/sda If none of those solution fit for your needs, give us some feedback and we may find something else with your help.


Whatever you'll choose, I must suggest you to backup your stuff before proceeding.




To repartition your hard disk: again, there are many options. I suggest you to do the following:



  1. Create a Live CD with Ubuntu and boot with it, choose "Try Ubuntu" when asked and open GParted Partition Editor.


  2. From there, you need to make sda8 smaller and move it to the right. To do so, right-click on /dev/sda8 and select Resize/Move (you may need to Unmount first). Set Free space preceding to 10240 MiB (10 GiB).


  3. Then you need to make sda7 bigger: right-click it, choose Resize/Move and set both Free space preceding and following to 0.


  4. Apply the operations (it may take several minutes) and close GParted.


  5. Now you should have made your root partition big enough to hold your own files. You need to move them. From a terminal:


    $ sudo -s
    # cd /media/
    # mkdir sda7 sda8
    # mount /dev/sda7 sda7/
    # mount -r /dev/sda8 sda8/
    # cp -ar sda8/* sda7/home/

    cp may take several minutes before completing.


  6. Now issue sudo gedit /media/sda7/etc/fstab. You should see a line similar to this one:


     UUID=01234567-89ab-cdef-0123-456789abcdef /home ext4 errors=remount-ro 0 0

    Some values may change, what's important is that you should see /home preceded and followed by one or more blank spaces. Once you have found the line, remove it.


  7. Almost finished! What you need to do is to remove the old home partition and make use of the freed space. So, open GParted again, unmount sda7 and sda8, delete sda8 (right-click and Delete), make sda7 bigger (right-click, Resize/Move, set 0 to both Free space following and preceding). Finally, apply the operations and close GParted.



Now you are done. Reboot and from your own Ubuntu run df -h again. You will see that the available space for the root directory / has increased. You will also see that /home does not appear in the output.


Note: as you may have already noticed, repartitioning your disk is not a five-minutes task. Such operations are always risky: if you click the wrong button or if your computer experiences a power failure during the process, you will lose all of your data. Remember to backup before doing anything!


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...