{"id":607,"date":"2014-10-21T06:40:52","date_gmt":"2014-10-21T06:40:52","guid":{"rendered":"http:\/\/www.selinuxplus.com\/?p=607"},"modified":"2014-10-21T07:45:27","modified_gmt":"2014-10-21T07:45:27","slug":"usm-install-linux%ef%bc%8c%e5%85%b3%e4%ba%8eks%e6%96%87%e4%bb%b6%e8%b7%af%e5%be%84%e7%9a%84%e9%97%ae%e9%a2%98el7","status":"publish","type":"post","link":"http:\/\/www.selinuxplus.com\/?p=607","title":{"rendered":"USB install linux\uff0c\u5173\u4e8eks\u6587\u4ef6\u8def\u5f84\u7684\u95ee\u9898(EL7)"},"content":{"rendered":"<p>\u5728\u4f7f\u7528USB\u5b89\u88c5\u7cfb\u7edf\u65f6\uff0c\u53d1\u73b0\u7cfb\u7edf\u5728\u542f\u52a8\u7684\u65f6\u5019\uff0c\u51fa\u73b0\u65e0\u6cd5\u542f\u52a8\u7684\u539f\u56e0\uff0c\u4e3b\u8981\u73b0\u8c61\u8868\u73b0\u4e3a\/dev\/root not exist.\u89e3\u51b3\u65b9\u6cd5\u53ef\u4ee5\u91c7\u7528\u9488\u5bf9\u7cfb\u7edf\u8bc6\u522b\u7684\u4e0d\u540c\u7ed3\u679c\u8fdb\u884c\u4fee\u6539\uff0c\u5728syslinux.cfg\u6587\u4ef6\u4e2d\u5c06\u5730\u5740\u6539\u4e3a\u6307\u5b9a\u7684\u8bbe\u5907\u3002\u5982\uff1a<\/p>\n<pre class=\"lang:default decode:true \" > ks=hd:sdb1:\/ks.cfg. <\/pre>\n<p>\u5728ks\u6587\u4ef6\u4e2d\uff0c\u4f60\u53ef\u4ee5\u5c06\u7cfb\u7edf\u5b89\u88c5\u5230sda\u7684\u8bbe\u5907\u4e2d\uff0c\u5982:<\/p>\n<pre class=\"lang:default decode:true \" >bootloader --location=mbr --boot-drive=sda\r\nclearpart --all --drives=sda\r\npart \/boot --fstype=ext4 --size=500 --ondisk=sda\r\npart \/ --size=8000 --fstype ext4 --ondisk=sda\r\npart swap --size=4096 --ondisk=sda <\/pre>\n<p>\u4f46\u8fd9\u6837\u505a\uff0c\u5bf9\u6279\u91cf\u7684\u5904\u7406\u6765\u8bf4\uff0c\u53ef\u80fd\u5c31\u6bd4\u8f83\u7e41\u7410\u4e86.<br \/>\n\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u7684\u65b9\u6cd5\u8fdb\u884c\u5904\u7406\uff0c\u5c31\u53ef\u4ee5\u907f\u514d\u624b\u5de5\u4fee\u6539\u7684\u5de5\u4f5c\u3002<br \/>\nsyslinux.cfg\u6587\u4ef6\u4e2d\u3002<\/p>\n<pre class=\"lang:default decode:true \" >ks=hd:LABEL=Qfong:\/ks.cfg(\u6ce8\u610fLABEL\u7684\u957f\u5ea6\u548c\u5236\u4f5ciso\u65f6\u6307\u5b9aLABEL)<\/pre>\n<p>\u5728ks\u6587\u4ef6\u4e2d\uff0c\u5982\u679c\u4e0d\u6307\u5b9a\u5206\u533a\uff0c\u7cfb\u7edf\u4f1a\u9ed8\u8ba4\u5c06bootloader\u5b89\u88c5\u5728\u672c\u6b21\u5f15\u5bfc\u542f\u52a8\u7684\u76d8\u4e2d\uff0c\u4e5f\u5c31\u662fUSB\u6240\u5728\u8bbe\u5907\uff0c\u5bfc\u81f4\u65e0\u6cd5\u7ee7\u7eed\u5b89\u88c5\uff0c\u8fd9\u65f6\u5019\u9700\u8981\u6307\u5b9abootloader &#8211;location=mbr &#8211;boot-drive=\uff1f boot-drive=\u54ea\u4e2a\u8bbe\u5907\uff1f\u8fd9\u4e2a\u9700\u8981\u505a\u5224\u65ad\u4e86\uff0c\u5728ks\u6587\u4ef6\u4e2d\uff0c\u4f7f\u7528%pre\u9009\u9879\uff0c\u8be5\u9009\u9879\u662f\u5728\u5b89\u88c5\u524d\u6267\u884c\u7684script\u6587\u4ef6.\u4e0b\u9762\u6211\u4eec\u5c06\u5224\u65ad\u54ea\u4e2a\u8bbe\u5907\u7684script\u5199\u5728\u4e0b\u9762\uff0c\u4f9b\u5927\u5bb6\u53c2\u8003\u3002<\/p>\n<pre class=\"lang:default decode:true \" >#%include \/tmp\/partitions\r\n\r\n#%pre\r\n#!\/bin\/sh\r\n\r\n# find the first drive that doesn\u2019t have removable media and isn\u2019t USB\r\nDIR=\u201d\/sys\/block\u201d\r\nROOTDRIVE=\u201d\u201d\r\nfor DEV in sda sdb sdc sdd sde hda hdb hdc hdd hde; do\r\n  if [ -d $DIR\/$DEV ]; then\r\n    readlink -f $DIR\/$DEV\/device | grep -q \/usb\r\n    if [ $? -ne 0 ]; then\r\n      REMOVABLE=`cat $DIR\/$DEV\/removable`\r\n      if (( $REMOVABLE == 0 )); then\r\n        if [ -z $ROOTDRIVE ]; then\r\n          ROOTDRIVE=$DEV\r\n        fi\r\n      fi\r\n    fi\r\n  fi\r\ndone\r\n\r\n# Check for RAID controller disks\r\nif [ -z $ROOTDRIVE ]; then\r\n  for DEV in c0d0 c0d1 c0d2 c1d0 c1d1 c1d2; do\r\n    if [ -d $DIR\/cciss!$DEV ]; then\r\n      if [ -z $ROOTDRIVE ]; then\r\n        ROOTDRIVE=cciss\/$DEV\r\n      fi\r\n    fi\r\n  done\r\nfi\r\n\r\ncat &lt;&lt; EOF &gt; \/tmp\/partitions\r\nbootloader \u2013location=mbr \u2013driveorder=$ROOTDRIVE\r\nclearpart \u2013all \u2013drives=$ROOTDRIVE \u2013initlabel\r\npart \/boot \u2013fstype=ext3 \u2013size=75 \u2013ondisk=$ROOTDRIVE\r\npart \/ \u2013fstype=ext3 \u2013size=4096 \u2013ondisk=$ROOTDRIVE \u2013asprimary \u2013grow\r\npart swap \u2013size=2048 \u2013ondisk=$ROOTDRIVE\r\nEOF<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u4f7f\u7528USB\u5b89\u88c5\u7cfb\u7edf\u65f6\uff0c\u53d1\u73b0\u7cfb\u7edf\u5728\u542f\u52a8\u7684\u65f6\u5019\uff0c\u51fa\u73b0&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[135,137,38,107,136,134],"_links":{"self":[{"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/posts\/607"}],"collection":[{"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=607"}],"version-history":[{"count":3,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/posts\/607\/revisions"}],"predecessor-version":[{"id":645,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/posts\/607\/revisions\/645"}],"wp:attachment":[{"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=607"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=607"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=607"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}