{"id":664,"date":"2023-02-26T13:57:29","date_gmt":"2023-02-26T05:57:29","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=664"},"modified":"2023-04-29T18:42:09","modified_gmt":"2023-04-29T10:42:09","slug":"cloud-server-mount-data-disk","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/26\/cloud-server-mount-data-disk\/","title":{"rendered":"\u4e91\u670d\u52a1\u5668\u6302\u8f7d\u6570\u636e\u76d8"},"content":{"rendered":"<p>\u4e91\u670d\u52a1\u5668\uff08ECS\uff09\u662f\u4e00\u79cd\u7b80\u5355\u9ad8\u6548\u3001\u5b89\u5168\u53ef\u9760\u3001\u5904\u7406\u80fd\u529b\u53ef\u5f39\u6027\u4f38\u7f29\u7684\u8ba1\u7b97\u670d\u52a1\u3002\u76ee\u524d\uff0c\u5927\u90e8\u5206\u4e91\u670d\u52a1\u5668\u8d2d\u4e70\u7684\u6570\u636e\u76d8\u9700\u8981\u81ea\u884c\u6302\u8f7d\uff0c\u4ee5\u963f\u91cc\u4e91\u4e3a\u4f8b\uff0c\u6302\u8f7d\u6570\u636e\u76d8\u7684\u6b65\u9aa4\u4e3a\uff1a<\/p>\n<p><!-- more --><\/p>\n<pre><code>[root@appblog.cn ~]# df -hT  \/\/\u67e5\u770b\u5206\u533a\u683c\u5f0f\u53ca\u7a7a\u95f4\u4f7f\u7528\u4fe1\u606f(-h\u7a7a\u95f4\u4f7f\u7528-T\u5206\u533a\u683c\u5f0f)\nFilesystem     Type   Size  Used Avail Use% Mounted on\n\/dev\/xvda1     ext4    20G  2.8G   16G  15% \/  \/\/\u53ea\u6709\u7cfb\u7edf\u76d8\uff0c\u6570\u636e\u76d8\u8fd8\u672a\u6302\u8f7d\ntmpfs          tmpfs  498M     0  498M   0% \/dev\/shm\n[root@appblog.cn ~]# fdisk -l  \/\/\u67e5\u770b\u78c1\u76d8\u4fe1\u606f\n\nDisk \/dev\/xvda: 21.5 GB, 21474836480 bytes\n255 heads, 63 sectors\/track, 2610 cylinders\nUnits = cylinders of 16065 * 512 = 8225280 bytes\nSector size (logical\/physical): 512 bytes \/ 512 bytes\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\nDisk identifier: 0x00078f9c\n\n    Device Boot      Start         End      Blocks   Id  System\n\/dev\/xvda1   *           1        2611    20970496   83  Linux\n\nDisk \/dev\/xvdb: 21.5 GB, 21474836480 bytes  \/\/\u53ef\u4ee5\u770b\u5230\u5206\u914d\u6709\u6570\u636e\u76d8\n255 heads, 63 sectors\/track, 2610 cylinders\nUnits = cylinders of 16065 * 512 = 8225280 bytes\nSector size (logical\/physical): 512 bytes \/ 512 bytes\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\nDisk identifier: 0x00000000\n\n[root@appblog.cn ~]# fdisk \/dev\/xvdb  \/\/\u5206\u533a\nDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel\nBuilding a new DOS disklabel with disk identifier 0x41e88dbf.\nChanges will remain in memory only, until you decide to write them.\nAfter that, of course, the previous content won&#039;t be recoverable.\n\nWarning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)\n\nWARNING: DOS-compatible mode is deprecated. It&#039;s strongly recommended to\n         switch off the mode (command &#039;c&#039;) and change display units to\n         sectors (command &#039;u&#039;).\n\nCommand (m for help): n  \/\/\u8f93\u5165n\nCommand action\n   e   extended\n   p   primary partition (1-4)\np  \/\/\u8f93\u5165p\nPartition number (1-4): 1  \/\/\u8f93\u51651\nFirst cylinder (1-2610, default 1):   \/\/\u56de\u8f66\nUsing default value 1\nLast cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610):   \/\/\u56de\u8f66\nUsing default value 2610\n\nCommand (m for help): wq  \/\/\u6267\u884c\nThe partition table has been altered!\n\nCalling ioctl() to re-read partition table.\nSyncing disks.\n[root@appblog.cn ~]# fdisk -l  \/\/\u91cd\u65b0\u67e5\u770b\u78c1\u76d8\u4fe1\u606f\n\nDisk \/dev\/xvda: 21.5 GB, 21474836480 bytes\n255 heads, 63 sectors\/track, 2610 cylinders\nUnits = cylinders of 16065 * 512 = 8225280 bytes\nSector size (logical\/physical): 512 bytes \/ 512 bytes\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\nDisk identifier: 0x00078f9c\n\n    Device Boot      Start         End      Blocks   Id  System\n\/dev\/xvda1   *           1        2611    20970496   83  Linux\n\nDisk \/dev\/xvdb: 21.5 GB, 21474836480 bytes\n255 heads, 63 sectors\/track, 2610 cylinders\nUnits = cylinders of 16065 * 512 = 8225280 bytes\nSector size (logical\/physical): 512 bytes \/ 512 bytes\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\nDisk identifier: 0x41e88dbf\n\n    Device Boot      Start         End      Blocks   Id  System\n\/dev\/xvdb1               1        2610    20964793+  83  Linux  \/\/\u53ef\u4ee5\u770b\u5230\u521b\u5efa\u65b0\u5206\u533a\/dev\/xvdb1\n[root@appblog.cn ~]# mkfs.ext4 \/dev\/xvdb1  \/\/\u683c\u5f0f\u5316\nmke2fs 1.41.12 (17-May-2010)\nFilesystem label=\nOS type: Linux\nBlock size=4096 (log=2)\nFragment size=4096 (log=2)\nStride=0 blocks, Stripe width=0 blocks\n1310720 inodes, 5241198 blocks\n262059 blocks (5.00%) reserved for the super user\nFirst data block=0\nMaximum filesystem blocks=4294967296\n160 block groups\n32768 blocks per group, 32768 fragments per group\n8192 inodes per group\nSuperblock backups stored on blocks: \n        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, \n        4096000\n\nWriting inode tables: done                            \nCreating journal (32768 blocks): done\nWriting superblocks and filesystem accounting information: done\n\nThis filesystem will be automatically checked every 29 mounts or\n180 days, whichever comes first.  Use tune2fs -c or -i to override.\n[root@appblog.cn ~]# mkdir \/data  \/\/\u521b\u5efa\u5206\u533a\u6302\u8f7d\u76ee\u5f55\n[root@appblog.cn ~]# echo &#039;\/dev\/xvdb1 \/data ext4 defaults 0 0&#039; &gt;&gt; \/etc\/fstab  \/\/\u8bbe\u7f6e\u7cfb\u7edf\u542f\u52a8\u6302\u8f7d\u65b0\u5206\u533a\n[root@appblog.cn ~]# cat \/etc\/fstab  \/\/\u67e5\u770b\u542f\u52a8\u6302\u8f7d\u5206\u533a\u4fe1\u606f\n\n#\n# \/etc\/fstab\n# Created by anaconda on Thu Aug 14 21:16:42 2014\n#\n# Accessible filesystems, by reference, are maintained under &#039;\/dev\/disk&#039;\n# See man pages fstab(5), findfs(8), mount(8) and\/or blkid(8) for more info\n#\nUUID=94e4e384-0ace-437f-bc96-057dd64f42ee \/ ext4 defaults,barrier=0 1 1\ntmpfs                   \/dev\/shm                tmpfs   defaults        0 0\ndevpts                  \/dev\/pts                devpts  gid=5,mode=620  0 0\nsysfs                   \/sys                    sysfs   defaults        0 0\nproc                    \/proc                   proc    defaults        0 0\nnone                  \/proc\/xen               xenfs   defaults        0 0\n\/dev\/xvdb1 \/data ext4 defaults 0 0  \/\/\u53ef\u4ee5\u770b\u5230\u65b0\u6dfb\u52a0\u7684\u65b0\u5206\u533a\n[root@appblog.cn ~]# mount -a  \/\/\u6302\u8f7d\u6240\u6709\u5206\u533a\n[root@appblog.cn ~]# df -hT  \/\/\u91cd\u65b0\u67e5\u770b\u5206\u533a\u683c\u5f0f\u53ca\u7a7a\u95f4\u4f7f\u7528\u60c5\u51b5\nFilesystem     Type   Size  Used Avail Use% Mounted on\n\/dev\/xvda1     ext4    20G  2.8G   16G  15% \/\ntmpfs          tmpfs  498M     0  498M   0% \/dev\/shm\n\/dev\/xvdb1     ext4    20G  172M   19G   1% \/data\n[root@appblog.cn ~]# <\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4e91\u670d\u52a1\u5668\uff08ECS\uff09\u662f\u4e00\u79cd\u7b80\u5355\u9ad8\u6548\u3001\u5b89\u5168\u53ef\u9760\u3001\u5904\u7406\u80fd\u529b\u53ef\u5f39\u6027\u4f38\u7f29\u7684\u8ba1\u7b97\u670d\u52a1\u3002\u76ee\u524d\uff0c\u5927\u90e8\u5206\u4e91\u670d\u52a1\u5668\u8d2d\u4e70\u7684\u6570\u636e\u76d8\u9700\u8981 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[90],"tags":[],"class_list":["post-664","post","type-post","status-publish","format-standard","hentry","category-cloud-devops"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/664","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=664"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/664\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=664"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=664"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=664"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}