{"id":113,"date":"2013-05-26T20:06:19","date_gmt":"2013-05-26T12:06:19","guid":{"rendered":"http:\/\/www.datarelab.com\/blog\/?p=113"},"modified":"2013-05-26T20:06:19","modified_gmt":"2013-05-26T12:06:19","slug":"linux%e4%b8%8b%e5%a4%a7%e4%ba%8e2tb%e8%ae%be%e5%a4%87%e5%88%86%e5%8c%ba%e5%b7%a5%e5%85%b7%20--%20parted%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/www.datarelab.com\/blog\/Technical_literature\/113.html","title":{"rendered":"Linux\u4e0b\u5927\u4e8e2TB\u8bbe\u5907\u5206\u533a\u5de5\u5177 -- parted\u4ecb\u7ecd"},"content":{"rendered":"<p style=\"text-indent:2em;\">\n\t\u968f\u7740\u5355\u5757\u786c\u76d8\u5bb9\u91cf\u7684\u589e\u5927\u548c\u786c\u76d8\u4ef7\u683c\u7684\u4e0b\u964d\uff0c2TB\u7684\u78c1\u76d8\u4f7f\u7528\u5c06\u5f88\u5feb\u4f1a\u666e\u53ca\uff0c\u7531\u4e8e\u4f20\u7edf\u7684MBR\u65b9\u5f0f\u5b58\u50a8\u5206\u533a\u8868\u7684\u65b9 \u5f0f\u7f3a\u9677\uff0c\u5c06\u53ef\u80fd\u5bfc\u81f4\u5f88\u591a\u5206\u533a\u5de5\u5177\u4e0d\u80fd\u6b63\u786e\u5730\u8bfb\u53d6\u5927\u4e8e2TB\u5bb9\u91cf\u7684\u786c\u76d8\u800c\u65e0\u6cd5\u6b63\u5e38\u5206\u533a\u5927\u5bb9\u91cf\u786c\u76d8\u3002\u5176\u5b9elinux\u5728\u5f88\u65e9\u5c31\u5df2\u7ecf\u6709\u76f8\u5173\u7684\u5de5\u5177\u6765\u5316\u89e3\u8fd9\u4e2a\u56f0\u5883 \u4e86\uff0c\u90a3\u5c31\u662fparted\u3002<br \/>\nparted\u662f\u7c7b\u4f3cfdisk\u7684\u547d\u4ee4\u884c\u5206\u533a\u8f6f\u4ef6\uff0c\u5047\u8bbe\u6211\u4eec\u5728linux\u7cfb\u7edf\u4e2d\u6709\u4e00\u5757\u672a\u5206\u533a\u7684\u786c\u76d8\u6302\u8f7d\u4e3a\/dev\/hdd\uff0c\u4e0b\u9762\u4ee5\u5b9e\u4f8b\u7684\u65b9\u5f0f\u6765\u8bb2\u89e3\u5982\u4f55\u4f7f\u7528 parted\uff1a<br \/>\n\u6ce8\u610f\uff1aparted\u7684\u64cd\u4f5c\u90fd\u662f\u5b9e\u65f6\u7684\uff0c\u4e5f\u5c31\u662f\u8bf4\u4f60\u6267\u884c\u4e86\u4e00\u4e2a\u5206\u533a\u7684\u547d\u4ee4\uff0c\u4ed6\u5c31\u5b9e\u5b9e\u5728\u5728\u5730\u5206\u533a\u4e86\uff0c\u800c\u4e0d\u662f\u50cffdisk\u90a3\u6837\uff0c\u9700\u8981\u6267\u884cw\u547d\u4ee4\u5199\u5165\u6240\u505a\u7684\u4fee\u6539\uff0c \u6240\u4ee5\u8fdb\u884cparted\u7684\u6d4b\u8bd5\u5343\u4e07\u6ce8\u610f\u4e0d\u80fd\u5728\u751f\u4ea7\u73af\u5883\u4e2d\uff01\uff01<br \/>\n\u6807\u8bb0\uff1a#\u5f00\u59cb\u8868\u793a\u5728shell\u7684root\u4e0b\u8f93\u5165\u7684\u547d\u4ee4\uff0c(parted)\u8868\u793a\u5728parted\u4e2d\u8f93\u5165\u7684\u547d\u4ee4\uff0c\u5176\u4ed6\u4e3a\u81ea\u52a8\u6253\u5370\u7684\u4fe1\u606f<\/p>\n<p>1\u3001\u9996\u5148\u7c7b\u4f3cfdisk\u4e00\u6837\uff0c\u5148\u9009\u62e9\u8981\u5206\u533a\u7684\u786c\u76d8\uff0c\u6b64\u5904\u4e3a\/dev\/hdd\uff1a<br \/>\n# parted \/dev\/hdd<br \/>\nGNU Parted 1.8.1<br \/>\nUsing \/dev\/hdd<br \/>\nWelcome to GNU Parted! Type 'help' to view a list of commands.<\/p>\n<p>2\u3001\u73b0\u5728\u6211\u4eec\u5df2\u7ecf\u9009\u62e9\u4e86\/dev\/hdd\u4f5c\u4e3a\u6211\u4eec\u64cd\u4f5c\u7684\u78c1\u76d8\uff0c\u63a5\u4e0b\u6765\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u5206\u533a\u8868(\u5728parted\u4e2d\u53ef\u4ee5 \u4f7f\u7528help\u547d\u4ee4\u6253\u5370\u5e2e\u52a9\u4fe1\u606f)\uff1a<br \/>\n(parted) mklabel<br \/>\nWarning: The existing disk label on \/dev\/hdd will be destroyed and all data on this disk will be lost. Do you want to continue?<br \/>\nYes\/No?(\u8b66\u544a\u7528\u6237\u78c1\u76d8\u4e0a\u7684\u6570\u636e\u5c06\u4f1a\u88ab\u9500\u6bc1\uff0c\u8be2\u95ee\u662f\u5426\u7ee7\u7eed\uff0c\u6211\u4eec\u8fd9\u91cc\u662f\u65b0\u7684\u78c1\u76d8\uff0c\u8f93\u5165yes\u540e\u56de\u8f66) yes<br \/>\nNew disk label type? [msdos]? (\u9ed8\u8ba4\u4e3amsdos\u5f62\u5f0f\u7684\u5206\u533a\uff0c\u6211\u4eec\u8981\u6b63\u786e\u5206\u533a\u5927\u4e8e2TB\u7684\u78c1\u76d8\uff0c\u5e94\u8be5\u4f7f\u7528gpt\u65b9\u5f0f\u7684\u5206\u533a\u8868\uff0c\u8f93\u5165gpt\u540e\u56de\u8f66)gpt<\/p>\n<p>3\u3001\u521b\u5efa\u597d\u5206\u533a\u8868\u4ee5\u540e\uff0c\u63a5\u4e0b\u6765\u5c31\u53ef\u4ee5\u8fdb\u884c\u5206\u533a\u64cd\u4f5c\u4e86\uff0c\u6267\u884cmkpart\u547d\u4ee4\uff0c\u5206\u522b\u8f93\u5165\u5206\u533a\u540d\u79f0\uff0c\u6587\u4ef6\u7cfb\u7edf\u548c\u5206\u533a \u7684\u8d77\u6b62\u4f4d\u7f6e<br \/>\n(parted) mkpart<br \/>\nPartition name? []? dp1<br \/>\nFile system type? [ext2]? ext3<br \/>\nStart? 0<br \/>\nEnd? 500GB<\/p>\n<p>4\u3001\u5206\u597d\u533a\u540e\u53ef\u4ee5\u4f7f\u7528print\u547d\u4ee4\u6253\u5370\u5206\u533a\u4fe1\u606f\uff0c\u4e0b\u9762\u662f\u4e00\u4e2aprint\u7684\u6837\u4f8b<br \/>\n(parted) print<br \/>\nModel: VBOX HARDDISK (ide)<br \/>\nDisk \/dev\/hdd: 2199GB<br \/>\nSector size (logical\/physical): 512B\/512B<br \/>\nPartition Table: gpt<br \/>\nNumber Start End Size File system Name Flags<br \/>\n1 17.4kB 500GB 500GB dp1<\/p>\n<p>5\u3001\u5982\u679c\u5206\u533a\u9519\u4e86\uff0c\u53ef\u4ee5\u4f7f\u7528rm\u547d\u4ee4\u5220\u9664\u5206\u533a\uff0c\u6bd4\u5982\u6211\u4eec\u8981\u5220\u9664\u4e0a\u9762\u7684\u5206\u533a\uff0c\u7136\u540e\u6253\u5370\u5220\u9664\u540e\u7684\u7ed3\u679c<br \/>\n(parted)rm 1 #rm\u540e\u9762\u4f7f\u7528\u5206\u533a\u7684\u53f7\u7801<br \/>\n(parted) print<br \/>\nModel: VBOX HARDDISK (ide)<br \/>\nDisk \/dev\/hdd: 2199GB<br \/>\nSector size (logical\/physical): 512B\/512B<br \/>\nPartition Table: gpt<br \/>\nNumber Start End Size File system Name Flags<\/p>\n<p>6\u3001\u6309\u7167\u4e0a\u9762\u7684\u65b9\u6cd5\u628a\u6574\u4e2a\u786c\u76d8\u90fd\u5206\u597d\u533a\uff0c\u4e0b\u9762\u662f\u4e00\u4e2a\u5206\u5b8c\u540e\u7684\u6837\u4f8b<br \/>\n(parted) mkpart<br \/>\nPartition name? []? dp1<br \/>\nFile system type? [ext2]? ext3<br \/>\nStart? 0<br \/>\nEnd? 500GB<br \/>\n(parted) mkpart<br \/>\nPartition name? []? dp2<br \/>\nFile system type? [ext2]? ext3<br \/>\nStart? 500GB<br \/>\nEnd? 2199GB<br \/>\n(parted) print<br \/>\nModel: VBOX HARDDISK (ide)<br \/>\nDisk \/dev\/hdd: 2199GB<br \/>\nSector size (logical\/physical): 512B\/512B<br \/>\nPartition Table: gpt<br \/>\nNumber Start End Size File system Name Flags<br \/>\n1 17.4kB 500GB 500GB dp1<br \/>\n2 500GB 2199GB 1699GB dp2<\/p>\n<p>7\u3001\u7531\u4e8eparted\u5185\u5efa\u7684mkfs\u8fd8\u4e0d\u591f\u5b8c\u5584\uff0c\u6240\u4ee5\u5b8c\u6210\u4ee5\u540e\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528quit\u547d\u4ee4\u9000\u51faparted\u5e76\u4f7f\u7528 \u7cfb\u7edf\u7684mkfs\u547d\u4ee4\u5bf9\u5206\u533a\u8fdb\u884c\u683c\u5f0f\u5316\u4e86\uff0c\u6b64\u65f6\u5982\u679c\u4f7f\u7528fdisk -l\u547d\u4ee4\u6253\u5370\u5206\u533a\u8868\u4f1a\u51fa\u73b0\u8b66\u544a\u4fe1\u606f\uff0c\u8fd9\u662f\u6b63\u5e38\u7684<br \/>\n#fdisk -l<br \/>\nWARNING: GPT (GUID Partition Table) detected on '\/dev\/hdd'! The util fdisk doesn't support GPT. Use GNU Parted.<br \/>\nDisk \/dev\/hdd: 2199.0 GB, 2199022206976 bytes<br \/>\n255 heads, 63 sectors\/track, 267349 cylinders<br \/>\nUnits = cylinders of 16065 * 512 = 8225280 bytes<br \/>\nDevice Boot Start End Blocks Id System<br \/>\n\/dev\/hdd1 1 267350 2147482623+ ee EFI GPT #mkfs.ext3 \/dev\/hdd1<br \/>\n#mkfs.ext3 \/dev\/hdd2<br \/>\n#mkdir \/dp1 \/dp2<br \/>\n#mount \/dev\/hdd1 \/dp1<br \/>\n#mount \/dev\/hdd2 \/dp2<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u968f\u7740\u5355\u5757\u786c\u76d8\u5bb9\u91cf\u7684\u589e\u5927\u548c\u786c\u76d8\u4ef7\u683c\u7684\u4e0b\u964d\uff0c2TB\u7684\u78c1\u76d8\u4f7f\u7528\u5c06\u5f88\u5feb\u4f1a\u666e\u53ca\uff0c\u7531\u4e8e\u4f20\u7edf\u7684MBR\u65b9\u5f0f\u5b58\u50a8\u5206\u533a\u8868\u7684\u65b9 \u5f0f\u7f3a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[74,64,67,65,14,70,73,16,82,86],"class_list":{"0":"post-113","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-Technical_literature","7":"tag-esp","8":"tag-gpt","10":"tag-guid","11":"tag-linux","12":"tag-mbr","13":"tag-msr","14":"tag-parted","15":"tag-82","16":"tag-86"},"views":1366,"_links":{"self":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts\/113","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/comments?post=113"}],"version-history":[{"count":0,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts\/113\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/media?parent=113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/categories?post=113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/tags?post=113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}