湖濱散記部落格的樹心幽徑[login][主頁]
380:20180221移除UBUNTU舊版的kernel,以解決boot空間不足的問題。

(一)列出/boot現況
treehrt@hrt:/boot$ ls -la
總計 169844
drwxr-xr-x  4 root root     4096  2月 21 10:42 .
drwxr-xr-x 23 root root     4096  2月 21 10:41 ..
-rw-r--r--  1 root root  1243428 11月 11 04:54 abi-4.4.0-101-generic
-rw-r--r--  1 root root  1243783  1月 19 20:51 abi-4.4.0-112-generic
-rw-r--r--  1 root root  1242417  5月 18  2017 abi-4.4.0-79-generic
-rw-r--r--  1 root root  1243375  8月 12  2017 abi-4.4.0-93-generic
-rw-r--r--  1 root root  1243451 10月 11 00:18 abi-4.4.0-98-generic
-rw-r--r--  1 root root   193845 11月 11 04:54 config-4.4.0-101-generic
-rw-r--r--  1 root root   193873  1月 19 20:51 config-4.4.0-112-generic
-rw-r--r--  1 root root   193751  5月 18  2017 config-4.4.0-79-generic
-rw-r--r--  1 root root   193751  8月 12  2017 config-4.4.0-93-generic
-rw-r--r--  1 root root   193843 10月 11 00:18 config-4.4.0-98-generic
drwxr-xr-x  6 root root     4096  2月 21 10:42 grub
-rw-r--r--  1 root root 36053207  2月 21 10:39 initrd.img-4.4.0-101-generic
-rw-r--r--  1 root root 15035833  2月 21 10:42 initrd.img-4.4.0-79-generic
-rw-r--r--  1 root root 36049493  2月 21 10:40 initrd.img-4.4.0-93-generic
-rw-r--r--  1 root root 36052928  2月 21 10:40 initrd.img-4.4.0-98-generic
drwx------  2 root root    16384  2月  9  2017 lost+found
-rw-r--r--  1 root root   182704  1月 28  2016 memtest86+.bin
-rw-r--r--  1 root root   184380  1月 28  2016 memtest86+.elf
-rw-r--r--  1 root root   184840  1月 28  2016 memtest86+_multiboot.bin
-rw-------  1 root root  3104590 11月 11 04:54 System.map-4.4.0-101-generic
-rw-------  1 root root  3106586  1月 19 20:51 System.map-4.4.0-112-generic
-rw-------  1 root root  3101039  5月 18  2017 System.map-4.4.0-79-generic
-rw-------  1 root root  3103027  8月 12  2017 System.map-4.4.0-93-generic
-rw-------  1 root root  3104419 10月 11 00:18 System.map-4.4.0-98-generic
-rw-------  1 root root  6848480 11月 11 04:54 vmlinuz-4.4.0-101-generic
-rw-------  1 root root  6852192  1月 19 20:51 vmlinuz-4.4.0-112-generic
-rw-------  1 root root  6843104  8月 12  2017 vmlinuz-4.4.0-93-generic
-rw-------  1 root root  6847328 10月 11 00:18 vmlinuz-4.4.0-98-generic


(二)察看最新的kernel版本

treehrt@hrt:/boot$ uname -r
4.4.0-101-generic
treehrt@hrt:/boot$

(三)列出已安裝的kernel
treehrt@hrt:/boot$ dpkg --get-selections|grep linux-image
linux-image-4.4.0-101-generic            install
linux-image-4.4.0-112-generic            install
linux-image-4.4.0-21-generic            deinstall
linux-image-4.4.0-75-generic            deinstall
linux-image-4.4.0-78-generic            deinstall
linux-image-4.4.0-79-generic            deinstall
linux-image-4.4.0-93-generic            deinstall
linux-image-4.4.0-98-generic            install
linux-image-extra-4.4.0-101-generic        install
linux-image-extra-4.4.0-112-generic        install
linux-image-extra-4.4.0-21-generic        deinstall
linux-image-extra-4.4.0-75-generic        deinstall
linux-image-extra-4.4.0-78-generic        deinstall
linux-image-extra-4.4.0-79-generic        deinstall
linux-image-extra-4.4.0-93-generic        deinstall
linux-image-extra-4.4.0-98-generic        install
linux-image-generic                install

(四)刪除不需要的舊版kernel
treehrt@hrt:/boot$ sudo apt-get purge linux-image-4.4.0-98-generic install
[sudo] password for treehrt:
正在讀取套件清單... 完成
正在重建相依關係         
正在讀取狀態資料... 完成
E: 找不到套件 install
treehrt@hrt:/boot$

(五)察看磁碟空間
treehrt@hrt:/boot$ df
檔案系統       1K-區段    已用    可用 已用% 掛載點
udev           1986832       0 1986832    0% /dev
tmpfs           400984   11476  389508    3% /run
/dev/sdc2      4674688  804796 3609388   19% /
/dev/sdc7      8518920 3867136 4196004   48% /usr
tmpfs          2004900   32708 1972192    2% /dev/shm
tmpfs             5120       4    5116    1% /run/lock
tmpfs          2004900       0 2004900    0% /sys/fs/cgroup
/dev/sdc5      4673664 1695000 2718212   39% /home
/dev/sdc8      4673664  802772 3610440   19% /var
/dev/sdc6       944120    1360  877584    1% /tmp
/dev/sdc1       348960  124048  190736   40% /boot
tmpfs           400984      72  400912    1% /run/user/1000

(六)再列出/boot現況

treehrt@hrt:/boot$ ls -la
總計 104388
drwxr-xr-x  4 root root     4096  2月 21 10:43 .
drwxr-xr-x 23 root root     4096  2月 21 10:41 ..
-rw-r--r--  1 root root  1243428 11月 11 04:54 abi-4.4.0-101-generic
-rw-r--r--  1 root root  1243783  1月 19 20:51 abi-4.4.0-112-generic
-rw-r--r--  1 root root  1243451 10月 11 00:18 abi-4.4.0-98-generic
-rw-r--r--  1 root root   193845 11月 11 04:54 config-4.4.0-101-generic
-rw-r--r--  1 root root   193873  1月 19 20:51 config-4.4.0-112-generic
-rw-r--r--  1 root root   193843 10月 11 00:18 config-4.4.0-98-generic
drwxr-xr-x  6 root root     4096  2月 21 10:43 grub
-rw-r--r--  1 root root 36053207  2月 21 10:39 initrd.img-4.4.0-101-generic
-rw-r--r--  1 root root 36052928  2月 21 10:40 initrd.img-4.4.0-98-generic
drwx------  2 root root    16384  2月  9  2017 lost+found
-rw-r--r--  1 root root   182704  1月 28  2016 memtest86+.bin
-rw-r--r--  1 root root   184380  1月 28  2016 memtest86+.elf
-rw-r--r--  1 root root   184840  1月 28  2016 memtest86+_multiboot.bin
-rw-------  1 root root  3104590 11月 11 04:54 System.map-4.4.0-101-generic
-rw-------  1 root root  3106586  1月 19 20:51 System.map-4.4.0-112-generic
-rw-------  1 root root  3104419 10月 11 00:18 System.map-4.4.0-98-generic
-rw-------  1 root root  6848480 11月 11 04:54 vmlinuz-4.4.0-101-generic
-rw-------  1 root root  6852192  1月 19 20:51 vmlinuz-4.4.0-112-generic
-rw-------  1 root root  6847328 10月 11 00:18 vmlinuz-4.4.0-98-generic
treehrt@hrt:/boot$



(七)重新產生grub開機選單

treehrt@hrt:~$ sudo update-grub
[sudo] password for treehrt:
正在產生 grub 設定檔 ...
找到 linux 映像檔:/boot/vmlinuz-4.4.0-112-generic
找到 linux 映像檔:/boot/vmlinuz-4.4.0-101-generic
找到 initrd 映像檔:/boot/initrd.img-4.4.0-101-generic
找到 linux 映像檔:/boot/vmlinuz-4.4.0-98-generic
找到 initrd 映像檔:/boot/initrd.img-4.4.0-98-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
找到 Windows 7 (loader) [於 /dev/sda1]
找到 Windows Recovery Environment (loader) [於 /dev/sda2]
找到 Windows 7 (loader) [於 /dev/sda3]
完成
treehrt@hrt:~$


select id,article_id,topic,text from lt_articles_text where article_id =380; ok. update lt_articles set num_reads=num_reads +1 where id=380; ok.