多个upgrade系统会累积更多引导分区内核,从而导致以后无法升级。在这种情况下,请使用以下步骤完成引导分区清理。

  1. df确认分区占用情况

root@ksvdm:/home/notes# df

Filesystem 1K-blocks Used Available Use% Mounted on

udev 8140748 0 8140748 0% /dev

tmpfs 1636964 1404 1635560 1% /run

/dev/mapper/VolGroup-root 19986432 8540116 11446316 43% /

tmpfs 8184816 0 8184816 0% /dev/shm

tmpfs 5120 0 5120 0% /run/lock

tmpfs 8184816 0 8184816 0% /sys/fs/cgroup

/dev/sda1 463844 393322 42055 91% /boot

/dev/mapper/VolGroup-data 89847808 7048364 82799444 8% /data

cgmfs 100 0 100 0% /run/cgmanager/fs

ksnas01:/volume1/backup 54447352832 33866582912 20580651136 63% /ksnas01

ksnas02:/volume1/backup 93354240512 40290768128 53063353600 44% /ksnas02

tmpfs 1636960 0 1636960 0% /run/user/1000

ksnas01:/volume1/backup 54447352832 33866610560 20580623488 63% /ksnas01

ksnas02:/volume1/backup 93354240512 40290768128 53063353600 44% /ksnas02

tmpfs 1636960 0 1636960 0% /run/user/1000

2.确认当前内核版本,避免清除当前内核心。

root@ksvdm:/home/notes# uname -r

5.4.0-70-generic

检查所有内核IMAGES.

root@ksvdm:/home/notes# dpkg --get-selections |grep linux-imag

linux-image-5.4.0-65-generic install

linux-image-5.4.0-66-generic install

linux-image-5.4.0-67-generic install

linux-image-5.4.0-70-generic install

linux-image-generic install

linux-image-un deinstall

linux-image-un deinstall


3.分批执行清除非当前内核镜像。

root@ksvdm:/home/notes# apt purge linux-image-5.4.0-65-generic

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following packages were automatically installed and are no longer required:

linux- linux--generic linux- linux--generic linux-image-5.4.0-66-generic linux-module

linux-module linux-module

Use 'sudo apt autoremove' to remove them.

The following packages will be REMOVED:

linux-image-5.4.0-65-generic* linux-module*

0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.

After this operation, 202 MB disk space will be freed.

Do you want to continue? [Y/n] y

(Reading database ... 210603 files and directories currently installed.)

Removing linux-module ) ...

Progress: [ 0%] [......................................................................................................................................................]

Progress: [ 11%] [################......................................................................................................................................]

Progress: [ 22%] [#################################.....................................................................................................................]

Removing linux-image-5.4.0-65-generic ) ...############.....................................................................................................]

Progress: [ 44%] [##################################################################....................................................................................]

/etc/kernel...................................................................]

update-initramfs: Deleting /boo

/etc/kernel:

Searching for GRUB installation directory ... found: /boot/grub

Searching for default file ... found: /boot/grub/default

Testing for an existing GRUB menu.lst file ... found: /boot/grub

Searching for splash image ... none found, skipping ...

Found kernel:

Found kernel:

Found kernel:

Found kernel:

Replacing config file /run/grub with new version

Found kernel:

Found kernel:

Found kernel:

Replacing config file /run/grub with new version

Updating /boot/grub ... done

/etc/kernel:

Sourcing file `/etc/default/grub'

Sourcing file `/etc/defaul;

Generating grub configuration file ...

Found linux image: /boot

Found initrd image: /boo

Found linux image: /boot

Found initrd image: /boo

Found linux image: /boot

Found initrd image: /boo

done

(Reading database ... 205231 files and directories currently installed.)#############################################...................................................]

Purging configuration files for linux-image-5.4.0-65-generic ) ...

rmdir: failed to remove '/lib/module;: Directory not empty

Purging configuration files for linux-module ) ...################################################..................................]

4.在最后执行清理所有不用安装包。

root@ksvdm:/home/notes# apt autoremove --purge

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following packages will be REMOVED:

linux-* linux--generic* linux-* linux--generic* linux-module*

linux-module*

0 upgraded, 0 newly installed, 6 to remove and 0 not upgraded.

After this operation, 318 MB disk space will be freed.

Do you want to continue? [Y/n] y


再后执行执行df验证boot分区大小。

1.《boot硬盘怎么删除吗?终于找到答案了如何清理UbuntuServer boot分区释放空间》援引自互联网,旨在传递更多网络信息知识,仅代表作者本人观点,与本网站无关,侵删请联系页脚下方联系方式。

2.《boot硬盘怎么删除吗?终于找到答案了如何清理UbuntuServer boot分区释放空间》仅供读者参考,本网站未对该内容进行证实,对其原创性、真实性、完整性、及时性不作任何保证。

3.文章转载时请保留本站内容来源地址,https://www.lu-xu.com/gl/3331489.html