|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
5 D* y4 T+ I7 c8 S or: fdisk /dev/sdc (for the third SCSI disk)
. c0 j% E" j3 U% ^/ p9 p, ]" { or: fdisk /dev/eda (for the first PS/2 ESDI drive)
/ q/ q: g+ g! L8 T or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)) K- o1 J$ l" @! R# m* w8 v& V( X
...2 U3 x# T; l7 M
- df -k L x% P" m# a( J, j
- df -lh; D% Q# I& i! |' d- ^2 \$ r) L8 c
- 查看有几块硬盘:fdisk -l& H6 U" ?. r: y4 ?" w
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点8 E9 B% l- Y% I9 p& F
/dev/sda3 3723848 705968 2828716 20% /( s) l# y0 {: Q$ {. z
/dev/sda1 101089 9274 86596 10% /boot* z8 D& F3 `' C$ Z
none 14520 0 14520 0% /dev/shm, ~$ M, `" K; X. A2 d+ X: J+ J' A' f
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用" C4 |, D; z2 x5 z- @# F, Z
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
& M- G) C- C9 a Building a new DOS disklabel. Changes will remain in memory only,
) i0 P# |' m1 u& t+ ]' @ until you decide to write them. After that, of course, the previous
6 ~ d6 t. o r4 v0 K8 e content won't be recoverable.
4 G- ^! k# |1 G5 [+ k7 w: Y The number of cylinders for this disk is set to 8322.
7 m, @9 f6 |) M/ G8 y There is nothing wrong with that, but this is larger than 1024,
7 C7 X* {4 [! ~ and could in certain setups cause problems with:7 G: s% E' r# c, [" X
1) software that runs at boot time (e.g., old versions of LILO)1 _$ y v4 S ^
2) booting and partitioning software from other OSs
0 ^( h/ @% x! o# h (e.g., DOS FDISK, OS/2 FDISK)* ]- |9 W4 a1 f* u) Y) R w# _
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
- P% F: O! K* a' @% h Command (m for help): p
4 M% ~( Z/ X+ q9 [ Disk /dev/hda: 4294 MB, 4294967296 bytes4 v6 a9 n# D7 X+ x
16 heads, 63 sectors/track, 8322 cylinders
- F' }$ @* @5 {5 Q* W+ P( Q Units = cylinders of 1008 * 512 = 516096 bytes9 x+ K; D& B2 _$ m: {
Device Boot Start End Blocks Id System
2 s5 e! N6 d- _ Command (m for help): m# }3 h5 {! E8 ~0 X4 k5 t# J
Command action; c+ @+ Q3 }) x! `$ T
a toggle a bootable flag
. S! j6 h) M! Z' { b edit bsd disklabel
, C' k# |' n- n; } c toggle the dos compatibility flag! V% h! Q; J8 R0 `8 U
d delete a partition
3 w* v7 t4 M: {4 e- i l list known partition types
* E/ ?- D/ s/ ~. ]# |% Z m print this menu
, {+ L: J# I% I4 `) @ n add a new partition% z0 t) H/ f( h: F0 k5 k. A$ y8 B& H
o create a new empty DOS partition table
, V) ?6 y9 _8 Y0 D; m- E8 Z) s) ^ p print the partition table; R2 ?1 n! t$ H( }. L$ K
q quit without saving changes" g; m- o8 z: G! j3 a; q2 M# L+ a
s create a new empty Sun disklabel
$ N1 M) B: n, g- s$ h6 M; Z6 ~ t change a partition's system id
4 K0 H8 }1 S# p u change display/entry units* ~+ G) Y) z# B% p9 h& [ K2 T* q
v verify the partition table
L, s9 z! X4 H3 x' d/ _% ~) K L w write table to disk and exit3 Z+ r. \/ B( ?9 d. v/ n, D
x extra functionality (experts only)
& D/ e9 |, F/ |7 C/ R Command (m for help): n
0 ^ T) C; U$ L9 ]0 l0 y( |1 h! N0 O Command action
! @8 [2 p. ^" U- {' A D! H e extended
5 ^7 h% o: Q8 [2 K* F- y: N: D p primary partition (1-4)( v2 u8 C+ C1 M! p m! `# \
p& X; [; D3 ~6 E7 V
Partition number (1-4): 1+ d+ X" I# [ f
First cylinder (1-8322, default 1):
% ?1 Q: j. w' ~! v& y! q4 m/ j Using default value 16 F/ g- U0 g0 _, c
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
9 c' ^! m c ]& [( q7 x' I Command (m for help): p
- ^( Q# z' j' l; d+ W: S* P( w Disk /dev/hda: 4294 MB, 4294967296 bytes
) O! k+ v. Q- B 16 heads, 63 sectors/track, 8322 cylinders3 B+ @- W( S% _: m
Units = cylinders of 1008 * 512 = 516096 bytes9 A' m4 z+ ^1 _; |- u8 F
Device Boot Start End Blocks Id System/ s1 E( ?" @5 V" z9 Y2 Y
/dev/hda1 1 1000 503968+ 83 Linux
: Y) O( Q% E0 I) W% B! j Command (m for help): w
$ ]9 G; K, l8 R/ I3 L5 F The partition table has been altered!
( e- c( o7 z2 v4 L4 c( { Calling ioctl() to re-read partition table.
. Z8 x; ?$ t1 m( `$ |( S, \7 E% b% K. \ Syncing disks.1 k) Q+ @+ l3 C% B9 H
//格式化新分区
, y. {0 X% c( mmke2fs 1.32 (09-Nov-2002)7 Q6 ~" ?: e O5 N4 G0 w2 N6 y
Filesystem label=
6 | u0 a% Q: Y7 E5 }" Z OS type: Linux
2 |/ `' d. K1 I9 @# Y Block size=1024 (log=0)$ z4 n. t+ r) ?+ _- I4 ?
Fragment size=1024 (log=0)8 W4 m6 U9 p6 W6 Z6 X
126480 inodes, 503968 blocks1 C3 S: Y8 B: \3 h1 c- q ?
25198 blocks (5.00%) reserved for the super user- O0 a: U! S8 A* n* ^' F3 t
First data block=1
9 Q; H M: v3 s- R7 V 62 block groups' g B6 U/ P8 S" n% r
8192 blocks per group, 8192 fragments per group- s, [ i. v6 U, M) \
2040 inodes per group5 g% s5 m$ } F1 D, L2 i
Superblock backups stored on blocks: ) t; @3 g4 S4 J _8 K
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
2 g4 n, s, R* |' B7 x6 K Writing inode tables: done
) k$ [; l1 p2 f0 o7 ~ Creating journal (8192 blocks): done
* y3 [6 G" [1 I& t Writing superblocks and filesystem accounting information: done
# M8 T3 k& _8 j! Z9 a) z2 F( D* ^: I This filesystem will be automatically checked every 30 mounts or' d/ f$ {: H8 |% g
180 days, whichever comes first. Use tune2fs -c or -i to override.- n& X/ |: l) n0 w4 G: `
文件系统 1K-块 已用 可用 已用% 挂载点
/ c5 c1 Q3 s( a* [$ ]/ m1 u( s /dev/sda3 3723848 705992 2828692 20% /- ]6 G" v: q7 ]" {
/dev/sda1 101089 9274 86596 10% /boot
$ S9 v+ R4 ?* r1 G3 R5 z% x; B none 14520 0 14520 0% /dev/shm- R' P, J. @ |
//挂上新分区
: ]* g n: G0 N" w- mount /dev/hda1 /home! p' J/ z% g: {0 P5 p( ^
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点/ L$ s& d" \2 U! |7 J
/dev/sda3 3723848 705992 2828692 20% /! b& E, }: x( S* d0 z! x
/dev/sda1 101089 9274 86596 10% /boot
: o& d) `& N' E8 y! ` l6 u, | Z none 14520 0 14520 0% /dev/shm9 }" c7 q. Z) e5 D; g
/dev/hda1 488006 8239 454569 2% /home- k- J9 P5 j; u! E4 T/ i0 A
/ {4 w& u5 G3 |9 n
自动挂载:
; m% @5 Z6 u2 f' y/ a- vi /etc/fstab
( R4 J) t! K' |$ v1 E: W% ]. H
% S" ?3 Z' Y2 z5 \& X- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
) X. {/ G# H- o6 b+ B
2 h7 e# R l% M q0 Y6 m* M. F7 D# H5 ?- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
9 x- e, O/ e) W& L: ?- mount /dev/sdb5 /mnt/ljp10 e8 Z" o8 K! P' K6 ~
0 w6 t& D' B3 T. T: v4 @/ w) S- mount /dev/sdb6 /mnt/ljp2
复制代码
; c1 r) D x* b8 j+ y
4 m0 |& r" i/ \9 `( a9 f. J7 h, S. n7 g( Q1 n* {
|
|