{"id":94905,"date":"2024-05-02T15:07:11","date_gmt":"2024-05-02T07:07:11","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=94905"},"modified":"2024-05-02T15:07:11","modified_gmt":"2024-05-02T07:07:11","slug":"linux-system-disk","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-system-disk.html","title":{"rendered":"Linux\u7cfb\u7edf\u78c1\u76d8\u8be6\u89e3"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u6240\u6709\u6709\u7cfb\u7edf\u90fd\u4e00\u6837\uff0c\u90fd\u662f\u4e00\u79cd\u8f6f\u4ef6\u88ab\u5b89\u88c5\u4e8e\u67d0\u4e2a\u786c\u4ef6\u4e4b\u4e0a\uff0c\u8fd9\u4e2a\u786c\u4ef6\u65e0\u5916\u975e\u662f\u4e00\u79cd\u5b58\u50a8\u8bbe\u5907\uff0c\u901a\u5e38\u64cd\u4f5c\u7cfb\u7edf\u90fd\u662f\u5b89\u88c5\u5728\u78c1\u76d8\u4e2d\uff0c\u6240\u4ee5Linux\u7cfb\u7edf\u4e5f\u662f\u4e00\u6837\uff0c\u90fd\u662f\u5b89\u88c5\u5728\u78c1\u76d8\u4e2d\uff0c\u4f46\u662f\u5b83\u4e0eWindows\u7cfb\u7edf\u4e0d\u4e00\u6837\uff0c\u56e0\u4e3aLinux\u90fd\u662f\u9700\u8981\u521b\u5efa\u6587\u4ef6\u7cfb\u7edf\u624d\u53ef\u4ee5\u4f7f\u7528\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
1\u3001 \u78c1\u76d8\u5206\u7c7b<\/strong><\/div>\n

\u76ee\u524d\u5e02\u573a\u4e0a\u7684\u78c1\u76d8\u5206\u7c7b\u6709\uff1aIDE\u78c1\u76d8\uff08\u591a\u7528\u4e8ePC\u673a\uff09\u3001SATA\u78c1\u76d8\u3001SAS\u78c1\u76d8\u3001SSD\u78c1\u76d8\u7b49\u8fd9\u4e48\u51e0\u79cd\u5206\u7c7b\uff0c\u4f01\u4e1a\u4e2d\u670d\u52a1\u5668\u5927\u591a\u4e3a\u540e\u9762\u7684\u4e24\u79cd\uff0cSATA\u78c1\u76d8\u591a\u7528\u4e8e\u4f01\u4e1a\u5185\u90e8\u7684\u4e00\u4e9b\u4e1a\u52a1\u3001SAS\u78c1\u76d8\u591a\u7528\u4e8e\u5bf9\u5916\u7684\u4e1a\u52a1\uff08\u4e00\u4e9b\u4e1a\u52a1\u5e73\u53f0\uff09\u3002<\/p>\n

SATA\u78c1\u76d8\u76ee\u524d\u5bb9\u91cf\u6700\u5927\u4e3a4T\u3001SAS\u78c1\u76d8\u4e00\u822c\u90fd\u5728300G--600G\u5c45\u591a\uff0c\u4f01\u4e1a\u751f\u4ea7\u73af\u5883\u4e2d\u4f7f\u7528\u4e5f\u6700\u591a\u7684\u662f\u8fd9\u79cd\u5bb9\u91cf\u7684\uff0c\u5b9e\u9645\u751f\u4ea7\u4e2d\u78c1\u76d8\u7684\u4f7f\u7528\u4e3b\u8981\u662f\u770b\u6027\u80fd\u9700\u6c42\uff0c\u4e5f\u5c31\u662f\u78c1\u76d8\u7684\u8bfb\u5199\u901f\u5ea6\u3002<\/p>\n

2\u3001 \u78c1\u76d8\u7684\u4f53\u7cfb\u7ed3\u6784<\/strong><\/div>\n

\u4f01\u4e1a\u7ea7\u670d\u52a1\u5668\u591a\u5757\u78c1\u76d8\u7684\u60c5\u51b5<\/p>\n

\"\"<\/p>\n

3\u3001 \u78c1\u76d8\u5bb9\u91cf\u7684\u8ba1\u7b97<\/strong><\/div>\n

\u78c1\u76d8\u7684\u7ed3\u6784\u4e00\u822c\u5305\u62ec\u78c1\u9053\u3001\u76d8\u9762\u3001\u6247\u533a\u3001\u78b0\u5934\u7b49<\/p>\n

\u4e00\u4e2a\u78c1\u9053\u7684\u5927\u5c0f=512 \u5b57\u8282*\u6247\u533a\u6570<\/p>\n

\u4e00\u4e2a\u76d8\u9762\u7684\u5927\u5c0f=\u78c1\u9053\u7684\u5927\u5c0f*\u78c1\u9053\u6570<\/p>\n

\u4e00\u4e2a\u78c1\u76d8\u7684\u5927\u5c0f=\u76d8\u9762\u5927\u5c0f*\u78c1\u5934\u6570<\/p>\n

\u56e0\u6b64\uff0c\u4e00\u4e2a\u78c1\u76d8\u7684\u5bb9\u91cf=512 \u5b57\u8282*\u6247\u533a\u6570*\u78c1\u9053\u6570*\u78c1\u5934\u6570<\/p>\n

\"\"<\/p>\n

 <\/p>\n

4\u3001 \u78c1\u76d8\u5206\u533a<\/strong><\/div>\n

\u6240\u6709\u78c1\u76d8\u7684\u5206\u533a\u4fe1\u606f\u90fd\u662f\u5b58\u50a8\u5728\u5206\u533a\u8868\u4e2d\uff0cLinux\u7cfb\u7edf\u4ec5\u652f\u63014\u4e2a\u5206\u533a\u8868\u4fe1\u606f\uff08\u4e3b\u5206\u533a+\u6269\u5c55\u5206\u533a\uff09\uff0c\u4e00\u4e2a\u5206\u533a\u8868\u7684\u5927\u5c0f\u572864bytes<\/p>\n

Linux\u4e00\u822c\u5206\u4e3a\u4e09\u4e2a\u5206\u533a\u5206\u522b\u662f\uff1aboot\u5206\u533a\u3001swap\u5206\u533a\u3001\/\u6839\u5206\u533a<\/p>\n

Linux\u7684\u5206\u533a\u7f16\u53f7\uff1a\u4e3b\u5206\u533a1-4\uff0c\u903b\u8f91\u5206\u533a\u4ece5\u5f00\u59cb\u8ba1\u7b97<\/p>\n

\u5b9e\u9645\u751f\u4ea7\u73af\u5883\u5206\u533a\u8981\u6c42<\/p>\n

1\u3001 \u6700\u5c11\u8981\u6709\/\u548cswap\u4e24\u4e2a\u5206\u533a<\/p>\n

2\u3001 swap\uff08\u865a\u62df\u5185\u5b58\uff09=1.5*\u7269\u7406\u5185\u5b58\u5927\u5c0f\uff0c\u4e00\u822c\u5927\u5c0f\u4e8e\u6216\u7b49\u4e8e16G\u7684\u7269\u7406\u5185\u5b58\u7684\u670d\u52a1\u5668\uff0cswap\u5206\u533a\u4e00\u822c\u90fd\u76f4\u63a5\u8bbe\u7f6e\u4e3a16G\u5927\u5c0f<\/p>\n

3\u3001 \u5efa\u8bae\u8bbe\u7f6e\/boot\u5206\u533a\uff0cLinux\u5f15\u5bfc\u5206\u533a\uff0c\u5982\u5185\u6838\u6587\u4ef6\u7b49\uff0c\u4e00\u822c\u6240\u6709\u6587\u4ef6\u4e00\u5171\u624d\u51e0\u5341M\u7684\u5927\u5c0f\uff0c\u56e0\u6b64\u8fd9\u4e2a\u5206\u533a\u5c31\u8bbe\u7f6e\u4e3a100-200M\u5373\u53ef<\/p>\n

5\u3001 \u78c1\u76d8\u5206\u533a\u5de5\u5177fdisk<\/strong><\/div>\n

fdisk\u662f\u9488\u5bf9\u78c1\u76d8\u5bb9\u91cf\u5c0f\u4e8e2T<\/p>\n

[root@cairui ~]# fdisk --help\r\nfdisk: invalid option -- '-'\r\n\r\nfdisk: Usage:\r\nfdisk [options] change partition table\r\nfdisk [options] -l list partition table(s)\r\nfdisk -s give partition size(s) in blocks\r\n\r\nOptions:\r\n-b sector size (512, 1024, 2048 or 4096)\r\n-c switch off DOS-compatible mode\r\n-h print help\r\n-u give sizes in sectors instead of cylinders\r\n-v print version\r\n-C specify the number of cylinders\r\n-H specify the number of heads\r\n-S specify the number of sectors per track\r\n\r\n: Success\r\n<\/pre>\n

\"\"<\/p>\n

[root@localhost ~]# fdisk \/dev\/sda1\u3000\u3000#\u5bf9\/dev\/sda1\u8fdb\u884c\u5206\u533a\u64cd\u4f5c\r\nDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel\r\nBuilding a new DOS disklabel with disk identifier 0x02fadd9c.\r\nChanges will remain in memory only, until you decide to write them.\r\nAfter that, of course, the previous content won't be recoverable.\r\n\r\nWarning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)\r\n\r\nWARNING: DOS-compatible mode is deprecated. It's strongly recommended to\r\nswitch off the mode (command 'c') and change display units to\r\nsectors (command 'u').\r\n\r\nCommand (m for help): m\r\nCommand action\r\na toggle a bootable flag\r\nb edit bsd disklabel\r\nc toggle the dos compatibility flag\r\nd delete a partition\u3000\u3000#\u5220\u9664\u4e00\u4e2a\u5206\u533a\r\nl list known partition types\r\nm print this menu\r\nn add a new partition\u3000\u3000#\u65b0\u5efa\u4e00\u4e2a\u5206\u533a\r\no create a new empty DOS partition table\r\np print the partition table\u3000\u3000#\u6253\u5370\u51fa\u5206\u533a\u8868\u4fe1\u606f\r\nq quit without saving changes\u3000\u3000#\u4e0d\u4fdd\u5b58\u9000\u51fa\r\ns create a new empty Sun disklabel\r\nt change a partition's system id\r\nu change display\/entry units\r\nv verify the partition table\r\nw write table to disk and exit\u3000\u3000#\u5c06\u5206\u533a\u4fe1\u606f\u5199\u5165\u5206\u533a\u8868\u5e76\u9000\u51fa\u7a0b\u5e8f\r\nx extra functionality (experts only)\r\n<\/pre>\n
Command action\r\ne extended\r\np primary partition (1-4)\r\np\r\nPartition number (1-4): 1\r\nFirst cylinder (1-2610, default 1): \u8bbe\u7f6e\u8d77\u59cb\u67f1\u9762\r\nUsing default value 1\r\nLast cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610):\r\n\u8bbe\u7f6e\u5927\u5c0f\u6216\u67f1\u9762\r\nUsing default value 2610\r\nCommand (m for help): m\r\nCommand action\r\na toggle a bootable flag\r\nb edit bsd disklabel\r\nc toggle the dos compatibility flag\r\nd delete a partition\r\nl list known partition types\r\nm print this menu\r\nn add a new partition\r\no create a new empty DOS partition table\r\np print the partition table\r\nq quit without saving changes\r\ns create a new empty Sun disklabel\r\nt change a partition's system id\r\nu change display\/entry units\r\nv verify the partition table\r\nw write table to disk and exit\r\nx extra functionality (experts only)\r\nCommand (m for help): w\r\nThe partition table has been altered!\r\nCalling ioctl() to re-read partition table.\r\nSyncing disks.\r\nCommand (m for help): p \u6253\u5370\u5206\u533a\u8868\u4fe1\u606f\r\nDisk \/dev\/sdb: 21.5 GB, 21474836480 bytes\r\n255 heads, 63 sectors\/track, 2610 cylinders\r\nUnits = cylinders of 16065 * 512 = 8225280 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\n121 \/ 753\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\nDisk identifier: 0xb712cc55\r\nDevice Boot Start End Blocks Id System\r\n\/dev\/sdb1 1 2610 20964793+ 83 Linux\r\n\u5206\u533a\u5b8c\u6210\u540e\u6267\u884c partprobe \u901a\u77e5\u7cfb\u7edf\u5206\u533a\u8868\u53d1\u751f\u6539\u53d8\r\n\u63a5\u4e0b\u6765\u8fdb\u884c\u683c\u5f0f\u5316\u5206\u533a\r\n[root@Centos ~]# mkfs.ext3 \/dev\/sdb1\r\nmke2fs 1.41.12 (17-May-2010)\r\nFilesystem label=\r\nOS type: Linux\r\nBlock size=4096 (log=2)\r\nFragment size=4096 (log=2)\r\nStride=0 blocks, Stripe width=0 blocks\r\n1310720 inodes, 5241198 blocks\r\n262059 blocks (5.00%) reserved for the super user\r\nFirst data block=0\r\nMaximum filesystem blocks=4294967296\r\n160 block groups\r\n32768 blocks per group, 32768 fragments per group\r\n8192 inodes per group\r\nSuperblock backups stored on blocks:\r\n32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,\r\n4096000\r\nWriting inode tables: done\r\nCreating journal (32768 blocks): done\r\nWriting superblocks and filesystem accounting information: done\r\nThis filesystem will be automatically checked every 24 mounts or\r\n180 days, whichever comes first. Use tune2fs -c or -i to override.\r\n[root@Centos ~]# tune2fs -c -1 \/dev\/sdb1\r\ntune2fs 1.41.12 (17-May-2010)\r\nSetting maximal mount count to -1\r\n[root@Centos ~]# mount \/dev\/sdb1 \/mnt \u6302\u8f7d\u5206\u533a\u81f3\/mnt \u4e0b\r\n[root@Centos ~]# df -h\r\nFilesystem Size Used Avail Use% Mounted on\r\n\/dev\/mapper\/VolGroup-lv_root 50G 3.5G 44G 8% \/\r\ntmpfs 932M 0 932M 0% \/dev\/shm\r\n\/dev\/sda1 485M 39M 421M 9% \/boot\r\n122 \/ 753\r\n\/dev\/mapper\/VolGroup-lv_home 26G 215M 24G 1% \/home\r\n\/dev\/sdb1 20G 172M 19G 1% \/mnt\r\n<\/pre>\n
6\u3001 \u78c1\u76d8\u5206\u533a\u5de5\u5177parted<\/strong><\/div>\n

