首页 Linux网维 阿里云服务器挂载数据盘

阿里云服务器挂载数据盘

阿里服务器申请到后,即便申请了数据盘,系统里面也没有自动配置上,看到的只有系统盘20GB,需要手动配置数据盘[root@iZcmake-2.8.5]# fdisk -l Disk …

阿里服务器申请到后,即便申请了数据盘,系统里面也没有自动配置上,看到的只有系统盘20GB,需要手动配置数据盘[root@iZcmake-2.8.5]# fdisk -l Disk /dev/xvda: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00078f9c Device Boot Start End Blocks Id System /dev/xvda1 * 1 2611 20970496 83 Linux Disk /dev/xvdb: 322.1 GB, 322122547200 bytes 255 heads, 63 sectors/track, 39162 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 可以看到里面有一个300GB的硬盘/dev/xvdb,但是没有其他信息,因为没有格式化。

OK,现在手动格式化这个硬盘 fdisk /dev/xvdb 在 fdisk 程序里输入 n, 然后输入 p,在后面分区开头和结尾选择里直接回车格式化位一个分区; 然后输入 p 可看到分区信息,再输入 w 写入分区配置,然后开始显示格式化进度条,结束后就OK了。

Command (m for help): p Disk /dev/xvdb: 322.1 GB, 322122547200 bytes 255 heads, 63 sectors/track, 39162 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x976480a3 Device Boot Start End Blocks Id System Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-39162, default 1): Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-39162, default 39162): Using default value 39162 Command (m for help): p Disk /dev/xvdb: 322.1 GB, 322122547200 bytes 255 heads, 63 sectors/track, 39162 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x976480a3 Device Boot Start End Blocks Id System /dev/xvdb1 1 39162 314568733+ 83 Linux Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. [root@iZcmake-2.8.5]# fdisk -l 挂载分区到目录: [root@iZcmake-2.8.5]# mkdir -pv /data mkdir: created directory `/data [root@iZcmake-2.8.5]# mount /dev/xvdb1 /data 如果这一步提示错误: mount: you must specify the filesystem type 那是因为没有格式化分区导致的,重新格式化再mount就OK: mkfs.ext3 /dev/xvdb1 mount /dev/xvdb1 /data [root@iZcmake-2.8.5]# 将配置写入fstab: vim /etc/fstab 末尾增加一行: /dev/xvdb1 /data ext3 defaults 1 1 然后保存退出即可。

免责声明:文章内容不代表本站立场,本站不对其内容的真实性、完整性、准确性给予任何担保、暗示和承诺,仅供读者参考,文章版权归原作者所有。如本文内容影响到您的合法权益(内容、图片等),请及时联系本站,我们会及时删除处理。

作者: 3182235786a

为您推荐

linux文件命令

linux文件命令

在 Linux 中,我们可以使用 `with open()` 语句和 `write()` 函数来写入文件。以下是一个简单...
linux的命令

linux的命令

以下是一个简单的 Linux 命令示例,该命令将显示当前日期和时间: “`c #include <st...
linux 命令

linux 命令

由于 Linux 命令是由 C 语言编写的,因此下面是一个简单的用中文编写的 Linux 命令示例,它将输出“Hello...
linux命令tar

linux命令tar

这个问题看起来有些模糊,我不确定您是想了解如何在 Linux 系统中使用 tar 命令,还是如何编写一个名为 tar 的...
linux压缩命令

linux压缩命令

Linux压缩命令:高效管理文件和目录 Linux操作系统提供了一系列强大的压缩命令,使您能够高效地管理文件和目录。无论...

发表回复

返回顶部