|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)# ~; A/ r5 v9 i3 E
or: fdisk /dev/sdc (for the third SCSI disk)
7 s R3 V3 C5 P or: fdisk /dev/eda (for the first PS/2 ESDI drive); a8 t, n( o1 M! P$ `4 \9 s0 Y
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
' i. |. b H8 o5 A; ] n3 K$ y .... ~+ b" F; e7 E) O' E* \/ ]
- df -k
% T; w- y8 p3 x# D1 a0 ^ - df -lh S- g! v3 k; M
- 查看有几块硬盘:fdisk -l. k" B% z; A. W4 F7 V+ b! `: }
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点 U! f, Q5 R# J& f7 R" e/ E7 m
/dev/sda3 3723848 705968 2828716 20% /
# h5 G! f) `$ Z( I# D7 A /dev/sda1 101089 9274 86596 10% /boot
# V6 Y7 l: J( ]# r) j none 14520 0 14520 0% /dev/shm
4 t4 g5 f4 T5 {% l- o! l 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
9 [% m- n3 \$ a; \: k) SDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel& @* ~( l Z. p
Building a new DOS disklabel. Changes will remain in memory only,
1 G3 I7 {1 A0 w5 R+ J9 c until you decide to write them. After that, of course, the previous4 ?9 t) M8 Y- E1 Q
content won't be recoverable.
6 x: P+ R! G: P; D! | The number of cylinders for this disk is set to 8322.
) n) j6 C' L. M8 B There is nothing wrong with that, but this is larger than 1024,
1 [6 Y) C1 `, o& _ V/ Z& s( ^ and could in certain setups cause problems with:/ ]9 N, P: l* `7 ^& w; B4 _
1) software that runs at boot time (e.g., old versions of LILO)
* B( a! h, f4 N ^6 q 2) booting and partitioning software from other OSs7 W. I9 @/ i [! [ u
(e.g., DOS FDISK, OS/2 FDISK)
# G5 U$ c$ }% ~" B& @. ^5 I0 s& l Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite), T! }3 C& B: G h' Y& H8 V
Command (m for help): p5 u; Z: K* P9 A# p( C% E
Disk /dev/hda: 4294 MB, 4294967296 bytes
4 F9 a. n. b' _, W( r! V 16 heads, 63 sectors/track, 8322 cylinders
! Z8 t' l5 t/ u& R Units = cylinders of 1008 * 512 = 516096 bytes
# E. m1 _( O" P1 p. l Device Boot Start End Blocks Id System' s* ]8 V+ `* o; Y2 B! v5 m3 T
Command (m for help): m
) V& _* `; q4 G& l6 ~1 K( H' B Command action( y7 d' I/ Z' x
a toggle a bootable flag
- e. X9 I+ o ]' h# H& K2 [ u+ h6 y b edit bsd disklabel
' l7 n) V2 L4 }& a3 ~ c toggle the dos compatibility flag
" Y' `1 s& f& _0 l- |: m) b d delete a partition
# z2 w$ g" B: w l list known partition types
3 R8 V- K5 f+ K/ [' K" y5 i! { m print this menu8 Z! k& D" K3 |$ k# p1 C0 O) E9 Y% u
n add a new partition" Y" \" j. m' r5 c) q
o create a new empty DOS partition table, I" a1 P8 L- y: M6 U1 X U
p print the partition table
" E' Q8 x- a' m q quit without saving changes4 `0 y9 s7 x5 X' v. y: k+ M
s create a new empty Sun disklabel
' Y" H, F5 R4 J6 d- A1 e7 O5 ~9 ~ t change a partition's system id) w( h) F9 Y* O
u change display/entry units
: c0 h1 C Y0 K/ T$ P v verify the partition table
8 }# v( y. a+ D! H$ F s6 K w write table to disk and exit
; S+ l! m4 y; y* o# t- } x extra functionality (experts only)
- w8 C6 G9 J! s6 X; O6 I3 @7 y( D! j Command (m for help): n2 W$ {0 C$ m% u) x v
Command action- E9 I" [% i% M/ I8 z: S
e extended
) q" O7 ]" T4 S' G* Y5 e p primary partition (1-4)
: q6 l8 Z" _8 L) n6 E, }/ ? p
4 H. x2 X* O6 z1 h Partition number (1-4): 1
0 M- E( v1 D& {5 B, E6 f First cylinder (1-8322, default 1):
2 t3 A1 J% V I6 _/ V8 f$ N5 J' p Using default value 1
+ j1 r8 M/ T- @/ t, K' s Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G+ e- K/ X* c* \6 w# z
Command (m for help): p# Y7 r9 M ]# u: f$ K4 w0 i0 f
Disk /dev/hda: 4294 MB, 4294967296 bytes* q e- i6 u) x6 A$ h. C& T7 Q
16 heads, 63 sectors/track, 8322 cylinders
' Q9 x9 J0 r }" C8 ] Units = cylinders of 1008 * 512 = 516096 bytes0 t. P, b3 i. t6 E4 h6 ^* Z
Device Boot Start End Blocks Id System: P3 }: o3 }) p' ^9 u4 q k
/dev/hda1 1 1000 503968+ 83 Linux ^; o7 U9 t, Z7 j) Z% }7 M
Command (m for help): w* v6 ?. W! ?9 w4 Q) u
The partition table has been altered!- h7 U! {# G# A" W$ |
Calling ioctl() to re-read partition table.# Z4 F8 k5 U" U7 _
Syncing disks.5 }2 w8 b o2 s# i6 R! x
//格式化新分区0 E3 U4 V2 I9 f4 _
mke2fs 1.32 (09-Nov-2002)$ B6 K7 W. t% ]4 ~6 A. W$ N
Filesystem label=
. J( L& q% S+ O: y OS type: Linux
% N3 q+ G% V1 g; H' N( l Block size=1024 (log=0)% }5 ~1 I- m. \- G& f
Fragment size=1024 (log=0)
/ N3 _6 d( |- l, L 126480 inodes, 503968 blocks+ U* J) @9 f' z3 ]2 F
25198 blocks (5.00%) reserved for the super user9 b; n5 x; R- D# M" F3 U- G
First data block=16 j2 ^& D$ G2 S! V; @
62 block groups7 e, B" s/ @. R) L( A2 N
8192 blocks per group, 8192 fragments per group. ]0 t! o- K9 o; _+ W- b6 M8 g% `
2040 inodes per group
. M* L, G9 Z6 o- B# U Superblock backups stored on blocks: . m- e5 Y9 p- @ V# u
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
2 A0 w7 n3 Q8 d) f/ v3 M5 M Writing inode tables: done * Q1 _+ J z. r+ [; K
Creating journal (8192 blocks): done8 [% P4 r0 N3 R* t0 \" Z( Y
Writing superblocks and filesystem accounting information: done
0 T8 L4 u: U, K" r8 j This filesystem will be automatically checked every 30 mounts or# U# u2 y C8 p' p
180 days, whichever comes first. Use tune2fs -c or -i to override.
9 s( i, y4 E( K! v, q# W; _# Z; b文件系统 1K-块 已用 可用 已用% 挂载点* x" z. d; Z m7 d# P2 o2 T
/dev/sda3 3723848 705992 2828692 20% /$ S# F- C+ B, m# m; f
/dev/sda1 101089 9274 86596 10% /boot3 ]: A' y1 O, g/ i- e: m, c' s& t
none 14520 0 14520 0% /dev/shm5 D. z# X, X% g# Y+ x; V$ k! N
//挂上新分区& v4 M! V \* y5 i# H7 i1 y2 G
- mount /dev/hda1 /home
+ B8 ~7 m, N: b- [ - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
* P2 j% I `( f" P2 T /dev/sda3 3723848 705992 2828692 20% /
1 S4 u6 P4 M8 E$ z/ }, L /dev/sda1 101089 9274 86596 10% /boot# r/ v4 x$ Q9 X- D( ]* `# u" @+ u6 ^
none 14520 0 14520 0% /dev/shm( }: F5 }# n' m* p* R* f; D
/dev/hda1 488006 8239 454569 2% /home
! V: x4 o) f$ u" U$ q
( y; C6 e! ?: |7 P) B* p, @自动挂载:- d+ p8 ^) v1 i: u
- vi /etc/fstab/ K9 U! X1 ~8 A! j; z0 Q
1 c2 H" t3 _( Y1 k. A) z/ G- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 05 e! Y+ F! w# J( b' N
$ y: n, `; @& ^; e! [$ r- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载: ?, C' s" |0 C% h( d% R
- mount /dev/sdb5 /mnt/ljp1
1 o4 Z7 V6 ^# t; e5 \ V% ] - 9 r2 b1 S( f+ u
- mount /dev/sdb6 /mnt/ljp2
复制代码
! l( [6 Z3 \& c' A* u) F3 i) ^ h9 P( U* T" @- |8 Y
1 e6 c& k, p5 j# W) A |
|