参考:http://help.aliyun.com/knowledge_detail/5974154.html?spm=5176.788314850.3.2.hUqwXo

1、在阿里云上购买了服务器,又另外买了一块数据盘,这个时候就需要对数据盘进行分区和格式化。

2、使用ssh连接到云服务器,查看数据盘。

  1)在没有分区和格式化数据盘之前,使用 “df –h”命令,是无法看到数据盘的,如下:

[root@iZ94jj63a3sZ ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 20G .4G 18G % /
tmpfs .9G .9G % /dev/shm
[root@iZ94jj63a3sZ ~]#

  2)使用 “fdisk -l” 命令查看

[root@iZ94jj63a3sZ ~]# fdisk -l

Disk /dev/xvda: 21.5 GB,  bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk identifier: 0x00078f9c Device Boot Start End Blocks Id System
/dev/xvda1 * Linux Disk /dev/xvdb: 64.4 GB, 64424509440 bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk identifier: 0x00000000 [root@iZ94jj63a3sZ ~]#

  能够看到 Disk /dev/xvdb: 64.4 GB, 64424509440 bytes  这就是要分区和格式化的数据盘

  3)友情提示:若您执行fdisk -l命令,发现没有 /dev/xvdb 表明您的云服务无数据盘,那么您无需进行挂载,此时该教程对您不适用

3、对数据盘进行分区

  1)执行“fdisk -S 56 /dev/xvdb”命令,对数据盘进行分区;

  2)根据提示,依次输入“n”,“p” ,“1”,两次回车,“wq”,分区就开始了,很快就会完成。

[root@iZ94jj63a3sZ ~]# fdisk -S 56 /dev/xvdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x94d1a2b8.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table will be corrected by w(rite) WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u'). Command (m for help): n
Command action
e extended
p primary partition (-)
p
Partition number (1-4): 1
First cylinder (-, default ):
Using default value
Last cylinder, +cylinders or +size{K,M,G} (-, default ):
Using default value Command (m for help): wq
The partition table has been altered! Calling ioctl() to re-read partition table.
Syncing disks.
[root@iZ94jj63a3sZ ~]#

4、查看新的分区

  使用“fdisk -l”命令可以看到,新的分区xvdb1已经建立完成了。

[root@iZ94jj63a3sZ ~]# fdisk -l

Disk /dev/xvda: 21.5 GB,  bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk identifier: 0x00078f9c Device Boot Start End Blocks Id System
/dev/xvda1 * Linux Disk /dev/xvdb: 64.4 GB, bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk identifier: 0x94d1a2b8 Device Boot Start End Blocks Id System
/dev/xvdb1 1 8811 62910512 83 Linux
[root@iZ94jj63a3sZ ~]#

5、格式化新分区

  以ext4为例:使用“mkfs.ext4 /dev/xvdb1”命令对新分区进行格式化,格式化的时间根据硬盘大小有所不同。

[root@iZ94jj63a3sZ ~]# mkfs.ext4 /dev/xvdb1
mke2fs 1.41. (-May-)
Filesystem label=
OS type: Linux
Block size= (log=)
Fragment size= (log=)
Stride= blocks, Stripe width= blocks
inodes, blocks
blocks (5.00%) reserved for the super user
First data block=
Maximum filesystem blocks=
block groups
blocks per group, fragments per group
inodes per group
Superblock backups stored on blocks:
, , , , , , , , ,
, , Writing inode tables: done
Creating journal ( blocks): done
Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every mounts or
days, whichever comes first. Use tune2fs -c or -i to override.
[root@iZ94jj63a3sZ ~]#

6、添加分区信息

  使用“echo '/dev/xvdb1 /mnt ext4 defaults 0 0' >> /etc/fstab”(不含引号)命令写入新分区信息。

  然后使用“cat /etc/fstab”命令查看,出现以下信息就表示写入成功。

[root@iZ94jj63a3sZ ~]# echo '/dev/xvdb1  /mnt ext4    defaults    0  0' >> /etc/fstab
[root@iZ94jj63a3sZ ~]# cat /etc/fstab #
# /etc/fstab
# Created by anaconda on Thu Aug ::
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(), findfs(), mount() and/or blkid() for more info
#
UUID=94e4e384-0ace-437f-bc96-057dd64f42ee / ext4 defaults,barrier=
tmpfs /dev/shm tmpfs defaults
devpts /dev/pts devpts gid=,mode=
sysfs /sys sysfs defaults
proc /proc proc defaults
/dev/xvdb1 /mnt ext4 defaults 0 0
[root@iZ94jj63a3sZ ~]#

7、挂载新分区

  使用“mount -a”命令挂载新分区,然后用“df -h”命令查看,出现以下信息就说明挂载成功,可以开始使用新的分区了。

