|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)( B4 ^3 J7 Z4 w2 o
or: fdisk /dev/sdc (for the third SCSI disk)& R( P% j& Q; C1 p
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
5 @9 }! u. }- u or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
6 J6 H+ Q" p% O! X# `+ A0 I6 D4 U0 | ...
L- a/ O: b5 G" Q) b2 n/ E( j& h- df -k* v6 [9 Q7 s. R( U0 }. Y3 V
- df -lh2 b8 |( z0 V' ?
- 查看有几块硬盘:fdisk -l
4 P. y, u3 O4 R) H; h* e- Z
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点3 v! D! F4 i/ i- J
/dev/sda3 3723848 705968 2828716 20% /9 S: k9 |0 X8 g8 w. H
/dev/sda1 101089 9274 86596 10% /boot* h, H0 X9 I6 _- W! x
none 14520 0 14520 0% /dev/shm+ N2 Q& m" d7 q {
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
5 G7 {* T" T( xDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel* t/ E$ P, ?4 H) R) k
Building a new DOS disklabel. Changes will remain in memory only,
7 h9 \1 r# \9 A1 P# D until you decide to write them. After that, of course, the previous+ C, o7 N9 L$ m; F, l6 g
content won't be recoverable. X% f1 o6 _- M" f0 \" B( M
The number of cylinders for this disk is set to 8322.
# R3 H K& ^# G+ N" Z There is nothing wrong with that, but this is larger than 1024,
+ Z( ^' I* b. c) y! Q2 y( m and could in certain setups cause problems with:
- ^; W2 @( D6 T' a B5 N. E 1) software that runs at boot time (e.g., old versions of LILO)- S6 N, A7 r3 p: S5 O& z& q: H+ {
2) booting and partitioning software from other OSs* x1 _8 Q$ e% a$ }# N
(e.g., DOS FDISK, OS/2 FDISK)" A+ I$ m2 C0 j9 w4 [- c9 S8 p
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
/ `' z y6 o8 M8 v& S( L Command (m for help): p6 P0 ~5 T! r) N1 C9 o
Disk /dev/hda: 4294 MB, 4294967296 bytes
/ t+ O4 m, H. A7 R( v 16 heads, 63 sectors/track, 8322 cylinders
7 y: P1 D' m- C$ S) `2 ~) v Units = cylinders of 1008 * 512 = 516096 bytes7 A5 n. b8 d0 M4 B4 o# ]% x, ~0 P
Device Boot Start End Blocks Id System# n$ B) i- r; g
Command (m for help): m
/ i) q- Y- F. A- _ w: Q& y' L/ C Command action. r; Q0 _8 O+ i0 T- @# c
a toggle a bootable flag5 }9 Y! l( C) P6 |" V: O
b edit bsd disklabel
e5 i. X: A3 ~- V, U c toggle the dos compatibility flag& y9 y" q+ Y2 |4 Z% R
d delete a partition
) P3 Y. I1 b+ m* v$ e8 F l list known partition types
6 ^* o% R: {+ h. J. C m print this menu% u* V, m, E+ x! i: w( w( y
n add a new partition
; t, c, ~; B: _ o create a new empty DOS partition table
4 e2 q4 I/ M* g) ]3 q1 f' j p print the partition table
$ B2 k. A2 Y4 ^2 u+ G6 E q quit without saving changes
0 [1 U# f* d0 Y: d s create a new empty Sun disklabel
3 V6 Z e6 e& l9 L2 {, i& c; W$ o t change a partition's system id
" ]8 Q' R) X9 H$ M' s( I% J u change display/entry units
& N' ~/ `2 S7 M+ V O: R3 w- ~' t9 c v verify the partition table
, V& L: }5 t G0 P$ k w write table to disk and exit
% ~. b4 r; X/ ^0 Y5 D& R- G x extra functionality (experts only)
* l( Z8 e% z! r Command (m for help): n# F [0 m! w2 B* V. k: O
Command action
$ L- W' z8 R# i9 r" k0 ` e extended
+ o8 U) S9 Y: r) m" c p primary partition (1-4). V' B9 x+ ^3 i6 _
p
7 V: f$ p9 l8 _/ ^/ | Partition number (1-4): 1/ K: k9 C" o7 g9 d4 n5 k+ y/ |( q" b: h
First cylinder (1-8322, default 1): ( c# `5 |7 D1 A5 l, w
Using default value 1
0 T4 X+ B. l% N/ s Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G7 H! {0 F% x( a. L5 H7 e
Command (m for help): p N! \% K( D* z8 z
Disk /dev/hda: 4294 MB, 4294967296 bytes
" {3 @. {- N# }6 Z* P B 16 heads, 63 sectors/track, 8322 cylinders
4 \. R0 y. b8 U Units = cylinders of 1008 * 512 = 516096 bytes& ~0 w+ Y2 a1 E9 K6 \/ b4 K
Device Boot Start End Blocks Id System
! C4 I3 l# g/ K, p6 M2 J /dev/hda1 1 1000 503968+ 83 Linux/ P- Z) u" _8 ]! q+ i) Q4 R
Command (m for help): w3 M" o$ v! I2 P% S
The partition table has been altered!4 R9 n6 z1 l, U( R& A
Calling ioctl() to re-read partition table.
9 ]4 k& f8 C0 e S9 W Syncing disks.3 Q' K, I" @( i6 Z' `
//格式化新分区
0 S2 s* F/ M; x6 Hmke2fs 1.32 (09-Nov-2002)
2 W. n' q' r& ]' j+ h, G/ ], p Filesystem label=2 i/ J- Q/ g% o" |/ `- }8 U+ m
OS type: Linux! r, e3 e/ W2 A# J1 a8 @. x" x
Block size=1024 (log=0)
& q I# K' A/ Y' K8 O( X Fragment size=1024 (log=0)
* ~/ B8 q8 B( B8 w, F2 ]4 E 126480 inodes, 503968 blocks
N3 h- P2 e0 v0 n" p& d- i/ v 25198 blocks (5.00%) reserved for the super user: q- U: x; y J8 k
First data block=19 Y# F1 z, }3 l+ C# z% \
62 block groups
0 z7 |# x9 N# \4 {$ ~ 8192 blocks per group, 8192 fragments per group
2 s6 z! K0 r# E# |4 H& a, m 2040 inodes per group, ]2 A6 p! i, f! V5 X
Superblock backups stored on blocks: $ d4 Y# n5 w; U' x4 I1 f
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
% L8 s& n! o& m Writing inode tables: done 0 ^% @; T. U W/ `; V% l0 g
Creating journal (8192 blocks): done$ q; U! M6 m( d- ^* }4 M, p
Writing superblocks and filesystem accounting information: done
" z5 w+ X$ [: w; t This filesystem will be automatically checked every 30 mounts or$ P2 J/ h i Z6 I3 v5 a, Q
180 days, whichever comes first. Use tune2fs -c or -i to override.0 k- y* h# Y% F1 |* O' L0 G
文件系统 1K-块 已用 可用 已用% 挂载点
& R' H! U y( j- I8 d. I /dev/sda3 3723848 705992 2828692 20% /
% P4 a- i* K! U' w* f /dev/sda1 101089 9274 86596 10% /boot
$ d* w0 u5 \4 b- U none 14520 0 14520 0% /dev/shm
) p9 Z$ B% R+ j' w4 _/ A4 b! m7 g //挂上新分区
8 C2 e6 D% N0 x" p9 s/ E, n- mount /dev/hda1 /home
: n7 a w! c: ?5 ?! H1 i- m - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
8 J/ Y/ p' r/ M: S) v7 z /dev/sda3 3723848 705992 2828692 20% /
/ {! r o$ F/ o) j9 G# i4 F /dev/sda1 101089 9274 86596 10% /boot
/ x9 l/ d3 J1 {' d none 14520 0 14520 0% /dev/shm
4 e3 F/ G: g/ H# X( z+ @, @2 s2 L+ e /dev/hda1 488006 8239 454569 2% /home
2 i' _ X3 s o4 v. D2 o& r6 L3 z1 X/ d$ l! T# B/ V
自动挂载: T" h- X r. i6 O$ o' n9 p* _+ w
- vi /etc/fstab- P3 \' {' t+ n6 _' J
- ; E5 i0 I0 n( }/ m
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
. S/ h( I+ d3 A5 V* w) H, [
9 G: P0 I( Z( `. _. ]) x. y& |8 J- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:7 d" Q* h4 S B2 |1 F* q9 v
- mount /dev/sdb5 /mnt/ljp1
) P% |/ e' c- a: V# | - % q6 b) {, B& {3 Y# X- @
- mount /dev/sdb6 /mnt/ljp2
复制代码 $ v2 w: t8 s* X
: V, t% o* J5 U" t; e5 ], g9 V
/ R8 G% n( e5 v( \$ Q, r |
|