【139】阿里雲掛載雲盤的方法

先執行fdisk -l 可以看到硬盤情況,此時還沒有掛載雲盤。

fdisk -l


Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000b1b45

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    83884031    41940992   83  Linux

一、掛載到新建的目錄中

硬盤是 /dev/vda

阿里雲控制檯 > 雲服務器ECS > 左側菜單點擊存儲與快照 > 點擊雲盤 > 在相應雲盤上點擊更多 > 點擊掛載

在這裏插入圖片描述

點擊掛載後會彈出對話框。

在這裏插入圖片描述

目標實例中選擇你要掛載的服務器。點擊執行掛載。阿里雲會提示掛載中,現在要等待阿里雲掛載雲盤。

在這裏插入圖片描述

等待掛載成功後,進入Linux命令界面,輸入 fdisk -l 命令

[root@iZm5e5w8irul9hn3uva51fZ ~]# fdisk -l

Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000b1b45

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    83884031    41940992   83  Linux

Disk /dev/vdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@iZm5e5w8irul9hn3uva51fZ ~]#

此時可以看到有個硬盤 /dev/vdb ,我們需要做掛載。

輸入 fdisk /dev/vdb

Command (m for help): 這一行的時候輸入n,表示添加一個新分區。如果輸入m可以查看幫助。

Select (default p): 輸入p,默認值

Partition Number(1-4 default 1): 分區數量,我們選擇1個分區,輸入1就行。

First sector(defualt 2048): 直接按回車,用默認值。

Last sector, +sectors or +size{K,M,G}:直接按回車,用默認值。

Command (m for help): 輸入w保存

最後提示操作成功。

輸入 fdisk -l

[root@iZm5e5w8irul9hn3uva51fZ ~]# fdisk -l

Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000b1b45

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    83884031    41940992   83  Linux

Disk /dev/vdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x164093e9

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048   209715199   104856576   83  Linux

在硬盤/dev/vdb 下面可以查到 devicce boot 是 /dev/vdb1
格式化硬盤:mkfs.ext3 /dev/vdb1

mkdir /data0
mount /dev/vdb1 /data0

寫入分區表

echo '/dev/vdb1  /data0 ext3    defaults    0  0' >> /etc/fstab

二、常見錯誤

掛載的時候可能會遇見以下錯誤:

[root@i4qr4iaaq ~]# mount /dev/vdb1 /root/relationship/
mount: /dev/vdb1 is write-protected, mounting read-only
mount: unknown filesystem type '(null)'

磁盤掛載之前要先格式化,有可能你還沒有格式化磁盤舊掛載了。執行
mkfs.ext3 /dev/vdb1 就可以格式化磁盤,然後按照 1 中的步驟操作就可以了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章