Ask Your Question

How to remove old versions of fedora?

asked 2015-07-22 00:04:32 -0500

romitheguru gravatar image

updated 2015-11-10 22:29:29 -0500

mether gravatar image

hello all! I just upgraded my fedora desktop from 20 to 22. Now after upgrading, a little disk space it left, so questions are--

  1. is there some way to get disk space back without removing upgrades?
  2. if I need to delete older versions of fedora (Note: it already has fedora 19,20,22), is there any way to do it safely?

Please, suggest some good and easy steps to follow, cause I don't know much about linux. Thanks

edit retag flag offensive close merge delete



How did you exactly upgraded Fedora? And do you really have older versions of Fedora or just their kernel?! (How many Fedora partitions you have?! the output of fdisk -l /dev/sda can be helpful)

hedayat gravatar imagehedayat ( 2015-07-22 01:32:31 -0500 )edit

I upgraded it using fedup, and those are kernels that I still have. I have 3 partitions and I have given fedora root and home about 12 GB and now its 1.5 GB left. I need to know is it safe to remove old kernels or packages. I also have other partitions combined upto 200 GB. Is there any way to extend the /home.

romitheguru gravatar imageromitheguru ( 2015-07-25 12:28:53 -0500 )edit

They're just old kernels, not the whole distro. They will be replaced as you update.

randomuser gravatar imagerandomuser ( 2015-07-26 22:36:23 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2015-07-26 12:57:36 -0500

hedayat gravatar image

OK, so you have a single version of Fedora (Fedora 22), but with some packages from older versions of Fedora. specially the kernels.

About the kernels: if you successfully boot your system using latest f22 kernel, you can safely remove all other kernels. You can either select kernels based on their versions, for example to remove all kernel-3.x.x packages:

dnf remove kernel-3*

Or use package-cleanup to automatically remove all but the latest kernel:

package-cleanup --oldkernels

About other packages: if fedup has finished completely & successfully, you should not have many of older packages installed anymore. Fedora does NOT keep old packages when upgrading (kernel is a different story), unless they are needed by some third-party package(s). First of all you should see if there are any duplicate packages:

package-cleanup --dupes

This command will list all packages for which you have multiple versions installed simultaneously. If there were any, you should see why they are kept. If they are not needed by any third-party packages, you should be able to safely remove them. The proper way to remove unneeded duplicate packages are already answered in some other questions, but I doubt this is your problem (unless fedup did not finished successfully?).

If you did not have many packages installed in your Fedora 20 and you expect more free space in your / partition, it is likely that the space is taken by some temporary and/or cache files. You should check the space usage of different directories to understand which directory is taking extra space. You can do it with the following command:

du -hs /*
edit flag offensive delete link more


i removed the old kernels successfully , and now I can see the difference in the grub menu. I also checked if there are any left over packages but fortunately there is none. Thanks for that, but what I am confused about now is my home storage is running out --- what I mean is before upgrade it was about 3GB left, after upgrade it was showing about 1GB left, today i was running parted from rescue mode in order to extend home partition, however it was an unsuccessful attempt, but the thing is now it showing only 258 MB left, please help in this regard.

romitheguru gravatar imageromitheguru ( 2015-07-27 02:29:35 -0500 )edit

So the problem is about your /home partition rather than /, right? (Are they separete?) Please give me the output of following commands:

df -h
du -hs /home/*/*

BTW, if you have 12GB for both /home and /, and you use your Fedora seriously, it is likely that you need more free space!

There is also a GUI application called Disk Usage Analyzer which you can use to determine which directories use most of the disk space.

hedayat gravatar imagehedayat ( 2015-07-27 03:10:06 -0500 )edit

Here is the output of df -h

[lucifer@localhost ~]$ df -h
Filesystem   Size  Used Avail Use% Mounted on
devtmpfs      921M     0  921M   0% /dev
tmpfs           931M   72K  931M   1% /dev/shm
tmpfs           931M  1.1M  930M   1% /run
tmpfs           931M     0  931M   0% /sys/fs/cgroup
/dev/mapper/fedora-root   11G  7.6G  2.5G  76% /
tmpfs           931M   76K  931M   1% /tmp
/dev/sda4     477M  113M  336M  26% /boot
tmpfs           187M     0  187M   0% /run/user/995
tmpfs           187M   12K  187M   1% /run/user/1000
romitheguru gravatar imageromitheguru ( 2015-07-27 07:38:13 -0500 )edit

If the question is about growing your root or home filesystem, please review existing questions, and if needed, comment on one asking for clarification. If you don't find one that seems appropriate, open a new question. Keeping on topic within a question (this one's about removing kernels) helps others find existing questions that address their problems.

randomuser gravatar imagerandomuser ( 2015-07-27 07:56:11 -0500 )edit

OK, so you have 7.6G used space, which doesn't look too much for a typical Fedora installation. Again, you should check du -hs /* output of use "Disk Usage Analyzer" to understand which directories are big, and if there is anything to be removed. I don't think that the used space is increase significantly because of the update.

As @randomuser said, if you want to enlarge your Fedora partition you should check other questions. Specially since you are using LVM, it is usually fairly easy and safe to resize the partition.

hedayat gravatar imagehedayat ( 2015-07-27 08:02:49 -0500 )edit

Question Tools

1 follower


Asked: 2015-07-22 00:04:32 -0500

Seen: 16,878 times

Last updated: Jul 26 '15