[root@iZ94jj63a3sZ ~]# mount -a
[root@iZ94jj63a3sZ ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 20G .5G 18G % /
tmpfs .9G .9G % /dev/shm
/dev/xvdb1 60G 180M 56G 1% /mnt
[root@iZ94jj63a3sZ ~]#

Linux系统挂载数据盘的更多相关文章

  1. 阿里云Linux系统挂载数据盘

    Linux云服务器数据盘未做分区和格式化,我们可以根据以下步骤进行分区以及格式化操作. 目录 [隐藏]  1 查看数据盘 2 对数据盘进行分区 3 查看新的分区 4 格式化新分区 5 添加分区信息 6 ...

  2. 阿里云里面的Linux 系统挂载数据盘

    转自:http://www.cnblogs.com/adjk/p/5112360.html 适用系统:非IO优化+SSD云盘Linux(Redhat , CentOS,Debian,Ubuntu)实例 ...

  3. Linux 系统挂载数据盘

    适用系统:Linux(Redhat , CentOS,Debian,Ubuntu) *  Linux的云服务器数据盘未做分区和格式化,可以根据以下步骤进行分区以及格式化操作. 下面的操作将会把数据盘划 ...

  4. 阿里云官方教程 Linux 系统挂载数据盘

    适用系统:Linux(Redhat , CentOS,Debian,Ubuntu) *  Linux的云服务器数据盘未做分区和格式化,可以根据以下步骤进行分区以及格式化操作. 下面的操作将会把数据盘划 ...

  5. Linux 系统挂载数据盘 分类: B3_LINUX 2015-01-30 18:13 228人阅读 评论(0) 收藏

    适用系统:Linux(Redhat , CentOS,Debian,Ubuntu) *  Linux的云服务器数据盘未做分区和格式化,可以根据以下步骤进行分区以及格式化操作. 下面的操作将会把数据盘划 ...

  6. [转]Linux 系统挂载数据盘

    原文地址:http://blog.csdn.net/jeep_ouc/article/details/39289643 *Linux的云服务器数据盘未做分区和格式化,可以根据以下步骤进行分区以及格式化 ...

  7. Aliyun上Linux服务器挂载数据盘及速度测试

    原始文档来自于阿里云官方文档:  Linux 系统挂载数据盘 铁锚 于 2013年12月19日 根据自己的需要进行整理 操作系统: CentOS 6.3, 平台  : 阿里云 ECS 云服务器 1. ...

  8. 阿里云Linux服务器挂载数据盘

    步骤1.登录服务器2.检查磁盘信息 命令:fdisk -l3.磁盘分区 命令:fdisk /dev/xvdb 查看命令帮助 m n //新增一个分区 p //建立一个主分区 1 //设置盘符为1 回车 ...

  9. linux系统挂载u盘拷贝文件

    linux系统在不能远程的情况下用u盘传文件(比如服务器装上系统还没配IP),需要先将u盘挂载到系统中的某个位置,再使用cp命令拷贝文件,简要步骤如下: 1.把U盘插入Linux电脑,确保U盘指示灯是 ...

随机推荐

  1. 使用PHP将长文章分页

    如何分页 手动分页:一般在编辑内容时加入特殊分页标记,如{pages},提交后,PHP程序会根据分页符处理分页,生成不同的静态页面.这种分页方法分页准确,但是需要人工手动添加分页符,工作量大. 自动分 ...

  2. 使用dbms_scheduler包创建定时任务

    本文使用dbms_scheduler的create_job创建执行存储过程的定时任务 创建一个job job_type指定'STORED_PROCEDURE' job_action中填入要执行的存储过 ...

  3. jenkins 使用oclint 扫描 oc 代码

    jenkins 环境的搭建,在这里不在赘述,下面我们写一写,如何接入oclint. OCLint是一个强大的静态代码分析工具,可以用来提高代码质量,查找潜在的bug,主要针对c,c++和Objecti ...

  4. jquery div 下拉框焦点事件

    这章与上一张<jquery input 下拉框(模拟select控件)焦点事件>类似 这章讲述div的焦点事件如何使用 div的焦点事件与input的焦点事件区别在于 需要多添加一个属性: ...

  5. Github账户注册的过程

    首先我通过冯老师的博客园帖子中的链接进入了注册地址,填写了用户名,邮箱,和密码.然后我进入我的邮箱验证了Github网站给我发送的验证信息,至此,我的GITHUB账户便注册完成了.

  6. JSWindow对象

    Window 对象 Window 对象表示浏览器中打开的窗口. 如果文档包含框架(frame 或 iframe 标签),浏览器会为 HTML 文档创建一个 window 对象,并为每个框架创建一个额外 ...

  7. 通过sougou输入法,解决卡在Setup Wizard(小绿人)界面

    本人使用海信EG900手机(安卓2.3.5,已root),为了使用google的服务,先后手动复制和CWM recovery刷入google服务包(gapps-gb-20110828-signed.z ...

  8. LINQ 联表查询 取count 值

    linq to sql 实现左外部连接:var query=from a in A join b in B on a.ID equals b.aID into ab from a1 in ab.Def ...

  9. javascript跨域、iframe跨域访问

    1.window 对象 浏览器会在其打开一个 HTML 文档时创建一个对应的 window 对象.但是,如果一个文档定义了一个或多个框架(即,包含一个或多个 frame 或 iframe 标签),浏览 ...

  10. Python之路,day10-Python基础

    一.进程进程:一个程序要运行时所需的所有资源的集合 进程是资源的集合,相当于一个车间 一个进程至少需要一个线程,这个线程为主线程 一个进程里可以有多个线程 cpu cores越多,代表着你可以真正并发 ...