{"id":7183,"date":"2022-07-03T09:55:22","date_gmt":"2022-07-03T01:55:22","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=7183"},"modified":"2022-07-03T13:33:15","modified_gmt":"2022-07-03T05:33:15","slug":"linux-command-parted","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-command-parted.html","title":{"rendered":"parted\u547d\u4ee4\u8be6\u89e3"},"content":{"rendered":"
\n

\u672c\u6587\u7531lrxjmw.cn\u56e2\u961f\u6210\u5458\u9004\u589e\u5b9d<\/span>\u6574\u7406\u53d1\u5e03\uff0c\u539f\u6587\u6765\u81ea\uff1a\u7ea2\u9ed1\u8054\u76df<\/a>\u3002<\/p>\n<\/div>\n

\u7528\u6cd5\uff1aparted [\u9009\u9879]... [\u8bbe\u5907 [\u547d\u4ee4 [\u53c2\u6570]...]...]<\/strong><\/div>\n
\u5e2e\u52a9\u9009\u9879\uff1a<\/strong><\/span><\/div>\n
-h, --help                    \u663e\u793a\u6b64\u6c42\u52a9\u4fe1\u606f \r\n-l, --list                    \u5217\u51fa\u6240\u6709\u8bbe\u522b\u7684\u5206\u533a\u4fe1\u606f\r\n-i, --interactive             \u5728\u5fc5\u8981\u65f6\uff0c\u63d0\u793a\u7528\u6237 \r\n-s, --script                  \u4ece\u4e0d\u63d0\u793a\u7528\u6237 \r\n-v, --version                 \u663e\u793a\u7248\u672c\r\n<\/pre>\n
\u64cd\u4f5c\u547d\u4ee4\uff1a<\/strong><\/span><\/div>\n
cp [FROM-DEVICE] FROM-MINOR TO-MINOR           #\u5c06\u6587\u4ef6\u7cfb\u7edf\u590d\u5236\u5230\u53e6\u4e00\u4e2a\u5206\u533a \r\nhelp [COMMAND]                                 #\u6253\u5370\u901a\u7528\u6c42\u52a9\u4fe1\u606f\uff0c\u6216\u5173\u4e8e COMMAND \u7684\u4fe1\u606f \r\nmklabel \u6807\u7b7e\u7c7b\u578b                               #\u521b\u5efa\u65b0\u7684\u78c1\u76d8\u6807\u7b7e (\u5206\u533a\u8868) \r\nmkfs MINOR \u6587\u4ef6\u7cfb\u7edf\u7c7b\u578b                        #\u5728 MINOR \u521b\u5efa\u7c7b\u578b\u4e3a\u201c\u6587\u4ef6\u7cfb\u7edf\u7c7b\u578b\u201d\u7684\u6587\u4ef6\u7cfb\u7edf \r\nmkpart \u5206\u533a\u7c7b\u578b [\u6587\u4ef6\u7cfb\u7edf\u7c7b\u578b] \u8d77\u59cb\u70b9 \u7ec8\u6b62\u70b9   #\u521b\u5efa\u4e00\u4e2a\u5206\u533a \r\nmkpartfs \u5206\u533a\u7c7b\u578b \u6587\u4ef6\u7cfb\u7edf\u7c7b\u578b \u8d77\u59cb\u70b9 \u7ec8\u6b62\u70b9   #\u521b\u5efa\u4e00\u4e2a\u5e26\u6709\u6587\u4ef6\u7cfb\u7edf\u7684\u5206\u533a \r\nmove MINOR \u8d77\u59cb\u70b9 \u7ec8\u6b62\u70b9                       #\u79fb\u52a8\u7f16\u53f7\u4e3a MINOR \u7684\u5206\u533a \r\nname MINOR \u540d\u79f0                                #\u5c06\u7f16\u53f7\u4e3a MINOR \u7684\u5206\u533a\u547d\u540d\u4e3a\u201c\u540d\u79f0\u201d \r\nprint [MINOR]                                  #\u6253\u5370\u5206\u533a\u8868\uff0c\u6216\u8005\u5206\u533a \r\nquit                                           #\u9000\u51fa\u7a0b\u5e8f \r\nrescue \u8d77\u59cb\u70b9 \u7ec8\u6b62\u70b9                           #\u633d\u6551\u4e34\u8fd1\u201c\u8d77\u59cb\u70b9\u201d\u3001\u201c\u7ec8\u6b62\u70b9\u201d\u7684\u9057\u5931\u7684\u5206\u533a \r\nresize MINOR \u8d77\u59cb\u70b9 \u7ec8\u6b62\u70b9                     #\u6539\u53d8\u4f4d\u4e8e\u7f16\u53f7\u4e3a MINOR \u7684\u5206\u533a\u4e2d\u6587\u4ef6\u7cfb\u7edf\u7684\u5927\u5c0f \r\nrm MINOR                                       #\u5220\u9664\u7f16\u53f7\u4e3a MINOR \u7684\u5206\u533a \r\nselect \u8bbe\u5907                                    #\u9009\u62e9\u8981\u7f16\u8f91\u7684\u8bbe\u5907 \r\nset MINOR \u6807\u5fd7 \u72b6\u6001                            #\u6539\u53d8\u7f16\u53f7\u4e3a MINOR \u7684\u5206\u533a\u7684\u6807\u5fd7\r\n<\/pre>\n
\u64cd\u4f5c\u5b9e\u4f8b\uff1a<\/strong><\/div>\n
1\u3001\u9009\u62e9\u5206\u533a\u786c\u76d8<\/strong><\/span><\/div>\n

\u9996\u5148\u7c7b\u4f3cfdisk\u4e00\u6837\uff0c\u5148\u9009\u62e9\u8981\u5206\u533a\u7684\u786c\u76d8\uff0c\u6b64\u5904\u4e3a\/dev\/hdd\uff1a ((parted)\u8868\u793a\u5728parted\u4e2d\u8f93\u5165\u7684\u547d\u4ee4\uff0c\u5176\u4ed6\u4e3a\u81ea\u52a8\u6253\u5370\u7684\u4fe1\u606f)<\/strong><\/p>\n

[root@10.10.90.97 ~]# parted \/dev\/hdd\r\nGNU Parted 1.8.1\r\nUsing \/dev\/hdd\r\nWelcome to GNU Parted! Type 'help' to view a list of commands.\r\n<\/pre>\n
2\u3001\u521b\u5efa\u5206\u533a<\/strong><\/span><\/div>\n

\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<\/p>\n

(parted) mklabel\r\nNew disk label type? gpt    (\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)\r\n<\/pre>\n
3\u3001\u5b8c\u6210\u5206\u533a\u64cd\u4f5c<\/strong><\/span><\/div>\n

\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<\/p>\n

(parted) mkpart\r\nPartition name? []? dp1\r\nFile system type? [ext2]? ext3\r\nStart? 0           \uff08\u53ef\u4ee5\u7528\u767e\u5206\u6bd4\u8868\u793a\uff0c\u6bd4\u5982Start? 0% , End? 50%\uff09\r\nEnd? 500GB\r\n<\/pre>\n
4\u3001\u9a8c\u8bc1\u5206\u533a\u4fe1\u606f<\/strong><\/span><\/div>\n

\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<\/p>\n

(parted) print\r\nModel: VBOX HARDDISK (ide)\r\nDisk \/dev\/hdd: 2199GB\r\nSector size (logical\/physical): 512B\/512B\r\nPartition Table: gpt\r\nNumber Start End Size File system Name Flags\r\n1 17.4kB 500GB 500GB dp1\r\n<\/pre>\n
5\u3001\u5220\u9664\u5206\u533a\u793a\u4f8b<\/strong><\/span><\/div>\n

\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<\/p>\n

(parted)rm 1               #rm\u540e\u9762\u4f7f\u7528\u5206\u533a\u7684\u53f7\u7801\uff0c\u5c31\u662f\u7528print\u6253\u5370\u51fa\u6765\u7684Number\r\n(parted) print\r\nModel: VBOX HARDDISK (ide)\r\nDisk \/dev\/hdd: 2199GB\r\nSector size (logical\/physical): 512B\/512B\r\nPartition Table: gpt\r\nNumber Start End Size File system Name Flags\r\n<\/pre>\n
6\u3001\u5b8c\u6574\u793a\u4f8b<\/strong><\/span><\/div>\n

\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<\/p>\n

(parted) mkpart\r\nPartition name? []? dp1\r\nFile system type? [ext2]? ext3\r\nStart? 0\r\nEnd? 500GB\r\n(parted) mkpart\r\nPartition name? []? dp2\r\nFile system type? [ext2]? ext3\r\nStart? 500GB\r\nEnd? 2199GB\r\n(parted) print\r\nModel: VBOX HARDDISK (ide)\r\nDisk \/dev\/hdd: 2199GB\r\nSector size (logical\/physical): 512B\/512B\r\nPartition Table: gpt\r\nNumber Start End Size File system Name Flags\r\n1 17.4kB 500GB 500GB dp1\r\n2 500GB 2199GB 1699GB dp2\r\n<\/pre>\n
7\u3001\u683c\u5f0f\u5316\u64cd\u4f5c<\/strong><\/span><\/div>\n

\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\u3002<\/p>\n

[root@10.10.90.97 ~]# fdisk -l\r\nWARNING: GPT (GUID Partition Table) detected on '\/dev\/hdd'! The util fdisk doesn't support GPT. Use GNU Parted.\r\nDisk \/dev\/hdd: 2199.0 GB, 2199022206976 bytes\r\n255 heads, 63 sectors\/track, 267349 cylinders\r\nUnits = cylinders of 16065 * 512 = 8225280 bytes\r\nDevice Boot Start End Blocks Id System\r\n\/dev\/hdd1 1 267350 2147482623+ ee EFI GPT\r\n[root@10.10.90.97 ~]# mkfs.ext3 \/dev\/hdd1\r\n[root@10.10.90.97 ~]# mkfs.ext3 \/dev\/hdd2\r\n[root@10.10.90.97 ~]# mkdir \/dp1 \/dp2\r\n[root@10.10.90.97 ~]# mount \/dev\/hdd1 \/dp1\r\n[root@10.10.90.97 ~]# mount \/dev\/hdd2 \/dp2\r\n<\/pre>\n
\n

\u539f\u6587\u6765\u81ea\uff1ahttp:\/\/www.2cto.com\/os\/201206\/137110.html<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttp:\/\/lrxjmw.cn\/linux-command-parted.html<\/a>\u7f16\u8f91\uff1a\u9004\u589e\u5b9d\uff0c\u5ba1\u6838\u5458\uff1a\u5f20\u5b8f\u5b87<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u7528\u6cd5\uff1aparted [\u9009\u9879]… [\u8bbe\u5907 [\u547d\u4ee4 [\u53c2\u6570]…]…] \u5e2e\u52a9\u9009\u9879\uff1a -h, –help […]<\/p>\n","protected":false},"author":317,"featured_media":5895,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-7183","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\/7183","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\/317"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=7183"}],"version-history":[{"count":6,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/7183\/revisions"}],"predecessor-version":[{"id":247042,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/7183\/revisions\/247042"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/5895"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=7183"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=7183"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=7183"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}