\u7531\u4e8e\u73af\u5883\u9650\u5236\u65e0\u6cd5\u67092T\u6216\u8005\u4ee5\u4e0a\u5927\u5c0f\u7684\u78c1\u76d8\uff0c\u53ea\u80fd\u6a21\u62df\u73af\u5883\u6765\u4f7f\u7528parted\u5206\u533a\u5de5\u5177\u6765\u8fdb\u884c\u5206\u533a<\/p>\n

[root@Centos ~]# parted \/dev\/sdb mklabel gpt\r\n\u5c06\u78c1\u76d8\u8f6c\u6362\u6210 gpt \u7684\u683c\u5f0f\r\n[root@Centos ~]# parted \/dev\/sdb mkpart primary 0 200\uff08200M\uff09\r\nWarning: The resulting partition is not properly aligned for best\r\nperformance.\r\nIgnore\/Cancel? Ignore\r\n[root@Centos ~]# parted \/dev\/sdb p \u6253\u5370\u5206\u533a\u8868\u4fe1\u606f\r\nModel: VMware, VMware Virtual S (scsi)\r\nDisk \/dev\/sdb: 1074MB\r\nSector size (logical\/physical): 512B\/512B\r\nPartition Table: gpt\r\nNumber Start End Size File system Name Flags\r\n1 17.4kB 200MB 200MB primary\r\n[root@Centos ~]# parted \/dev\/sdb mkpart primary 201 1073\r\n\u5206\u533a\u5e76\u8bbe\u7f6e\u5927\u5c0f\r\nInformation: You may need to update \/etc\/fstab.\r\n[root@Centos ~]# parted \/dev\/sdb p \u6253\u5370\u5206\u533a\u8868\u4fe1\u606f\r\nModel: VMware, VMware Virtual S (scsi)\r\nDisk \/dev\/sdb: 1074MB\r\nSector size (logical\/physical): 512B\/512B\r\nPartition Table: gpt\r\nNumber Start End Size File system Name Flags\r\n1 17.4kB 200MB 200MB primary\r\n2 201MB 1073MB 871MB primary\r\n[root@Centos ~]# mkfs.ext4 \/dev\/sdb1\r\nmke2fs 1.41.12 (17-May-2010)\r\nFilesystem label=\r\nOS type: Linux\r\nBlock size=1024 (log=0)\r\nFragment size=1024 (log=0)\r\n123 \/ 753\r\nStride=0 blocks, Stripe width=0 blocks\r\n48960 inodes, 195296 blocks\r\n9764 blocks (5.00%) reserved for the super user\r\nFirst data block=1\r\nMaximum filesystem blocks=67371008\r\n24 block groups\r\n8192 blocks per group, 8192 fragments per group\r\n2040 inodes per group\r\nSuperblock backups stored on blocks:\r\n8193, 24577, 40961, 57345, 73729\r\nWriting inode tables: done\r\nCreating journal (4096 blocks): done\r\nWriting superblocks and filesystem accounting information: done\r\nThis filesystem will be automatically checked every 36 mounts or\r\n180 days, whichever comes first. Use tune2fs -c or -i to override.\r\n[root@Centos ~]# tune2fs -c -1 \/dev\/sdb1\r\ntune2fs 1.41.12 (17-May-2010)\r\nSetting maximal mount count to -1\r\n[root@Centos ~]# mount \/dev\/sdb1 \/mnt\r\n[root@Centos ~]# df -h\r\nFilesystem Size Used Avail Use% Mounted on\r\n\/dev\/mapper\/VolGroup-lv_root 50G 3.5G 44G 8% \/\r\ntmpfs 932M 0 932M 0% \/dev\/shm\r\n\/dev\/sda1 485M 39M 421M 9% \/boot\r\n\/dev\/mapper\/VolGroup-lv_home 26G 215M 24G 1% \/home\r\n\/dev\/sdb1 185M 5.6M 170M 4% \/mnt\r\n<\/pre>\n
[root@cairui ~]# parted --help\r\nUsage: parted [OPTION]... [DEVICE [COMMAND [PARAMETERS]...]...]\r\nApply COMMANDs with PARAMETERS to DEVICE. If no COMMAND(s) are given, run in\r\ninteractive mode.\r\n\r\nOPTIONs:\r\n-h, --help displays this help message\r\n-l, --list lists partition layout on all block devices\r\n-m, --machine displays machine parseable output\r\n-s, --script never prompts for user intervention\r\n-v, --version displays the version\r\n-a, --align=[none|cyl|min|opt] alignment for new partitions\r\n\r\nCOMMANDs:\r\nalign-check TYPE N check partition N for TYPE(min|opt)\r\nalignment\r\ncheck NUMBER do a simple check on the file system\r\ncp [FROM-DEVICE] FROM-NUMBER TO-NUMBER copy file system to another partition\r\nhelp [COMMAND] print general help, or help on\r\nCOMMAND\r\nmklabel,mktable LABEL-TYPE create a new disklabel (partition\r\ntable)\r\nmkfs NUMBER FS-TYPE make a FS-TYPE file system on\r\npartition NUMBER\r\nmkpart PART-TYPE [FS-TYPE] START END make a partition\r\nmkpartfs PART-TYPE FS-TYPE START END make a partition with a file system\r\nmove NUMBER START END move partition NUMBER\r\nname NUMBER NAME name partition NUMBER as NAME\r\nprint [devices|free|list,all|NUMBER] display the partition table,\r\navailable devices, free space, all found partitions, or a particular\r\npartition\r\nquit exit program\r\nrescue START END rescue a lost partition near START\r\nand END\r\nresize NUMBER START END resize partition NUMBER and its file\r\nsystem\r\nrm NUMBER delete partition NUMBER\r\nselect DEVICE choose the device to edit\r\nset NUMBER FLAG STATE change the FLAG on partition NUMBER\r\ntoggle [NUMBER [FLAG]] toggle the state of FLAG on partition\r\nNUMBER\r\nunit UNIT set the default unit to UNIT\r\nversion display the version number and\r\ncopyright information of GNU Parted\r\n<\/pre>\n
\n

\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/www.cnblogs.com\/caicairui\/p\/8422251.html<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1a http:\/\/lrxjmw.cn\/linux-system-disk.html<\/a>\u7f16\u8f91\uff1a\u51af\u745e\u6d9b\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5bfc\u8bfb \u6240\u6709\u6709\u7cfb\u7edf\u90fd\u4e00\u6837\uff0c\u90fd\u662f\u4e00\u79cd\u8f6f\u4ef6\u88ab\u5b89\u88c5\u4e8e\u67d0\u4e2a\u786c\u4ef6\u4e4b\u4e0a\uff0c\u8fd9\u4e2a\u786c\u4ef6\u65e0\u5916\u975e\u662f\u4e00\u79cd\u5b58\u50a8\u8bbe\u5907\uff0c\u901a\u5e38\u64cd\u4f5c\u7cfb\u7edf\u90fd\u662f\u5b89\u88c5\u5728 […]<\/p>\n","protected":false},"author":1329,"featured_media":94920,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-94905","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\/94905","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\/1329"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=94905"}],"version-history":[{"count":6,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/94905\/revisions"}],"predecessor-version":[{"id":291276,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/94905\/revisions\/291276"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/94920"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=94905"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=94905"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=94905"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}