|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
% q3 Y) ^! y! S8 W) s; V or: fdisk /dev/sdc (for the third SCSI disk)6 p3 y3 j/ W% c0 k
or: fdisk /dev/eda (for the first PS/2 ESDI drive)# D" X: P/ F& E5 _9 w: {
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
% H, D6 _2 r# P; Q# A( d, q* A: H9 } ...1 G! V, \3 X e X
- df -k# N; S1 |, Q1 ]8 g1 _7 e
- df -lh8 B9 b( m$ _/ l3 I2 h3 U
- 查看有几块硬盘:fdisk -l
1 e+ }9 d# P! ~$ a5 M; B
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点9 w7 h' z" `% ^
/dev/sda3 3723848 705968 2828716 20% // H1 x3 y5 [" W
/dev/sda1 101089 9274 86596 10% /boot
) @ e- W8 D- r' Q0 G0 ] none 14520 0 14520 0% /dev/shm
3 W! X# H3 ^ o( J 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
. D( p9 i& y8 Z% p1 Y) JDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
6 K% W; y y3 ?! |) ? x Building a new DOS disklabel. Changes will remain in memory only,$ p& N0 [+ L9 p r7 e9 \% m
until you decide to write them. After that, of course, the previous0 u$ ^! I/ Y* m) u: K- u
content won't be recoverable.
. W- Y% T3 h! K- t; v# V- g* A The number of cylinders for this disk is set to 8322.
# X! U3 l4 j: k& R There is nothing wrong with that, but this is larger than 1024,
i, Y, u$ [3 o and could in certain setups cause problems with:
8 v0 V( Y0 X: W0 ~ 1) software that runs at boot time (e.g., old versions of LILO). O4 Y, \: U2 q4 {
2) booting and partitioning software from other OSs. X0 j8 j/ k' v/ @% G4 y
(e.g., DOS FDISK, OS/2 FDISK)
1 P( x( D% W/ x7 t5 q/ j Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
9 _( H% d0 O) \" T: X" O6 v Command (m for help): p
# a/ p- I8 {% y0 K# h6 y Disk /dev/hda: 4294 MB, 4294967296 bytes
7 I9 K* P0 i2 E' J+ e0 ]* V6 q 16 heads, 63 sectors/track, 8322 cylinders8 I# C; g7 K. r. H% L9 C
Units = cylinders of 1008 * 512 = 516096 bytes/ \+ n: j# o$ p, {
Device Boot Start End Blocks Id System
' e; a6 M' }* `) e c0 b" q Command (m for help): m, I( e, Y) u+ g
Command action6 u3 N' r4 u; C" H. e2 p
a toggle a bootable flag
# v: R% {9 D# C5 N4 F b edit bsd disklabel( C7 i7 o$ x d5 Z+ F" i
c toggle the dos compatibility flag
, A9 i7 k. y* O# Q3 ^7 @5 m r8 O, X d delete a partition7 |& i: Z7 J$ b' R% W, U$ E
l list known partition types
a/ P9 m Y; b! Z8 J8 G n% k3 d m print this menu
) w; |& h% G0 U0 n* L, H2 H n add a new partition
- I# [/ o% T2 A" F0 s o create a new empty DOS partition table- I/ w* }1 z# [
p print the partition table
( s8 c: E! h, y3 Y. ~, \7 x q quit without saving changes3 m- A: Y& @# V& h* }
s create a new empty Sun disklabel/ W0 ~. L* a, |/ S* \
t change a partition's system id
5 h2 v2 W. {: O0 G5 l5 v% d! C u change display/entry units3 U- _% [. b7 a* z
v verify the partition table
, t& B, ?/ j3 U- ~9 w T7 P w write table to disk and exit
: {1 Y$ s/ C$ D. f$ A( a x extra functionality (experts only); z1 }: ^: R" } p* I
Command (m for help): n- M7 \3 ^5 R# b1 l" L4 W" |9 t7 |
Command action
2 X; B$ {# {/ _+ J1 |* V1 P+ m4 R e extended% a4 I+ \4 A8 V
p primary partition (1-4)4 h& r& u* o1 J
p
* T6 m) S, s# K( _9 k Partition number (1-4): 19 m# |6 P2 x Y/ Y: ^5 x0 c& N9 k
First cylinder (1-8322, default 1):
8 P3 J& x. J( |7 F; R, ^6 t3 c Using default value 1 J' @% E* \! a4 P; p* s2 d
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G- m( D+ ~9 }0 _
Command (m for help): p- V8 A% a4 |4 i1 M* s
Disk /dev/hda: 4294 MB, 4294967296 bytes) O: _; \$ h. f- f5 N P% i
16 heads, 63 sectors/track, 8322 cylinders( i, Z4 T5 k" r `0 i6 J
Units = cylinders of 1008 * 512 = 516096 bytes; A- { B9 j7 W: k3 Z8 a3 {6 c) W
Device Boot Start End Blocks Id System8 X& ?- h( z* Y" s
/dev/hda1 1 1000 503968+ 83 Linux
; r& m. S" z! {: G Command (m for help): w
, S" M9 P, m, U5 X* y- K The partition table has been altered!. R+ B9 m" @2 z) W# L
Calling ioctl() to re-read partition table.
' |) D+ W: |9 s. Y0 g9 } Syncing disks.
! f: g. N* ^5 z* T //格式化新分区+ B) a$ n2 s1 o7 N
mke2fs 1.32 (09-Nov-2002)
' E5 ?3 |) K# g# M( p; u Filesystem label=
3 p4 |0 ~' p" L4 `' z% X& e2 q( p( b OS type: Linux9 [0 ~ r7 t% e. ]# {
Block size=1024 (log=0) a4 F7 m3 z0 ~. ^) q/ F
Fragment size=1024 (log=0)
; ^, t4 w4 _2 q$ [2 }; N1 X, ]3 y 126480 inodes, 503968 blocks x6 q! n9 \' F$ u
25198 blocks (5.00%) reserved for the super user
$ e, B; U& Z" i) [* c& p First data block=1: i9 S5 J6 L7 m- o
62 block groups2 z/ @; P; Q: J' E" l. n
8192 blocks per group, 8192 fragments per group
G* |. K2 r" h) s. A7 W+ V8 y 2040 inodes per group; q/ B& B8 P; [- G$ q/ v4 ^7 [
Superblock backups stored on blocks:
! v% E6 t7 @8 a2 c; } 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
3 C, v8 i( A& I9 s Writing inode tables: done ; t# n9 R4 P' M5 |# Y. O* H: \% @
Creating journal (8192 blocks): done
+ r1 h& P2 M- ~3 F; I& M4 [ Writing superblocks and filesystem accounting information: done9 Y" R! L* l. X& P8 O- A2 g
This filesystem will be automatically checked every 30 mounts or
: ]1 \4 x* r R: y; `/ i' m 180 days, whichever comes first. Use tune2fs -c or -i to override.4 X, _) I6 u/ _, i) k
文件系统 1K-块 已用 可用 已用% 挂载点! t. _. |6 ^" p( v
/dev/sda3 3723848 705992 2828692 20% /
0 x9 }2 x- D: _ /dev/sda1 101089 9274 86596 10% /boot
3 W \+ f/ T2 x4 b none 14520 0 14520 0% /dev/shm% }" g3 u5 T2 U( V, k* t
//挂上新分区% `5 _% H0 ~/ \; ^3 Z7 ~+ `
- mount /dev/hda1 /home" i4 C: U& i* R# s+ @- A6 U
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点" N- U+ a4 {2 O9 v. V
/dev/sda3 3723848 705992 2828692 20% /
( I& x# {! z; K y: c. W /dev/sda1 101089 9274 86596 10% /boot1 @0 T% f: D) [0 e. r: T
none 14520 0 14520 0% /dev/shm1 w: z8 e! ]$ P% `" W
/dev/hda1 488006 8239 454569 2% /home
- _+ D* q' O! f6 k6 F# K2 Q1 s( v
+ T: m& O0 a/ t+ |2 r0 Q" w& O) H7 b自动挂载:' b4 f' y2 L9 f9 p; G
- vi /etc/fstab
8 `" w8 x3 D* W$ P8 Q
0 u( g$ i! ]+ c7 e- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0+ C4 e/ K$ E' _5 H. v
- ( P* e7 a+ q. d0 R1 z5 o
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
8 d3 a; ?( B) R4 N, {% r" B- mount /dev/sdb5 /mnt/ljp1
) r8 F% x1 g9 O& D( \- z3 L8 e' k - 8 j( L0 F" u6 ?8 M% s5 T7 H+ |
- mount /dev/sdb6 /mnt/ljp2
复制代码
, t, @1 I9 |6 _& n: ?' f7 [4 f
9 b8 T% H4 S, [6 n W) x2 ^- [( Y. G# I+ |6 G; g3 v
|
|