Linux系统新加物理盘实现LVM管理

寒星孤照 2010-04-25

今天为公司的一台dell poweredage T605 上安装的RedHat Enterprise AS5 update2加了一块1TB的西部数据硬盘,并对这1000G的大家伙做了分区规划,实现LVM管理.实现步骤如下:

第一步:拆箱挂上新硬盘

第二步:加电,重新启动服务器.

第三步:打开terminal,输入命令fdisk -l,查看是否已经认到硬盘,(如果没有的话需要重新加查硬盘驱动是否已经安装成功),发现已经认到了为/dev/sdb 1000G

第四步:对这个新硬盘先进行分区.

首先说明一下,如果你对一块新的硬盘操作过分区过程的话,那这个道理很简单,如果没有的话先去了解一下硬盘分区原理.这里就简单的说一下,一个新的硬盘只有在分区格式化成具体的格式后,系统才能够认识,才能往里面写数据(比如,在windows上可以分为FAT,FAT32,NTFS,Linux上可以分为ext3/2,swap等等).一个新硬盘的分区逻辑是先主分区(primary partition)--- 再扩展分区(extended partition)---然后逻辑分区(logical partition),分一主分区后,剩下的全部分为扩展分区,然后再扩展分区中再一一分为各逻辑分区.

fdisk /dev/sdb 后输出如下信息

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

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)

Command (m for help):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)

Command (m for help): p   //打印分区表  (这个是本笔记本的例子,并非公司的1TB的家伙)

Disk /dev/sda: 160.0 GB, 160041885696 bytes

255 heads, 63 sectors/track, 19457 cylinders    //总共有19457个磁柱

Units = cylinders of 16065 * 512 = 8225280 bytes //每个磁柱的大小约为8M(为什么计算这个呢?应为分区是按照磁柱来计算的)

大概1030个磁柱是10G

Disk identifier: 0x13dbf84d

Device Boot      Start         End      Blocks   Id  System

....

....

....

我先创建100G的主分区,因为在分区时会提示选择分区开始的柱头,结束那个柱头,这样的可以确定该分区位于磁盘的那个位置,已经确定该分区的大小.

相关推荐