Thursday, April 12, 2012

How to remove old kernel

เมื่อมีการแบ่ง /boot ออกมาอีกพาทิชั่นหนึ่ง พอใช้งานไปนาน ๆ ก็จะมีการอัพเดต kernel ใหม่หลายเวอร์ชั่นจนบางครั้งทำให้ /boot เต็มไม่สามารถอัพเดต kernel ใหม่ ๆ ได้จึงต้องเอา kernel เก่า ๆ ออกไปโดยก่อนที่จะ remove old kernel นั้นจะต้องตรวจสอบก่อนว่า kernel ที่ใช้ปัจจุบันเวอร์ชั่นอะไร
uname -a
จะได้ผลลัพธ์ประมาณนี้
Linux unix-tip 2.6.38-14-generic #58-Ubuntu SMP Mon Mar 5 18:29:54 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
ซึ่งจะพบว่า kernel version คือ 2.6.38-14-generic #58
ต่อไปเป็นคำสั่งในการตรวจสอบว่าในเครื่องมี kernel version อะไรอยู่บ้าง
dpkg -l | grep linux-image
จะได้ออกมาประมาณนี้
ii  linux-image-2.6.38-11-generic         2.6.38-11.50                               Linux kernel image for version 2.6.38 on x86/x86_64
ii  linux-image-2.6.38-12-generic         2.6.38-12.51                               Linux kernel image for version 2.6.38 on x86/x86_64
ii  linux-image-2.6.38-13-generic         2.6.38-13.57                               Linux kernel image for version 2.6.38 on x86/x86_64
ii  linux-image-2.6.38-14-generic         2.6.38-14.58                               Linux kernel image for version 2.6.38 on x86/x86_64
ii  linux-image-generic                   2.6.38.14.29                               Generic Linux kernel image
Now can remove kernel version 2.6.38-11 , 2.6.38-12 , and 2.6.38-13 by command line
sudo apt-get --purge remove linux-image-2.6.38-11-generic linux-image-2.6.38-12-generic linux-image-2.6.38-13-generic

หลังจากนั้นอาจจะใช้คำสั่งนี้ เพื่อลบ header file or unused application
sudo apt-get autoremove

No comments:

Post a Comment