先执行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 filesystemtype '(null)'
磁盘挂载之前要先格式化,有可能你还没有格式化磁盘旧挂载了。执行
mkfs.ext3 /dev/vdb1 就可以格式化磁盘,然后按照 1 中的步骤操作就可以了。

技术
今日推荐
PPT
阅读数 126
下载桌面版
GitHub
百度网盘(提取码:draw)
Gitee
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:766591547
关注微信