处理新加入的硬

注意:粉红色的字为要输入的命令选项、红色的字为提示内容。

1:选择新加入的硬盘

[root@rac1 ~]# fdisk/dev/sdb

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

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 parposition::g software from other OSs

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

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

Command (m for help): m(查看命令选项)

Command action

a toggle a bootable flag

b edit bsd disklabel

c toggle the dos compatibility flag

d dalert:: a partition

l list known partition types

m print this menu

n add a new partition

o calert:: a new empty DOS partition table

p print the partition table

q quit without saving changes

s calert:: 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 extrafunctionality (experts only)

步骤2:创建分区(此处把整块硬盘分成一个逻辑分区)

Command (m for help): n(添加分区)

Command action

e extended

p primary partition (1-4)

p(设置为主分区)

Partition number (1-4): 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 (写入磁盘)

The partition table has been alert::ed!

Calling ioctl() to re-read partition table.

Syncing disks.

步骤3:查看新建分区

[root@rac1 ~]# fdisk-l

Disk /dev/sda: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305cylinders

Units = cylinders of 16065 * 512 =8225280 bytes

Device Boot Start End Blocks Id System

/dev/sda1 * 1 1147 9213246 83 Linux

  /dev/sda2 1148 1305 1269135 82Linux swap

Disk /dev/sdb: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305cylinders

Units = cylinders of 16065 * 512 =8225280 bytes

Device Boot Start End Blocks Id System

/dev/sdb1 1 130510482381 5 Extended

步骤4 格式化分区

[root@rac1~]# mkfs-t ext3 -c /dev/sdb1

mke2fs 1.35 (28-Feb-2004)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

1310720 inodes, 2620595 blocks

131029 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=2684354560

80 block groups

32768 blocks per group, 32768 fragments per group

16384 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912, 819200, 884736,1605632

Checking for bad blocks (read-only test): done

Writing inode tables: done

Creating journal (8192 blocks): done

Writing superblocks and filesystem accountinginformation: done

This filesystem will be automatically checked every 25mounts or

180days, whichever comes first. Use tune2fs -c or -i to override.

步骤5:创建目录然后将该分区加挂到该目录下

[root@rac1 /]# mkdir /u01

[root@rac1 /]# mount/dev/sdb1 /u01

步骤6:修改/etc/fstab文件添加如下记录使系统每次重启后都能自动加载该分区

  [root@rac1 /]#vi /etc/fstab
     在文件的末尾填加如下内容

/dev/sdb1 /u01 ext3 defaults 1 2