{"id":56933,"date":"2023-07-04T18:21:12","date_gmt":"2023-07-04T10:21:12","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=56933"},"modified":"2023-07-04T18:21:12","modified_gmt":"2023-07-04T10:21:12","slug":"linux-mount-disk","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-mount-disk.html","title":{"rendered":"Linux\u6302\u8f7d\u5206\u533a\u7684\u8111\u6b8b\u7bc7\uff0c\u65b0\u624b\u5fc5\u770b\uff0c\u8001\u9e1f\u7ed5\u9053"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nlinux\u6dfb\u52a0\u786c\u76d8\u540e\u90fd\u9700\u8981\u4e00\u4e2a\u64cd\u4f5c\u64cd\u4f5c\u624d\u80fd\u4f7f\u7528\u90a3\u5c31\u662f\u6302\u8f7d\uff0c\u5728\u4f01\u4e1a\u73af\u5883\u4e2d\u6211\u4eec\u7684\u6570\u636e\u76d8\u548c\u7cfb\u7edf\u76d8\u4e00\u822c\u90fd\u662f\u5206\u5f00\u7684\u3002\u524d\u51e0\u5929\u4e00\u4e2a\u670b\u53cb\u8ba9\u6211\u5e2e\u5fd9\u5206\u4e0b\u533a\u628a\u6570\u636e\u76d8\u6302\u8f7d\u5230\/home\u4e0b\u53bb\u3002\uff08\u4e2a\u4eba\u9700\u6c42\u5427\uff0c\u6709\u4e9b\u516c\u53f8\u4e00\u822c\u90fd\u662f\u4e13\u95e8\u5728'\/'\u4e0b\u9762\u521b\u5efa\u4e00\u4e2adata \u6765\u505a\u6570\u636e\u76d8\uff09\u3002\u64cd\u4f5c\u8bb0\u5f55\u4e0b\u4e86\u6765\u5206\u4eab\u7ed9\u5927\u5bb6\uff0c\u65b0\u624b\u590d\u4e60\uff0c\u8001\u9e1f\u7ed5\u9053\uff08\u5982\u679c\u8fd9\u4e9b\u90fd\u770b\u4e0d\u61c2\u7684\u8bdd\uff0cLinux\u9700\u8981\u6076\u8865\u989d\uff01\uff01\uff01\uff09<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u9700\u6c42<\/span>\uff1a\u9700\u8981\u628a\u7cfb\u7edf\u76d8\u641e\u5230\/home \u4e0b\u9762\u3002<\/p>\n

\u601d\u8003<\/span>\uff1a\/home \u4e0b\u9762\u662f\u7528\u6237\u9ed8\u8ba4\u7684\u5bb6\u76ee\u5f55\uff0c\u5982\u679c\u7528\u6237\u5bb6\u76ee\u5f55\u6709\u6570\u636e\u662f\u4f1a\u88ab\u8986\u76d6\u7684\u3002\u627e\u670b\u53cb\u786e\u8ba4\u662f\u521a\u5b89\u88c5\u7684\u7cfb\u7edf\u624d\u5f00\u59cb\u641e\u7684\u3002\u66f4\u6539\u5206\u533a\u5927\u5c0f\u9996\u5148\u60f3\u5230\u7684\u662flvm\uff0c\u4f46\u662f\u770b\u4e86\u5ba2\u6237\u7684\u78c1\u76d8\u4fe1\u606f\u53d1\u73b0\u4e0d\u9700\u8981\u8003\u8651\u8fd9\u4e9b\uff0c\u600e\u4e48\u7b80\u5355\u600e\u4e48\u6765\u3002<\/p>\n

\u67e5\u770b\u786c\u76d8\u4fe1\u606f<\/strong><\/div>\n
[root@localhost \/]# fdisk -l            \u67e5\u770b\u786c\u76d8\u4fe1\u606f<\/strong>\r\n\r\nDisk \/dev\/sda: 240.1 GB, 240057409536 bytes, 468862128 sectors\r\nUnits = sectors of 1 * 512 = 512 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\nDisk label type: dos\r\nDisk identifier: 0x00085ef7\r\n\r\n   Device Boot      Start         End      Blocks   Id  System\r\n\/dev\/sda1   *        2048     1026047      512000   83  Linux\r\n\/dev\/sda2         1026048    17803263     8388608   82  Linux swap \/ Solaris\r\n\/dev\/sda3        17803264   468860927   225528832   83  Linux\r\n\r\nDisk \/dev\/sdb: 240.1 GB, 240057409536 bytes, 468862128 sectors\r\nUnits = sectors of 1 * 512 = 512 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\n\r\n\r\nDisk \/dev\/sdc: 500.1 GB, 500107862016 bytes, 976773168 sectors\r\nUnits = sectors of 1 * 512 = 512 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\nDisk label type: dos\r\nDisk identifier: 0x0007a974\r\n\r\n   Device Boot      Start         End      Blocks   Id  System\r\n\/dev\/sdc1            2048   976773119   488385536   8e  Linux LVM\r\n\r\nDisk \/dev\/sdd: 240.1 GB, 240057409536 bytes, 468862128 sectors\r\nUnits = sectors of 1 * 512 = 512 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\nDisk label type: dos\r\nDisk identifier: 0x000a4688\r\n\r\n   Device Boot      Start         End      Blocks   Id  System\r\n\/dev\/sdd1   *        2048     1026047      512000   83  Linux\r\n\/dev\/sdd2         1026048   468860927   233917440   8e  Linux LVM\r\n<\/pre>\n

\u6570\u636e\u7684\u64cd\u4f5c\u662f\u9700\u8981\u975e\u5e38\u4e25\u8c28\u7684\uff0c\u770b\u5230\u4e86\u8fd9\u4e48\u591a\u7684\u786c\u76d8\uff0c\u6709\u770b\u5230\u4e86lvm\u5206\u533a\u3002\u5bf9\u4e8e\u65b0\u88c5\u7684\u7cfb\u7edf\u6211\u7b2c\u4e00\u611f\u89c9\u662f\uff1a\u96be\u9053\u8981\u6211\u4fee\u590dlvm\u5206\u533a\u5417\uff1f\u7ecf\u8fc7\u548c\u670b\u53cb\u786e\u8ba4\u53d1\u73b0\u6211\u60f3\u591a\u4e86\uff0c\u53ea\u662f\u6302\u8f7d\uff0c\u78c1\u76d8\u5df2\u7ecf\u62d4\u6389\u4e86\u3002<\/p><\/blockquote>\n

\u627e\u5230\u5bf9\u5e94\u786c\u76d8\u5206\u533a\u683c\u5f0f\u5316<\/strong><\/div>\n
\u78c1\u76d8\u5206\u533a<\/strong><\/span><\/div>\n
[root@localhost \/]# fdisk \/dev\/sdb              \\\\\u9488\u5bf9\u7b2c\u4e8c\u5757\u76d8\u5206\u533a<\/strong>\r\nWelcome to fdisk (util-linux 2.23.2).\r\n\r\nChanges will remain in memory only, until you decide to write them.\r\nBe careful before using the write command.\r\n\r\nDevice does not contain a recognized partition table\r\nBuilding a new DOS disklabel with disk identifier 0x6511fa23.\r\n\r\nCommand (m for help): p                   \\\\\u67e5\u770b\u5df2\u6709\u5206\u533a<\/strong>\r\n\r\nDisk \/dev\/sdb: 240.1 GB, 240057409536 bytes, 468862128 sectors\r\nUnits = sectors of 1 * 512 = 512 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\nDisk label type: dos\r\nDisk identifier: 0x6511fa23\r\n\r\n   Device Boot      Start         End      Blocks   Id  System\r\n\r\nCommand (m for help): n                    \\\\\u521b\u5efa\u5206\u533a<\/strong>\r\nPartition type:\r\n   p   primary (0 primary, 0 extended, 4 free)\r\n   e   extended\r\nSelect (default p): p                        \\\\\u4e3b\u5206\u533a<\/strong>\r\nPartition number (1-4, default 1): \r\nFirst sector (2048-468862127, default 2048): \r\nUsing default value 2048\r\nLast sector, +sectors or +size{K,M,G} (2048-468862127, default 468862127): \r\nUsing default value 468862127\r\nPartition 1 of type Linux and of size 223.6 GiB is set\r\n\r\nCommand (m for help): p                     \\\\\u67e5\u770b\u786e\u8ba4\u5206\u533a<\/strong>\r\n \r\nDisk \/dev\/sdb: 240.1 GB, 240057409536 bytes, 468862128 sectors\r\nUnits = sectors of 1 * 512 = 512 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\nDisk label type: dos\r\nDisk identifier: 0x6511fa23\r\n\r\n   Device Boot      Start         End      Blocks   Id  System\r\n\/dev\/sdb1            2048   468862127   234430040   83  Linux\r\n\r\nCommand (m for help): w                    \\\\\u4fdd\u5b58\u6539\u5206\u533a<\/strong>\r\nThe partition table has been altered!\r\n\r\nCalling ioctl() to re-read partition table.\r\nSyncing disks.\r\n<\/pre>\n
\u5206\u533a\u683c\u5f0f\u5316<\/strong><\/span><\/div>\n
[root@localhost \/]# mkfs             \\\\tab \u4e07\u80fd\u64cd\u4f5c<\/strong>\r\nmkfs         mkfs.btrfs   mkfs.cramfs  mkfs.ext2    mkfs.ext3    mkfs.ext4    mkfs.minix   mkfs.xfs     \r\n[root@localhost \/]# mkfs.xfs \/dev\/sdb1         \u683c\u5f0f\u5316sdb1<\/strong>\r\nmeta-data=\/dev\/sdb1              isize=256    agcount=4, agsize=14651878 blks\r\n         =                       sectsz=512   attr=2, projid32bit=1\r\n         =                       crc=0        finobt=0\r\ndata     =                       bsize=4096   blocks=58607510, imaxpct=25\r\n         =                       sunit=0      swidth=0 blks\r\nnaming   =version 2              bsize=4096   ascii-ci=0 ftype=0\r\nlog      =internal log           bsize=4096   blocks=28616, version=2\r\n         =                       sectsz=512   sunit=0 blks, lazy-count=1\r\nrealtime =none                   extsz=4096   blocks=0, rtextents=0\r\n<\/pre>\n
\u67e5\u770b\u68c0\u67e5\u5206\u533a<\/strong><\/span><\/div>\n
\r\n[root@localhost \/]# lsblk<\/strong>\r\nNAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT\r\nsda      8:0    0 223.6G  0 disk \r\n\u251c\u2500sda1   8:1    0   500M  0 part \/boot\r\n\u251c\u2500sda2   8:2    0     8G  0 part [SWAP]\r\n\u2514\u2500sda3   8:3    0 215.1G  0 part \/\r\nsdb      8:16   0 223.6G  0 disk \r\n\u2514\u2500sdb1   8:17   0 223.6G  0 part \r\n<\/pre>\n
\u6302\u8f7d\u5206\u533a\u5230\"\/home\"<\/strong><\/div>\n
\u6302\u8f7d\u5206\u533a\uff0c\u627e\u5230uuid\uff0c\u5199\u5165fstab<\/strong><\/span><\/div>\n
[root@localhost \/]# blkid \/dev\/sdb1<\/strong>             \u67e5\u770bsdb1 \u7684uuid   \u5199\u5165fstab uuid \u6700\u7a33\u5b9a  \/dev\/sdb1 \u4e5f\u53ef\u4ee5\r\n\/dev\/sdb1: UUID=\"ffbd4feb-c55e-40ca-86d3-c43919bd9060\" TYPE=\"xfs\" \r\n[root@localhost \/]# echo \"\/dev\/sdb1: UUID=\"ffbd4feb-c55e-40ca-86d3-c43919bd9060\" TYPE=\"xfs\" \" >> \/etc\/fstab \r\n[root@localhost \/]# vim \/etc\/fstab \r\n-bash: vim: command not found\r\n\r\n[root@localhost \/]# vi \/etc\/fstab           \u5199\u5165fstab\r\n[root@localhost \/]# tail -n 2 \/etc\/fstab<\/strong>\r\nffbd4feb-c55e-40ca-86d3-c43919bd9060  \/home xfs defaults 0 0<\/strong>\r\n#\/dev\/sdb1 \/home xfs defaults 0 0         \\\\uuid \u548c \/dev\/sdb1 \u533a\u522b\uff1f\uff1f\r\n[root@localhost \/]# mount -a                 \u91cd\u65b0\u8bfb\u53d6\u914d\u7f6e\u6587\u4ef6\r\n<\/strong><\/pre>\n
\u68c0\u67e5\u6302\u8f7d\u6210\u679c\uff0c\u6302\u8f7d\u6210\u529f\uff01\uff01<\/strong><\/span><\/div>\n
[root@localhost \/]# df -Th<\/strong>\r\nFilesystem     Type      Size  Used Avail Use% Mounted on\r\n\/dev\/sda3      xfs       215G  852M  215G   1% \/\r\ndevtmpfs       devtmpfs  7.8G     0  7.8G   0% \/dev\r\ntmpfs          tmpfs     7.8G     0  7.8G   0% \/dev\/shm\r\ntmpfs          tmpfs     7.8G  8.4M  7.8G   1% \/run\r\ntmpfs          tmpfs     7.8G     0  7.8G   0% \/sys\/fs\/cgroup\r\n\/dev\/sda1      xfs       497M  119M  378M  24% \/boot\r\ntmpfs          tmpfs     1.6G     0  1.6G   0% \/run\/user\/0\r\n\/dev\/sdb1      xfs       224G   33M  224G   1% \/home<\/strong>\r\n\r\n[root@localhost \/]# lsblk<\/strong>\r\nNAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT\r\nsda      8:0    0 223.6G  0 disk \r\n\u251c\u2500sda1   8:1    0   500M  0 part \/boot\r\n\u251c\u2500sda2   8:2    0     8G  0 part [SWAP]\r\n\u2514\u2500sda3   8:3    0 215.1G  0 part \/\r\nsdb      8:16   0 223.6G  0 disk \r\n\u2514\u2500sdb1   8:17   0 223.6G  0 part \/home\r\n<\/strong><\/pre>\n

ok\uff0c\u6536\u5de5\uff01\uff01<\/p>\n

PS\uff1a\u83dc\u9e1f\u7ea7\u6559\u7a0b\uff0c\u65b0\u624b\u590d\u4e60\uff0c\u8001\u9e1f\u52ff\u55b7\uff01\u5982\u679c\u8fd9\u4e9b\u4f60\u90fd\u770b\u4e0d\u61c2\u7684\u8bdd\uff0c\u771f\u7684\u8981\u6076\u8865\u4e86\uff01\uff01\uff01<\/p>\n

\"\"<\/p>\n

\u672c\u6587\u539f\u521b\u5730\u5740\uff1ahttp:\/\/lrxjmw.cn\/linux-mount-disk.html<\/a>\u4f5c\u8005\uff1a\u9676\u6b66\u6770\uff0c\u5ba1\u6838\u5458\uff1a\u51af\u632f\u534e<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"

\u5bfc\u8bfb linux\u6dfb\u52a0\u786c\u76d8\u540e\u90fd\u9700\u8981\u4e00\u4e2a\u64cd\u4f5c\u64cd\u4f5c\u624d\u80fd\u4f7f\u7528\u90a3\u5c31\u662f\u6302\u8f7d\uff0c\u5728\u4f01\u4e1a\u73af\u5883\u4e2d\u6211\u4eec\u7684\u6570\u636e\u76d8\u548c\u7cfb\u7edf\u76d8\u4e00\u822c\u90fd\u662f\u5206\u5f00\u7684 […]<\/p>\n","protected":false},"author":63,"featured_media":57006,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-56933","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\/56933","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\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=56933"}],"version-history":[{"count":17,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/56933\/revisions"}],"predecessor-version":[{"id":276677,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/56933\/revisions\/276677"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/57006"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=56933"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=56933"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=56933"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}