1. 查看磁盘占用情况

df -h 

Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p5  181M  141M   27M  85% /boot
/dev/nvme0n1p8   71G   26G   41G  39% /home
/dev/nvme0n1p1   96M   48M   49M  50% /boot/efi
tmpfs           1.6G   16K  1.6G   1% /run/user/121
tmpfs           1.6G   44K  1.6G   1% /run/user/1000

发现/boot确实占用率很高。

2. uname -a (查看当前使用的内核版本)

lenmom@M1701:~$ uname -a
Linux M1701 4.15.--generic #-Ubuntu SMP Thu Dec :: UTC x86_64

3.查看已安装的内核版本

lenmom@M1701:~$ dpkg --get-selections |grep linux
binutils-x86--linux-gnu install
console-setup-linux install
libselinux1:amd64 install
linux-base install
linux-firmware install
linux-generic install
linux-headers-4.15.- install
linux-headers-4.15.--generic install
linux-headers-4.15.- install
linux-headers-4.15.--generic install
linux-headers-generic install
linux-image-4.15.--generic deinstall
linux-image-4.15.--generic install
linux-image-4.15.--generic install
linux-image-generic install
linux-libc-dev:amd64 install
linux-modules-4.15.--generic deinstall
linux-modules-4.15.--generic install
linux-modules-4.15.--generic install
linux-modules-extra-4.15.--generic deinstall
linux-modules-extra-4.15.--generic install
linux-modules-extra-4.15.--generic install
linux-signed-generic install
linux-sound-base install
pptp-linux install
syslinux install
syslinux-common install
syslinux-legacy install
util-linux install

能看到已经安装的版本,其中带image的一般就是旧版本,其中

a)deinstall代表是已经删除的旧版本
b)  install是还没有删除的旧版本内核​​

4. 删除多余的内核文件

通过uname -a可以查看到当前正在使用的内核版本,把不是当前版本的处于install状态的image-xxx-generic文件卸载掉,对于本例中linux-modules-extra-4.15.0-39-generic是多余的内核文件,正在使用的是linux-modules-extra-4.15.0-43-generic,开始卸载。

卸载命令为sudo apt-get remove linux-modules-xxx-generic,其中xxx为要卸载的内核版本号

lenmom@M1701:~$ sudo apt-get remove linux-modules-4.15.--generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
linux-image-4.15.--generic linux-modules-4.15.--generic
upgraded, newly installed, to remove and not upgraded.
not fully installed or removed.
After this operation, 74.6 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... files and directories currently installed.)
Removing linux-image-4.15.--generic (4.15.-39.42) ...
I: /vmlinuz.old is now a symlink to boot/vmlinuz-4.15.--generic
I: /initrd.img.old is now a symlink to boot/initrd.img-4.15.--generic
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-4.15.--generic
/etc/kernel/postrm.d/zz-update-grub:
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.15.--generic
Found initrd image: /boot/initrd.img-4.15.--generic
Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
done
Removing linux-modules-4.15.--generic (4.15.-39.42) ...
Setting up initramfs-tools (.130ubuntu3.) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (.130ubuntu3.) ...
update-initramfs: Generating /boot/initrd.img-4.15.--generic
W: APT had planned for dpkg to do more than it reported back ( vs ).
Affected packages: initramfs-tools:amd64

u can execute the following command to ensure all useless files are deleted:

sudo dpkg -P linux-modules-4.15.0-46-generic     -- the kernel name depend to your concret condition

5. 使用du -h再次查看/boot空间

lenmom@M1701:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/nvme0n1p5 181M 75M 94M % /boot
/dev/nvme0n1p8 71G 26G 41G % /home
/dev/nvme0n1p1 96M 48M 49M % /boot/efi
tmpfs .6G 16K .6G % /run/user/
tmpfs .6G 44K .6G % /run/user/

我们发现,/boot空间的确已经释放出来了。

