随着学习Suse的深入,面临的问题也是越来越多,Suse编译内核是非常头疼的,今天编译Suse 10.2内核直接导致Suse面临重装,要是备份Linux内核就好了,本文就是介绍备份Linux内核的简单步骤。

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

阐述备份Linux内核步骤(如何备份内核)  备份Linux内核 第1张

  1. 1)openterminal
  2. 2)sutoroot
  3. 3)changedirectoryto/boot
  4. #cd/boot
  5. 4)seewhatarethenamesofrunningkernels
  6. #ls
  7. 5)makebackupcopyofyourkernelandSystem.map
  8. #cpvmlinuz-2.6.18.8-0.1-defaultvmlinuz-2.6.18.8-0.1-bak
  9. #cpSystem.map-2.6.18.8-0.1-defaultSystem.map-2.6.18.8-0.1-bak
  10. #cp-R/lib/modules/2.6.18.8-0.1-default/lib/modules/2.6.18.8-0.1-bak
  11. 6)createinitrd
  12. #mkinitrd-s1024×768
  13. 7)checkifnewinitrdwascreated:
  14. #ls
  15. andlookforinitrd-2.6.18.8-0.1-bak
  16. 8)makebackupofyourcurrentGRUBmenu(inthecasethatyoumayscrewupediting)
  17. #cp/boot/grub/menu.lst/boot/grub/menu.lst_bak
  18. 9)editgrubmenuwhatevereditor(Iusevi,butyoumayusekedit.gedit,joe,picoandsoonaslongasyouruneditorwithrootprivileges)
  19. boot/grub/menu.lst
  20. 10)addnewentryattheendofthefile(copyoriginalentryforSuseLinux10.2):
  21. titleSuseLinux10.2kernelbackup
  22. root(hd0,0)
  23. kernel/vmlinuz-2.6.18.8-0.1-bakroot=/dev/sda2vga=0×317vga=normalvideo=vesa:1024×768@60resume=/dev/sda3elevator=deadlinesplash=silentshowopts
  24. initrd/initrd-2.6.18.8-0.1-bak
  25. importantchangesaremarkedbold.Youmaynothavetheotherstufforitmaybedifferent.SimplykeeptherestofthefileexactlythesameasintheoriginalentryforSuseLinux10.2
  26. 11)savethefile
  27. 12)restartcomputerandselectfromGRUBmenu“SuseLinux10.2kernelbackup”
  28. ifsystembootssuccessfullyyouhaveworkingkernelbackup,nowifSuseupdateskernelnexttimeandnewkernelwillnotbootproperly,youcanalwaysboottoSuseLinux10.2kernelbackupwhichwillneverbemodified(andsafefromscrewedupdates)
  29. 举一反三的令一种方法:
  30. ideallywouldbedosomethingdifferent:
  31. 1)installkernelsources
  32. 2)sutoroot
  33. 3)copykernelsourcestothenewdirecory:
  34. #cp-R/usr/src/Linux-2.6.18.8-0.1/usr/src/Linux-2.6.18.8-0.1-bak
  35. 4)changedirectoryto/usr/src/Linux-2.6.18.8-0.1-bak
  36. #cd/usr/src/Linux-2.6.18.8-0.1-bak
  37. 5)createconfigfile
  38. #makeoldconfig
  39. 6)changekernelname(superimportant!!!)
  40. byediting.configfile(in/usr/src/Linux-2.6.18.8-0.1-bak)Tehreisadotbefore“config”
  41. scrolldowntotheline:
  42. #
  43. #Generalsetup
  44. #
  45. CONFIG_LOCALVERSION=”"
  46. andchangelocalkernelnameversionbyadding:
  47. CONFIG_LOCALVERSION=”-bak”
  48. ifthereisanythingalreadywrittenintheline
  49. CONFIG_LOCALVERSION=”"
  50. deleteoldnamerememberthatnewnamemusthavequotationmarks.
  51. 7)savefile
  52. 8)compilekernel
  53. #makebzImage&&makemodules&&makemodules_install&&makeinstall
  54. Youjustcreatedanewkernel!Exactlythesameastherunningonebutthenamewillhave“-bak”attheend
  55. thereisnothingmorerequired.inyourGRUBmenuwillappearanewentrypointingtothenewkernel.Oldkernelwillnotbeaffected(ifyoudidexactlyasIsuggested)
  56. newkernelisinvisibletoYastandwillneverbechanged.
  57. BecausethelatestkernelupgradeisarealdisasterIwouldmakebackupcopyofgrubmenu(asroot):
  58. #cp/boot/grub/menu.lst/boot/grub/menu.lst_bak
  59. nowyoucanboottothenewkernel
  60. youwillgettocommandline(whenbootingtothenewkernel)ifyouinstallednvidia/atidrivers,
  61. Thatiseasytofixofcourse.whatisimportant,youhaveworkingSusesetupinspiteofallSusedevseffortstoscrewyouup

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

【编辑推荐】

  1. SUSE Linux 10的虚拟化:Xen
  2. 实操Suse防火墙配置
  3. Suse Linux整理大全:快捷键
  4. 学习手札:加强Suse Linux操作系统安全
  5. 详解Suse Postfix配置解法
转载请说明出处
知优网 » 阐述备份Linux内核步骤(如何备份内核)

发表评论

您需要后才能发表评论