linux虚拟机添加硬盘

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入

一.Linux的硬盘识别

2.6 kernel以后,linux会将识别到的硬件设备,在/dev/下建立相应的设备文件.如:

sda 表示第1块SCSI硬盘.

hda 表示第1块IDE硬盘(即连接在第1个IDE接口的Master口上).

scd0 表示第1个USB光驱.

当添加了新硬盘后,在/dev目录下会有相应的设备文件产生.cciss的硬盘是个例外,它的

设备文件在/dev/cciss/目录下.一般使用“fdisk -l”命令可以列出系统中当前连接的硬盘

设备和分区信息.新硬盘没有分区信息,则只显示硬盘大小信息.

二.在linux系统中添加新硬盘

下面说明一下,在GTES 11上,添加一块10G硬盘到第一个IDE口的Slave接口上.

安装好硬盘后,开机进入Turbolinux.以root身份登录.

执行fdisk -l命令显示当前系统的硬盘设备.

[root@g11-64-1 ~]# fdisk -l

Disk /dev/hda: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/hda1 * 1 13 104391 83 Linux

/dev/hda2 14 89 610470 82 Linux swap / Solaris

/dev/hda3 90 2610 20249932+ 83 Linux

Disk /dev/hdb: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/hdb doesn’t contain a valid partition table

[root@g11-64-1 ~]#

显示hdb没有分区信息,大小为10G.

使用fdisk命令对hdb进行分区.

[root@g11-64-1 ~]# fdisk /dev/hdb

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel. Changes will remain in memory only,

until you decide to write them. After that, of course, the previous

content won’t be recoverable.

The number of cylinders for this disk is set to 1305.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

(e.g., DOS FDISK, OS/2 FDISK)

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

输入: n 表示新建分区.

Command (m for help): n

Command action

e extended

p primary partition (1-4)

输入: p 表示建立一个原始分区.

p

Partition number (1-4): 1

输入: 1 表示此分区编号为1.

First cylinder (1-1305, default 1):

输入: 回车 表示使用默认起始柱面号.

Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305):

输入: 回车 表示使用默认结束柱面号.即此分区使用整个硬盘空间.

Using default value 1305

Command (m for help): w

输入: w 存盘,退出fdisk.

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[1][2]

不要做刺猬能不与人结仇就不与人结仇,

linux虚拟机添加硬盘

相关文章:

你感兴趣的文章:

标签云: