阐述备份Linux内核步骤
创始人
2024-06-13 08:51:48
0

随着学习Suse的深入,面临的问题也是越来越多,Suse编译内核是非常头疼的,今天编译Suse 10.2内核直接导致Suse面临重装,要是备份Linux内核就好了,备份Linux内核相当的简单,下面就是步骤,英文也很简单,相信准备对内核有所动作的人都能轻易看懂。虽然是针对Suse写的,其它Linux发行版本也大同小异,下面就是备份Linux内核的简单步骤:

 

  1. 1) open terminal  
  2.  
  3. 2) su to root  
  4.  
  5. 3) change directory to /boot  
  6. #cd /boot  
  7.  
  8. 4) see what are the names of running kernels  
  9. #ls  
  10.  
  11. 5) make backup copy of your kernel and System.map  
  12. #cp vmlinuz-2.6.18.8-0.1-default vmlinuz-2.6.18.8-0.1-bak  
  13. #cp System.map-2.6.18.8-0.1-default System.map-2.6.18.8-0.1-bak  
  14. #cp -R /lib/modules/2.6.18.8-0.1-default /lib/modules/2.6.18.8-0.1-bak  
  15.  
  16. 6) create initrd  
  17. #mkinitrd -s 1024×768  
  18.  
  19. 7) check if new initrd was created:  
  20. #ls  
  21. and look for initrd-2.6.18.8-0.1-bak  
  22.  
  23. 8) make backup of your current GRUB menu (in the case that you may screw up editing)  
  24. #cp /boot/grub/menu.lst /boot/grub/menu.lst_bak  
  25.  
  26. 9) edit grub menu whatever editor (I use vi, but you may use kedit.gedit, joe, pico and so on as long as you run editor with root privileges)  
  27. boot/grub/menu.lst  
  28.  
  29. 10) add new entry at the end of the file (copy original entry for Suse Linux 10.2):  
  30. title Suse Linux 10.2 kernel backup  
  31. root (hd0,0)  
  32. kernel /vmlinuz-2.6.18.8-0.1-bak root=/dev/sda2 vga=0×317 vga=normal video=vesa:1024×768@60 resume=/dev/sda3 elevator=deadline splash=silent showopts  
  33. initrd /initrd-2.6.18.8-0.1-bak  
  34. important changes are marked bold. You may not have the other stuff or it may be different. Simply keep the rest of the file exactly the same as in the original entry for Suse Linux 10.2  
  35.  
  36. 11) save the file  
  37.  
  38. 12) restart computer and select from GRUB menu “Suse Linux 10.2 kernel backup”  
  39. if system boots successfully you have working kernel backup, now if Suse updates kernel next time and new kernel will not boot properly, you can always boot to Suse Linux 10.2 kernel backup which will never be modified (and safe from screwed updates)  
  40.  
  41. 举一反三的令一种方法:  
  42. ideally would be do something different:  
  43. 1) install kernel sources  
  44.  
  45. 2) su to root  
  46.  
  47. 3) copy kernel sources to the new direcory:  
  48. #cp -R /usr/src/Linux-2.6.18.8-0.1 /usr/src/Linux-2.6.18.8-0.1-bak  
  49.  
  50. 4) change directory to /usr/src/Linux-2.6.18.8-0.1-bak  
  51. #cd /usr/src/Linux-2.6.18.8-0.1-bak  
  52.  
  53. 5) create config file  
  54. #make oldconfig  
  55.  
  56. 6) change kernel name (super important!!!)  
  57. by editing .config file (in /usr/src/Linux-2.6.18.8-0.1-bak) Tehre is a dot before “config”  
  58. scroll down to the line:  
  59. #  
  60. # General setup  
  61. #  
  62. CONFIG_LOCALVERSION=”"  
  63. and change local kernel name version by adding:  
  64. CONFIG_LOCALVERSION=”-bak”  
  65. if there is anything already written in the line  
  66. CONFIG_LOCALVERSION=”"  
  67. delete old name remember that new name must have quotation marks.  
  68.  
  69. 7) save file  
  70.  
  71. 8) compile kernel  
  72. #make bzImage && make modules && make modules_install && make install  
  73. You just created a new kernel! Exactly the same as the running one but the name will have “-bak” at the end  
  74. there is nothing more required. in your GRUB menu will appear a new entry pointing to the new kernel. Old kernel will not be affected (if you did exactly as I suggested)  
  75. new kernel is invisible to Yast and will never be changed.  
  76. Because the latest kernel upgrade is a real disaster I would make backup copy of grub menu (as root):  
  77. #cp /boot/grub/menu.lst /boot/grub/menu.lst_bak  
  78. now you can boot to the new kernel  
  79. you will get to command line (when booting to the new kernel) if you installed nvidia/ati drivers,  
  80. That is easy to fix of course. what is important, you have working Suse setup in spite of all Suse devs efforts to screw you up  

通过我的介绍,这篇简单的备份Linux内核的文章会对你有帮助。其实我的主要目的就是提醒各位应用Linux的朋友,记得要备份Linux内核。

【编辑推荐】

  1. SUSE Linux 10的虚拟化:Xen
  2. 实操Suse防火墙配置
  3. Suse Linux整理大全:快捷键
  4. 学习手札:加强Suse Linux操作系统安全
  5. 详解Suse Postfix配置解法

相关内容

热门资讯

如何允许远程连接到MySQL数... [[277004]]【51CTO.com快译】默认情况下,MySQL服务器仅侦听来自localhos...
如何利用交换机和端口设置来管理... 在网络管理中,总是有些人让管理员头疼。下面我们就将介绍一下一个网管员利用交换机以及端口设置等来进行D...
施耐德电气数据中心整体解决方案... 近日,全球能效管理专家施耐德电气正式启动大型体验活动“能效中国行——2012卡车巡展”,作为该活动的...
20个非常棒的扁平设计免费资源 Apple设备的平面图标PSD免费平板UI 平板UI套件24平图标Freen平板UI套件PSD径向平...
德国电信门户网站可实时显示全球... 德国电信周三推出一个门户网站,直观地实时提供其安装在全球各地的传感器网络检测到的网络攻击状况。该网站...
为啥国人偏爱 Mybatis,... 关于 SQL 和 ORM 的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行...
《非诚勿扰》红人闫凤娇被曝厕所... 【51CTO.com 综合消息360安全专家提醒说,“闫凤娇”、“非诚勿扰”已经被黑客盯上成为了“木...
2012年第四季度互联网状况报... [[71653]]  北京时间4月25日消息,据国外媒体报道,全球知名的云平台公司Akamai Te...