Updating from Ubuntu 9.04 to 10.04. With not enough diskspace

Written by James McDonald

April 19, 2010

I have an old Compaq nx7000 work laptop that I have Ubuntu on.

Just ran:

sudo do-release-upgrade -d
# It's before the official release date of Ubuntu 10.04 so I ran with the -d switch
#  -d, --devel-release   Check if upgrading to the latest devel release is
#                        possible

and got a complaint back that I didn’t have enough disk space. I had 1.4GB free on the root (/) partition and it needed 2.2GB to do the upgrade.

Tried the usual process of removing old packages & cleaning up:

sudo apt-get clean
sudo apt-get autoclean

I even ran the System ==> Administration ==> Computer Janitor utility however these steps didn’t claw enough space back.

Analysing my space available using df showed that I didn’t have enough spare space on my root partition but /home had plenty of spare space

 df -h
Filesystem            Size Used Avail Use% Mounted on
/dev/sda2             5.5G  3.9G  1.4G  75% /
none                  371M  280K  371M   1% /dev
none                  375M  192K  375M   1% /dev/shm
none                  375M  196K  375M   1% /var/run
none                  375M     0  375M   0% /var/lock
none                  375M     0  375M   0% /lib/init/rw
/dev/sda6              22G  4.5G   16G  22% /home

The work around:
I went into /usr and had a look at the space being taken up by the /usr/* directories and discovered that /usr/share was a good candidate for moving to another volume.

# go into /usr
cd /usr/

# preface these commands with sudo
# check the disk usage
du -sh ./*
207M	./bin
2.0M	./games
26M	./include
1.3G	./lib
92K	./lib64
3.8M	./local
21M	./sbin
1.9G	./share
28K	./shareFeisty
238M	./src

# identify that /usr/share is a good candidate to move to another partition with more space on it

# copy it
# -a preserves the permissions and ownership
# -r copy's subdirectories
# -v just shows you what files cp is currently copying
cp -arv /usr/share /home

# mv the old /usr/share and then link it to the new location
mv /usr/share /usr/share.old
ln -sf /home/share /usr/share

# oh and you need to remove the share.old 
# directory to actually get the diskspace back
rm -rf /usr/share.old

# run the upgrade

After the upgrade:
The only problem with leaving the system this way is that some of the links in /usr/share point to relative paths so may get confused. I noticed this because my firefox desktop icon broke.

So I reverted back to the original layout after the upgrade completed:
Reverting back to the default /usr/share configuration

sudo apt-get clean
sudo apt-get autoclean

# make sure you check that you have enough
# space to revert!
sudo df -h
sudo du -sh /home/share

# when you now it's all ok do the following
cd /usr

# when you remove the share link you will lose your desktop icons because they can't find /usr/share/*
# The network manager applet will also quite
# complaining "could not find some of it's required resources"
sudo rm share

sudo cp -arv /home/share ./
# after you finish the cp command reboot to make sure it's alright.


  1. Yuri Khan

    You could probably solve the problem of confused relative symlinks by bind-mounting /home/share at
    /usr/share instead of symlinking:

    sudo mount --bind /home/share /usr/share

    Alternatively, whip out gparted and carve a proper separate partition for /usr/share out of the space occupied by /home.

  2. admin

    Thanks Yuri, This is a great tip. Will definately do that next time!


Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…


If you have Veeam backup failing with the Updating BCD failed with Cannot update SafeBoot flag and SentinelOne is...