标题: 如何在linux云主机上挂载云硬盘 [打印本页] 作者: 857401199 时间: 2015-8-12 08:57 标题: 如何在linux云主机上挂载云硬盘 1、查看硬盘信息,看看是否需要分区
[root@localhost ~]# fdisk -l
Disk /dev/sda: 8589 MB, 8589934592 bytes 此处是sda的磁盘信息
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 14 1044 8281507+ 83 Linux
/dev/sda2 1 13 104391 82 Linux swap / Solaris
Partition table entries are not in disk order
Disk /dev/sdb: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table 此处显示磁盘dev/sdb尚未格式化。
2、对硬盘进行分区操作
[root@localhost ~]# fdisk /dev/sdb
Command (m for help): p p:print the partintion table
Disk /dev/sdb: 6442 MB, 6442450944 bytes 显示磁盘基本信息
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
此处可以看出,尚未对磁盘进行分区
Command (m for help): n n:add a new partition
Command action
e extended 选择主分区还是扩展分区,在此选择主分区
p primary partition (1-4)
p
Partition number (1-4): 3 选择分区数。
First cylinder (1-783, default 1): 设置分区大小。此处定义1000M。就是最接近1000M的柱面号码
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-783, default 783): +1000M
Command (m for help): w 如无误输入w保存配置信息,如不保存输入q退出
Command (m for help): p 如下查看分区之后的磁盘信息
Disk /dev/sdb: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 368 783 3341520 83 Linux
/dev/sdb2 124 367 1959930 83 linux
/dev/sdb3 1 123 987966 83 Linux