解决Ubuntu 下提示boot分区空间不足的办法-zabbix
解决Ubuntu 16.04下提示boot分区空间不足的办法
[BEGIN] 2018/3/7 15:51:43
Last login: Wed Mar 7 05:06:17 2018 from 10.2.202.39
######## ### ######## ######## #### ## ##
## ## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ## ##
## ## ## ######## ######## ## ###
## ######### ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ## ##
######## ## ## ######## ######## #### ## ##
#解决办法
#将不用的内核文件删除,释放空间
#一、查看已安装的内核dpkg --get-selections |grep linux-image
#后面带deinstall的为已删除的内核,可以忽略
root@zabbix:~# dpkg --get-selections |grep linux-image
linux-image-4.4.0-101-generic install
linux-image-4.4.0-103-generic install
linux-image-4.4.0-104-generic install
linux-image-4.4.0-108-generic install
linux-image-4.4.0-109-generic install
linux-image-4.4.0-112-generic install
linux-image-4.4.0-116-generic install
linux-image-4.4.0-87-generic deinstall
linux-image-4.4.0-96-generic install
linux-image-4.4.0-97-generic install
linux-image-4.4.0-98-generic install
linux-image-extra-4.4.0-101-generic install
linux-image-extra-4.4.0-103-generic install
linux-image-extra-4.4.0-104-generic install
linux-image-extra-4.4.0-108-generic install
linux-image-extra-4.4.0-109-generic install
linux-image-extra-4.4.0-112-generic install
linux-image-extra-4.4.0-116-generic install
linux-image-extra-4.4.0-87-generic deinstall
linux-image-extra-4.4.0-96-generic install
linux-image-extra-4.4.0-97-generic install
linux-image-extra-4.4.0-98-generic install
linux-image-generic install
#二、使用uname -a查看自己当前启动的是哪个内核
root@zabbix:~# uname -a
Linux zabbix 4.4.0-97-generic #120-Ubuntu SMP Tue Sep 19 17:28:18 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
#从输出可知我们当前启动的内核是4.4.0-97-generic
#三、运行apt-get remove命令卸载其他内核,为了保险起见,保留最近的一两个版本。
#如提示有未卸载干净的可以执行sudo apt-get remove来卸载。
root@zabbix:~# apt-get remove linux-image-4.4.0-116-generic
root@zabbix:~# apt-get remove linux-image-4.4.0-101-generic
root@zabbix:~# apt-get remove linux-image-4.4.0-103-generic
root@zabbix:~# apt-get remove linux-image-4.4.0-104-generic
root@zabbix:~# apt-get remove linux-image-4.4.0-108-generic
root@zabbix:~# apt-get remove linux-image-4.4.0-109-generic
root@zabbix:~# apt-get remove linux-image-4.4.0-112-generic
root@zabbix:~# apt-get remove linux-image-4.4.0-116-generic
root@zabbix:~# dpkg --get-selections |grep linux-image
linux-image-4.4.0-101-generic deinstall
linux-image-4.4.0-103-generic deinstall
linux-image-4.4.0-104-generic deinstall
linux-image-4.4.0-108-generic deinstall
linux-image-4.4.0-109-generic deinstall
linux-image-4.4.0-112-generic deinstall
linux-image-4.4.0-116-generic deinstall
linux-image-4.4.0-87-generic deinstall
linux-image-4.4.0-96-generic install
linux-image-4.4.0-97-generic install
linux-image-4.4.0-98-generic install
linux-image-extra-4.4.0-101-generic deinstall
linux-image-extra-4.4.0-103-generic deinstall
linux-image-extra-4.4.0-104-generic deinstall
linux-image-extra-4.4.0-108-generic deinstall
linux-image-extra-4.4.0-109-generic deinstall
linux-image-extra-4.4.0-112-generic deinstall
linux-image-extra-4.4.0-116-generic deinstall
linux-image-extra-4.4.0-87-generic deinstall
linux-image-extra-4.4.0-96-generic install
linux-image-extra-4.4.0-97-generic install
linux-image-extra-4.4.0-98-generic install
#删除完检查一下boot空间已经出来了
root@zabbix:~# df -l
Filesystem 1K-blocks Used Available Use% Mounted on
udev 8195228 0 8195228 0% /dev
tmpfs 1643256 95080 1548176 6% /run
/dev/mapper/zabbix--vg-root 203528040 68262368 126905900 35% /
tmpfs 8216268 0 8216268 0% /dev/shm
tmpfs 5120 0 5120 0% /run/lock
tmpfs 8216268 0 8216268 0% /sys/fs/cgroup
/dev/sda1 482922 184420 273568 41% /boot