码迷,mamicode.com
首页 > 系统相关 > 详细

Linux 系统挂载数据盘

时间:2016-05-14 13:54:29      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:

下面的操作将会把数据盘划分为一个分区来使用。 1、查看数据盘 在没有分区和格式化数据盘之前,使用 “df –h”命令,是无法看到数据盘的,可以使用“fdisk -l”命令查看。如下图: [root@Image /]# 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: 536.9 GB, 536870912000 bytes 255 heads, 63 sectors/track, 65270 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 2、 对数据盘进行分区 执行“fdisk -S 56 /dev/xvdb”命令,对数据盘进行分区; 根据提示,依次输入“n”,“p”“1”,两次回车,“wq”,分区就开始了,很快就会完成。 通过m可以查看帮助: Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition‘s system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) n:添加一个新的分区 p:创建一个主要分区 1:分区编号为1,第几个分区:1~4 第一次回车:First cylinder (1-73429, default 1): 族(圆柱体)开始位置 第二次回车:Last cylinder, +cylinders or +size{K,M,G} (1-73429, default 73429): wq:保存刚才的设置并退出 3、 查看新的分区 使用“fdisk -l”命令可以看到,新的分区xvdb1已经建立完成了。 4、格式化新分区 使用“mkfs.ext4 /dev/xvdb1”命令对新分区进行格式化,格式化的时间根据硬盘大小有所不同。 5、添加分区信息 使用“echo ‘/dev/xvdb1 /mnt ext3 defaults 0 0‘ >> /etc/fstab”(不含引号)命令写入新分区信息。 然后使用“cat /etc/fstab”命令查看,出现以下信息就表示写入成功。 注:ubuntu12.04不支持barrier,所以正确写法是:echo ‘/dev/xvdb1 /mnt ext3 barrier=0 0 0‘ >> /etc/fstab * 如果需要把数据盘单独挂载到某个文件夹,比如单独用来存放网页,可以修改以上命令中的/mnt部分 其实不用上面的命令,直接挂载就行 mount /dev/xvdb1 /data 6、挂载新分区后查看所否挂载成功 用“df -h”命令查看,出现以下信息就说明挂载成功,可以开始使用新的分区了。 [root@Image /]# df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 20G 1.6G 18G 9% / tmpfs 3.9G 0 3.9G 0% /dev/shm /dev/xvdb1 493G 198M 467G 1% /data

Linux 系统挂载数据盘

标签:

原文地址:http://www.cnblogs.com/zhangchao512/p/5492346.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!