阿里云服务器挂载数据盘

阿里服务器申请到后,即便申请了数据盘,系统里面也没有自动配置上,看到的只有系统盘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

然后保存退出即可。



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值