Linux fdisk LVM soft RAID 配置管理
一.fdisk 磁盘分区
[root@localhost ~]# fdisk -l (显示当前磁盘分区情况)
Disk /dev/hdb: 5368 MB, 5368709120 bytes
16 heads, 63 sectors/track, 10402 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
Disk /dev/sda: 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/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 2610 20860402+ 8e Linux LVM
以上信息表明,有2块硬盘,一块是SCSI的,一块是IDE的。其中/dev/hdb 是5G的,有16个磁面,63个扇区。10402个磁柱.每个磁柱的容量是0.516096M。每一个分区的容量是 Blocks = (相应分区End数值 - 相应分区Start数值)x 单位cylinder(磁柱)的容量,比如说/dev/sda1=(13-1)*8225.280=98703.36=98M (由于硬盘都是按1000M为单位,所以有一些偏差),之所以没有/dev/hda 是因为已经被光驱占用了。
下面对Disk /dev/hdb进行分区,分区方案如下:
/dev/hdb1 主分区 容量:1G
/dev/hdb2 扩展分区 容量:4G
/dev/hdb5 逻辑分区 容量 :1G
/dev/hdb6 逻辑分区 容量 :1G
/dev/hdb7 逻辑分区 容量 :1G
/dev/hdb8 逻辑分区 容量 :1G
说明:分区(包括扩展分区)的总个数不能超过四个;也不能把扩展分区包围在主分区之间;分区(包括扩展分区)的总个数不能超过四个;也不能把扩展分区包围在主分区之间;系统默认会将磁盘编号1-4给主分区,从5~16给逻辑分区。所以LINUX系统最多只能存在16个分区。
[root@localhost ~]# fdisk /dev/hdb (对硬盘/dev/hdb进行分区)
The number of cylinders for this disk is set to 10402.
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): n (创建分区)
Command action
e extended
p primary partition (1-4)
p (创建主分区)
Partition number (1-4): 1 (选择分区ID号)
First cylinder (1-10402, default 1): (起始磁柱值直接回车默认就行)
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-10402, default 10402): +1G (结束磁柱值 1G)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
e (划分扩展分区)
Partition number (1-4): 2
First cylinder (1940-10402, default 1940):
Using default value 1940
Last cylinder or +size or +sizeM or +sizeK (1940-10402, default 10402):
Using default value 10402
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l (划分逻辑分区1)
First cylinder (1940-10402, default 1940):
Using default value 1940
Last cylinder or +size or +sizeM or +sizeK (1940-10402, default 10402): +1G
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l (划分逻辑分区2)
First cylinder (3879-10402, default 3879):
Using default value 3879
Last cylinder or +size or +sizeM or +sizeK (3879-10402, default 10402): +1G
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l (划分逻辑分区3)
First cylinder (5818-10402, default 5818):
Using default value 5818
Last cylinder or +size or +sizeM or +sizeK (5818-10402, default 10402): +1G
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l (划分逻辑分区4)
First cylinder (7757-10402, default 7757): +1G^H^H^H^H^H^H
Value out of range.
First cylinder (7757-10402, default 7757):
Using default value 7757
Last cylinder or +size or +sizeM or +sizeK (7757-10402, default 10402): +1G