ubuntu18.04 LTS解决/boot空间不足的更多相关文章

  1. ubuntu18.04 lts重装VMware Tools实现主机文件共享等功能

    ubuntu18.04 lts重装VMware Tools实现主机文件共享等功能 在VMWare 14.x上安装ubunuu18.04 lts后发现,可以实现全屏显示,但是没有与主机共享文件的功能,然 ...

  2. Ubuntu-18.04 LTS UEFI 安装U盘制作

    要把U盘作为UEFI启动盘,第一个分区要为FAT32分区,EFI程序放在/EFI/Boot/bootx64.efi.为了制作Ubuntu-18.04 LTS安装U盘,可以把一个U盘格式化为FAT32格 ...

  3. Ubuntu18.04 LTS x64 构建ARM交叉编译环境(尝试,但失败了!!!估计是编译器没选对)

    [测试而已,由于需要了解编译器和处理器体系,因此先放弃该方法] 动机 入门嵌入式开发,又需要 Windows 又需要 Linux,但资料给的竟然是 Ubuntu9,导致我不能使用 VSCode Rem ...

  4. linux系统解决boot空间不足

    有时候更新Linux系统是会碰到boot空间不足的错误,原因基本上是安装时boot空间设置问题可以通过删除旧的内核来释放boot空间. ubuntu: 1.查看当前使用内核版本号       unam ...

  5. Ubuntu18.04 LTS 搭建Cassandra集群

    环境需求 jdk8 root@node01:~# java -version java version "1.8.0_202" Java(TM) SE Runtime Enviro ...

  6. ubuntu16.04 解决boot空间不足

    1. dpkg --get-selections |grep linux-image #查看已安装内核版本号 2. uname -a #查看现运行版本 3. sudo apt-get purge 版本 ...

  7. 解决boot空间不足问题

    uname -a :查看现在系统信息,内核版本 dpkg --get-selections |grep linux-image : 查看内核列表 sudo apt-get remove linux-i ...

  8. Ubuntu18.04 LTS 安装部署golang最新版本1.10

    1 步骤 //1 直接安装golang-go 目前最新版本是1.10 sudo apt-get install golang-go //2 向/etc/profile追加以下代码 sudo vim / ...

  9. ubuntu18.04+win10解决时钟不同步办法

    安装ntpdate: 执行命令: sudo apt-get install ntpdate 设置校正服务器: sudo ntpdate time.windows.com 设置硬件时间为本地时间: 执行 ...

随机推荐

  1. Could not get lock /var/lib/dpkg/lock的解决方法

    E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) E: Unable to ...

  2. python之路---08 文件操作

    二十六.   文件 f = open(文件路径,mode = '模式',encoding = '编码格式') 1.基础 ① 读写时,主要看光标的位置 ②操作完成要写    f.close( ) f.f ...

  3. oauth 2.0 授权流程图

    1.授权码模式(authorization code) 7 步  后面 拿到授权码以后,就是向 资源服务器请求资源了. 2.简化模式(implicit): 在上面的第4 步的返回中,已经包含了 acc ...

  4. bzoj 2216 [Poi2011]Lightning Conductor——单调队列+二分处理决策单调性

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=2216 那个关于位置的代价是带根号的,所以随着距离的增加而增长变慢:所以靠后的位置一旦比靠前的 ...

  5. java 加载数据库驱动

    JDBC编程步骤见 JDBC编程步骤 JDBC编程的第一步是加载数据库驱动,使用Class类的forName()方法,Class.forName("com.mysql.jdbc.Driver ...

  6. py-day2-1 python 列表类 list的调用反法

    # append() 追加 [在原来值最后追加] test = [1,2,3,[88,99],'abc'] test.append(') print(test) [1, 2, 3, [88, 99], ...

  7. MySQL存储过程-->通过游标遍历和异常处理迁移数据到历史表

    -- 大表数据迁移,每天凌晨1点到5点执行,执行间隔时间10分钟,迁移旧数据到历史表. DELIMITER $$ USE `dbx`$$ DROP PROCEDURE IF EXISTS `pro_x ...

  8. spring boot 热更新配置

    maven添加 spring-boot-devtools 允许自动构建 设置里面,搜索compiler,在Build,Execution,Deployment里面勾选Build project aut ...

  9. QT使用SQLite

    在QT的widget中用tableview显示sqlite数据库表中的内容. 用QTcreator创建一个基于Widget类的窗口,再拖一个tableview到widget中,保存. 1.在widge ...

  10. nginx 隐藏 index.php

    使用情景如下: 在访问 http://php.cc/Att/AttList 的时候.跳转到 http://php.cc/index.php/Att/AttList : 也就是开启重写功能: 在ngin ...