{"id":174201,"date":"2020-03-10T08:18:59","date_gmt":"2020-03-10T00:18:59","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=174201"},"modified":"2020-03-25T19:50:24","modified_gmt":"2020-03-25T11:50:24","slug":"centos7-grub2-boot-option","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/centos7-grub2-boot-option.html","title":{"rendered":"\u5982\u4f55\u5728Centos7\u4e2d\u6dfb\u52a0GRUB2\u542f\u52a8\u9879"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n GRUB2\u662fCentos7\u7684\u9ed8\u8ba4\u5f15\u5bfc\u52a0\u8f7d\u7a0b\u5e8f\u3002\u5b83\u53ef\u4ee5\u8f7b\u677e\u5730\u52a0\u8f7d\u6240\u6709\u7684Linux\u53d1\u884c\u7248\u548c\u5176\u4ed6\u64cd\u4f5c\u7cfb\u7edf\u3002\u5b83\u63d0\u4f9b\u4e00\u4e2a\u83dc\u5355\u663e\u793a\u6240\u6709\u7684\u64cd\u4f5c\u7cfb\u7edf\u3002GRUB2\u5177\u6709\u9ad8\u7ea7\u7279\u6027\u4ee5\u53ca\u4e00\u4e9b\u57fa\u672c\u7279\u6027\uff0c\u4f7f\u5176\u5728\u6240\u6709Linux\u4e0a\u90fd\u6709\u6548\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u5982\u4f55\u6dfb\u52a0Windows 10\u542f\u52a8\u9879\u5230GRUB2<\/strong><\/div>\n

\u88c5\u7684\u53cc\u7cfb\u7edf\uff0c\u7b2c\u4e00\u4e2a\u7cfb\u7edf\u88c5\u7684\u662fWindows 10\uff0c\u7136\u540e\u518d\u5b89\u88c5Centos7\u3002\u88c5\u5b8cCentos7\u53d1\u73b0\u6ca1\u6709Windows 10\u7684\u542f\u52a8\u9879\uff0c\u8fd9\u65f6\u5019\u9700\u8981\u624b\u52a8\u6dfb\u52a0windows 10\u7684\u542f\u52a8\u9879\u3002<\/p>\n

\r\n# \u6253\u5f0040_custom\u6587\u4ef6\uff0c\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9\r\n[root@localhost ~]# vim \/etc\/grub.d\/40_custom\r\n\r\nmenuentry 'Windows 10' {\r\n        insmod ntfs\r\n        set root='hd0,1'\r\n        chainloader +1\r\n}\r\n# \u4fee\u6539\u5b8c\u6210\u4e4b\u540e\uff0c\u9700\u8981\u5bfc\u51fa\u751f\u6210\u914d\u7f6e\u6587\u4ef6\uff0c\u8fd9\u6837\u624d\u80fd\u751f\u6548\u3002\r\n[root@localhost ~]# grub2-mkconfig -o \/boot\/grub2\/grub.cfg\r\n<\/pre>\n

\"\"<\/p>\n

\u91cd\u542f\u7535\u8111\uff0c\u68c0\u67e5\u4e00\u4e0b\u662f\u5426\u6709Windows 10\u542f\u52a8\u9879<\/strong><\/span><\/div>\n

\"\"<\/p>\n

\u5982\u4f55\u66f4\u6539\u9ed8\u8ba4\u542f\u52a8\u9879<\/strong><\/div>\n
\u5217\u51fa\u6240\u6709\u542f\u52a8\u9879<\/strong><\/span><\/div>\n
\r\n[root@localhost ~]# grep '^menuentry' \/boot\/grub2\/grub.cfg |cut -d \"'\" -f 2\r\nCentOS Linux (3.10.0-1062.el7.x86_64) 7 (Core)\r\nCentOS Linux (0-rescue-2fbe0839e3b3416b960e84dab68c8bb3) 7 (Core)\r\nWindows 10\r\n<\/pre>\n

\"\"<\/p>\n

\u4fee\u6539Windows10\u4f5c\u4e3a\u9ed8\u8ba4\u542f\u52a8\u9879<\/strong><\/span><\/div>\n
\r\n[root@localhost ~]# grub2-set-default \"Windows 10\"\r\n<\/pre>\n
\u68c0\u67e5\u662f\u5426\u8bbe\u7f6e\u6210\u529f<\/strong><\/span><\/div>\n
\r\n[root@localhost ~]# grub2-editenv list\r\nsaved_entry=Windows 10\r\n<\/pre>\n

\"\"<\/p>\n

\u4fdd\u5b58\u66f4\u6539<\/strong><\/span><\/div>\n
\r\n[root@localhost ~]# grub2-mkconfig -o \/boot\/grub2\/grub.cfg \r\nGenerating grub configuration file ...\r\nFound linux image: \/boot\/vmlinuz-3.10.0-1062.el7.x86_64\r\nFound initrd image: \/boot\/initramfs-3.10.0-1062.el7.x86_64.img\r\nFound linux image: \/boot\/vmlinuz-0-rescue-2fbe0839e3b3416b960e84dab68c8bb3\r\nFound initrd image: \/boot\/initramfs-0-rescue-2fbe0839e3b3416b960e84dab68c8bb3.img\r\ndone\r\n<\/pre>\n

\"\"<\/p>\n

\u5982\u4f55\u66f4\u6539grub2\u83dc\u5355\u7684\u8d85\u65f6\u65f6\u95f4<\/strong><\/div>\n

\u6253\u5f00\/etc\/default\/grub\u6587\u4ef6\uff0c\u4fee\u6539GRUB_TIMEOUT<\/span>\u53d8\u91cf\u503c\uff0c\u53d8\u91cf\u7684\u503c\u662f\u79d2\u6570\u3002<\/p>\n

\r\n[root@localhost ~]# vim \/etc\/default\/grub\r\n\r\nGRUB_TIMEOUT=5\r\nGRUB_DISTRIBUTOR=\"$(sed 's, release .*$,,g' \/etc\/system-release)\"\r\nGRUB_DEFAULT=saved\r\nGRUB_DISABLE_SUBMENU=true\r\nGRUB_TERMINAL_OUTPUT=\"gfxterm\"\r\nGRUB_BACKGROUND=\/boot\/grub2\/background.jpg\r\nGRUB_GFXMODE=1440x900,1024x768,640x480\r\nGRUB_CMDLINE_LINUX=\"crashkernel=auto spectre_v2=retpoline rd.lvm.lv=centos\/root rd.lvm.lv=centos\/swap rhgb quiet\"\r\nGRUB_DISABLE_RECOVERY=\"true\" \r\n<\/pre>\n

\"\"
\n\u4fdd\u5b58\u751f\u6210\u914d\u7f6e\u6587\u4ef6<\/p>\n

\r\n[root@localhost ~]# grub2-mkconfig -o \/boot\/grub2\/grub.cfg\r\nGenerating grub configuration file ...\r\nFound linux image: \/boot\/vmlinuz-3.10.0-1062.el7.x86_64\r\nFound initrd image: \/boot\/initramfs-3.10.0-1062.el7.x86_64.img\r\nFound linux image: \/boot\/vmlinuz-0-rescue-2fbe0839e3b3416b960e84dab68c8bb3\r\nFound initrd image: \/boot\/initramfs-0-rescue-2fbe0839e3b3416b960e84dab68c8bb3.img\r\ndone\r\n<\/pre>\n

\"\"<\/p>\n

\u603b\u7ed3<\/strong><\/div>\n

\u5728\u8fd9\u7247\u6587\u7ae0\u4e2d\uff0c\u8bb2\u8ff0\u4e86\u5982\u4f55\u6dfb\u52a0grub\u5f15\u5bfc\u8bb0\u5f55\u3001\u4fee\u6539\u8d85\u65f6\u65f6\u95f4\u3001\u4fee\u6539\u9ed8\u8ba4\u542f\u52a8\u9879\u3002\u5982\u679c\u559c\u6b22\u8fd9\u7bc7\u6587\u7ae0\uff0c\u53ef\u4ee5\u70b9\u4e2a\u8d5e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u88c5\u7684\u53cc\u7cfb\u7edf\uff0c\u7b2c\u4e00\u4e2a\u7cfb\u7edf\u88c5\u7684\u662fWindows 10\uff0c\u7136\u540e\u518d\u5b89\u88c5Centos7\u3002\u88c5\u5b8cCentos7\u53d1\u73b0\u6ca1\u6709Wind […]<\/p>\n","protected":false},"author":362,"featured_media":174202,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-174201","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/174201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/362"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=174201"}],"version-history":[{"count":2,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/174201\/revisions"}],"predecessor-version":[{"id":174211,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/174201\/revisions\/174211"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/174202"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=174201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=174201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=174201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}