In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to release the space of / boot partition on Ubuntu Linux. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
The other day, I received a warning that the / boot partition is almost full and there is no space left. Yes, I have a separate / boot partition, and I'm sure few people do that these days. (LCTT translation note: I think keeping a separate / boot partition is a good operation and maintenance experience. In addition, / tmp and / var are also better delineated separately. )
This is the first time I have seen such a mistake, and it makes me very confused. Now, there are some ways to release partitions on Ubuntu (or Ubuntu-based partitions), but not all of them are available in this case.
That's why I decided to write these steps to free up / boot partition space.
How to free up space in the / boot partition on Ubuntu
I suggest you read these solutions carefully and come up with the one that best suits your situation. Solutions are easy to operate, but you need to implement them carefully on your productivity system.
Method 1: use apt autoremove
You don't have to be a terminal expert to do this, it only requires a command, and you will remove the unused kernel to free up space in the / boot partition.
All you have to do is enter:
Sudo apt autoremove
This command not only removes unused kernels, but also removes dependencies that you don't need or tools that you don't need after installation.
After you enter the command, it will list what will be removed, you just need to confirm the action. If you are curious about what it will remove, you can check it carefully to see what it has actually removed.
Here's what it should look like:
You must press the Y button to continue.
It is worth noting that this method only works if you have a little space left and are warned. However, if your / boot partition is full, APT may not even work.
In the following methods, I will focus on two different methods, through which you can use GUI and terminals to remove the old kernel to free up space.
Method 2: manually remove unused kernels
Before you try to remove some old kernels to free up space, you need to identify the currently active kernel and make sure you don't delete it.
To check the version of your kernel, type the following command in the terminal:
Uname-r
The uname command is usually used to get Linux system information. Here, this command displays the Linux kernel that is currently in use. It should look like this:
Now that you know what your current Linux kernel is, you must remove a kernel that is different from this version. You should record it somewhere so that you don't unwittingly remove it.
Next, to remove it, you can use the terminal or GUI.
Warning!
Extra care must be taken when deleting the kernel. Only identify and delete the old kernel, not the one you are currently using, otherwise you will have a broken system.
Use a GUI tool to remove the old Linux kernel
You can start with the Synaptic package manager or a tool like Stacer. Personally, when I encounter a full / boot partition and the APT is corrupted, I use Stacer to discard the old kernel. So let me show you what it looks like.
First, you need to start Stacer, and then navigate to the package unloader, as shown in the screenshot below.
Here, search for "image" and you will find the Linux kernel you have. You only need to delete the image of the old kernel version, not the image of the current kernel.
In the screenshot above, I have pointed out the current kernel and the old kernel on my system, so you must pay attention to the kernel on your system.
You don't have to delete anything else, just delete the old kernel version.
Similarly, just search for "headers" in the package list and delete the old "headers" version shown below.
As a reminder, you don't want to remove linux-headers-generic. Just pay attention to those related to it that have version numbers.
Then, in this way, you have done all the work, APT will work again, and you will successfully free up some space from the / boot partition. Similarly, you can use any other package manager to do this.
Use the command line to remove the old kernel
Using the command line to remove the old kernel is the same as using GUI to remove the old kernel. So if you don't have the right to choose to use GUI software (if it's a remote machine / a remote service), or if you just have a penchant for terminals, you can follow these steps.
First, list all installed kernels using the following command:
Ls-l / boot
It should look like this:
Kernels marked "old" or that do not match your current kernel version are unused kernels, and you can delete them.
Now, you can use the rm command to remove the kernel specified from the / boot partition, using the following command (a command corresponds to a kernel):
Sudo rm / boot/vmlinuz-5.4.0-7634-generic
Be sure to check the version of the system-this may be different from your system.
If you have a lot of unused kernels, this will take some time. Therefore, you can also discard multiple kernels with the following command:
Sudo rm / boot/*-5.4.0- {7634}-*
For clarity, you need to separate the last part of the kernel version / code with a comma so that you can delete them at the same time.
Assuming that I have two old kernels 5.4.0-7634-generic and 5.4.0-7624, the command would be:
Sudo rm / boot/*-5.4.0- {7634 .7624}-*
If you don't want to see these old kernel versions in the grub startup menu, you can simply update grub with the following command:
Sudo update-grub
In this way, you have finished all the work. You have freed up space and fixed potentially broken APT problems if it is an important problem that occurs after your / boot partition fills up.
In some cases, you need to enter these commands to fix the damage (as I noticed in the forum):
Sudo dpkg-- configure-asudo apt install-f
Note that you do not need to enter the above command unless you find that APT is corrupted. Personally, I don't need these commands, but I find them useful to some people on the forum.
This is the end of this article on "how to release the space of / boot partition on Ubuntu Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.