linux系统硬盘分区工具之fdisk
MR,R}B$
dT$M y`>
fdisk是linux下的一个硬盘分区工具硬盘分区原理一样,但工具格式等等都不一样,一个是在装系统时的分区,一个是装好系统后的分区 D8nD/||;Z
装系统时的分区,装好系统后一般是没法修改也不好调整的,在装系统时未分区的硬盘空间,装好系统后是可以操作或分区加载的 ;w-qHha
a9Z%JS]
这里主要是说这种情况,一个是对未分区的空闲硬盘的操作,又或是对新加的硬盘操作 |*Yf.-
这里就要用到fdisk了,不过这个只能在2T以内的硬盘操作,大于2T的,就没法用了,得用到另一个parted的工具 5"]~oPK
c.f"Gv
还有一点,Linux对于硬盘的理解是以 %#Z/2<_
/dev/hd|sd(a|b|xxx)这样方式的 Y<b-9ai<w
hd主要是对于IDE的硬盘,这个已经很少见了 q@~L&{
大部分都是sd开头的,包括stata,sas,scsi等接口的硬盘,比如 je4 w=]JV
hda是第一块硬盘 ;HBCUe<_
hdb是第二块硬盘 'snn~{hG
sda是第一块硬盘 _l],
"[d
sdb是第二块硬盘 "ZHtR/;
这里的顺序,还和一个因素有关,就是接口顺序或是跳线,大家应该知道,硬盘接口里是有一个跳线什么的,也就是一个主硬盘等 bo=ZM9
cx$Gic:4
下面介绍fdisk的用法 YyJPHw)Z
fdisk -l是列表所有的硬盘,如下 C#=bW'C
[root@hnwt ~]# fdisk -l \mN[gT}LHm
}o,z!_^PLQ
Disk /dev/sda: 320.0 GB, 320071851520 bytes E%TpJl'U
255 heads, 63 sectors/track, 38913 cylinders ^D_/=4rz8
Units = cylinders of 16065 * 512 = 8225280 bytes QIn/,Yd
}T0K^Oe+eS
Device Boot Start End Blocks Id System YIp-Y}6
/dev/sda1 * 1 13 104391 83 Linux iG,t_??
/dev/sda2 14 38913 312464250 8e Linux LVM Vjm_F!S
MuEy>dl
[$(R#tZ+
fdisk /dev/sda表示操作硬盘,运行这个后会进入fdisk的交互状态,如下 bv
dR"G
[root@hnwt ~]# fdisk /dev/sda Px'!;
B7-RU<n
The number of cylinders for this disk is set to 38913. 4*UP.r@
There is nothing wrong with that, but this is larger than 1024, I]J*BD#n.
and could in certain setups cause problems with: TQ1WVq
}*
1) software that runs at boot time (e.g., old versions of LILO) cf[vf!vi
2) booting and partitioning software from other OSs ?Zyok]s
(e.g., DOS FDISK, OS/2 FDISK) P-JfV 7(O8
4W\,y_Q o
Command (m for help): 02]xJo
L,-u.vV
这里提示你,按m会提示一个帮助,如 l@d
gJ
H^CilwD158
Command (m for help): m voRfjsS~
Command action :?r*p>0$
a toggle a bootable flag gf$HuCh|
b edit bsd disklabel qZG-Lh
c toggle the dos compatibility flag a0zG(7.D
d delete a partition 删除分区 +6%7CC 6
l list known partition types 列出所支持的所有分区类型 Cals?u#U=
m print this menu 显示本菜单 rqvU8T7A
n add a new partition 增加新分区 ~{
.,8jE
o create a new empty DOS partition table P6OM)>C
p print the partition table 显示分区信息 Nz]aaoO4
q quit without saving changes 退出不保存 A. Nz_!
s create a new empty Sun disklabel Q}uG/HI
t change a partition's system id 改变分区类型 5~yb
~0
u change display/entry units anZIB
v verify the partition table ag/u8
w write table to disk and exit 写入分区表并退出 2?*1~ 5~I
x extra functionality (experts only) I;iR(Hf)?q
[xS5z1;
Command (m for help): LsotgQ8
d:$G|<