|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)' p/ ?' x1 d, A8 D& @4 Z: g! J
or: fdisk /dev/sdc (for the third SCSI disk)! [0 J: \3 S- J {( y
or: fdisk /dev/eda (for the first PS/2 ESDI drive)6 [! s) h; N$ O* u/ ^
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)4 S+ b- S; Q3 U+ g: a
...
: y( C/ ^/ m$ u C- df -k
- J. Z- j4 @, `; t$ r - df -lh/ \% J$ O( [4 g/ t- D5 q9 [
- 查看有几块硬盘:fdisk -l6 a, v! o& u! h6 c
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
, S7 J6 Z; t" V+ P2 I' ?' h /dev/sda3 3723848 705968 2828716 20% /7 B: j( {% H9 H5 g2 q4 x8 o
/dev/sda1 101089 9274 86596 10% /boot
+ j7 v N3 W+ ]9 ?& _$ K/ s none 14520 0 14520 0% /dev/shm
% \" {) C6 y; U; ^5 c2 K$ \$ W4 B2 } 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用. A5 d/ f( G5 U0 P
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel% F Z' b7 h5 T* n% s
Building a new DOS disklabel. Changes will remain in memory only,
% E+ m {! G% ^/ m3 {1 T. c until you decide to write them. After that, of course, the previous* l: k% \( ^. D: Y$ g
content won't be recoverable./ R1 z- x% E8 x0 H& {" ^
The number of cylinders for this disk is set to 8322.
& F: H# f8 V- R& O There is nothing wrong with that, but this is larger than 1024,0 c( Y0 b4 \/ A' |! h0 u; |) q
and could in certain setups cause problems with: Y/ \' E! V& y' J B$ n0 e: ~
1) software that runs at boot time (e.g., old versions of LILO)
) u, v( B+ _, T a1 u- p 2) booting and partitioning software from other OSs: I9 ^: S/ ` ?0 a( o* M. \' a
(e.g., DOS FDISK, OS/2 FDISK)
1 w% P) F) Y3 b- G Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)+ }* k. r5 v n: Z& J/ z
Command (m for help): p
, q: I) w: d/ H+ M# \ E' s) k Disk /dev/hda: 4294 MB, 4294967296 bytes
% m# M8 X% S! C 16 heads, 63 sectors/track, 8322 cylinders3 V U% i- T6 ^& t( J1 r% v2 s U3 W* T
Units = cylinders of 1008 * 512 = 516096 bytes
) h/ D( }7 c6 y K0 @) q Device Boot Start End Blocks Id System; T% R9 J; i( ?7 l4 j4 b' ]& e0 N
Command (m for help): m
$ s9 R8 h S+ n0 Z1 x9 H Command action9 L9 w( v! i D# ^$ E
a toggle a bootable flag
6 e" R9 M% ]/ R- V' ^ b edit bsd disklabel7 K: }6 Y' l. U
c toggle the dos compatibility flag
r, `6 p! h( W9 k; v X d delete a partition$ y3 Z$ ]' m6 V$ ~
l list known partition types
. B6 h5 T$ C3 b8 ~& e m print this menu
) H! g# T' {" |7 q) C0 T n add a new partition( P; R" c3 c4 H/ L1 I; @5 ]
o create a new empty DOS partition table% i$ ^% v, W+ F }6 a) }6 P
p print the partition table/ R& R2 u& j: o) i, _& \! E
q quit without saving changes
/ C4 w% i2 e4 y8 b/ `7 `! S s create a new empty Sun disklabel9 L Z: Q2 n; g4 W2 l
t change a partition's system id3 I" n) f5 N' d0 u2 u8 W
u change display/entry units
) @/ z3 J) _1 R6 k8 G% F' T v verify the partition table
! U% S0 n; v9 m* u2 X4 B w write table to disk and exit; N; A+ f6 x* n# }- b8 d3 f
x extra functionality (experts only)
! ^/ f; j" V+ j* F Command (m for help): n
$ Q8 F5 t( w- n1 {2 e( Z3 _ Command action
" G0 f' N/ P) T7 w e extended: s) Y3 d! I& E- {8 u" L
p primary partition (1-4)/ Z: T' ]# T1 l% u6 G
p% m Y# o- I- j! M9 j, _0 r
Partition number (1-4): 1
0 v0 \5 z& R7 J" j First cylinder (1-8322, default 1): , {6 G+ G7 F" K8 g
Using default value 1
6 R- w1 z$ l6 s; C! f Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G$ P, X5 B: O9 g/ w, P+ x! p% m
Command (m for help): p
n x# ] }3 x1 a j Disk /dev/hda: 4294 MB, 4294967296 bytes
8 {$ D* n3 _+ l. e/ [ J 16 heads, 63 sectors/track, 8322 cylinders
4 n2 A8 k% _2 W Units = cylinders of 1008 * 512 = 516096 bytes
0 h& [7 Q. B9 f& X3 D# t. P Device Boot Start End Blocks Id System) D& S6 z" \, d7 G2 p6 ?
/dev/hda1 1 1000 503968+ 83 Linux
, M3 X3 S1 E8 g2 N Command (m for help): w. |& i- w' z1 N( K0 h0 ?
The partition table has been altered!0 v9 ]# j- P' j: {
Calling ioctl() to re-read partition table.
. q2 ~4 i$ z$ g$ f- ~+ B Syncing disks.
/ \! K9 ^( s! x //格式化新分区
2 d' e& S7 x" ]. \5 g0 umke2fs 1.32 (09-Nov-2002)
1 b2 H* H0 f1 U' J% X6 \: y Filesystem label=
5 \4 O) R8 q" }9 W0 ~6 d' ^ OS type: Linux
d' x9 W. s2 _4 T Block size=1024 (log=0)( d' I+ V: A4 u" l) y$ x
Fragment size=1024 (log=0)
|- r L! ?' K+ t; ^ 126480 inodes, 503968 blocks
- Z) ?! v) z0 V: | 25198 blocks (5.00%) reserved for the super user8 \3 L) U, m) ~; B4 M
First data block=1
z! S: ~% L' ^. [2 @ 62 block groups
; D. D" O0 z: N J9 i8 W0 f6 \1 T/ ? 8192 blocks per group, 8192 fragments per group1 F; m- h0 |6 K+ L. R6 P! p
2040 inodes per group+ Q+ ^# w1 W: d2 Z R9 K$ q9 F. _- z
Superblock backups stored on blocks:
) O+ y" I0 |6 j8 F' F1 F) N 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
% }' Q6 i- B1 `! G3 F Writing inode tables: done
' p; A+ n9 ?, P( b' i2 _ Creating journal (8192 blocks): done
0 h$ w7 x% i, c Writing superblocks and filesystem accounting information: done
& K7 n3 S/ w4 l+ O5 V* s9 V/ y3 u This filesystem will be automatically checked every 30 mounts or
) D: R% h7 ^ [8 Z 180 days, whichever comes first. Use tune2fs -c or -i to override.& p! l. T! p8 U3 I1 e' }
文件系统 1K-块 已用 可用 已用% 挂载点3 u' C* e& W6 f4 B4 q/ x
/dev/sda3 3723848 705992 2828692 20% /, g: \% n# p' Z2 ^9 O
/dev/sda1 101089 9274 86596 10% /boot6 F9 M* @/ P( Y i5 u6 W
none 14520 0 14520 0% /dev/shm: O9 l; o( U) H' `2 C7 y8 ?2 {
//挂上新分区
2 ?( M4 ~* R) b ^- mount /dev/hda1 /home
+ n8 S7 N# S3 M, M/ x% P - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
/ J9 n Z) v9 r$ { /dev/sda3 3723848 705992 2828692 20% /
0 H* I, {+ j2 k+ J& t /dev/sda1 101089 9274 86596 10% /boot
4 o8 R/ m' p1 ?% [, f none 14520 0 14520 0% /dev/shm
1 z& v1 j+ ~# D /dev/hda1 488006 8239 454569 2% /home' Y, H6 n. D. n, v$ V$ n; d
% q6 }1 j, A3 p( o6 Y# C [' X# }2 W
自动挂载: n* i; _' m$ [% l; H% U
- vi /etc/fstab
2 n6 j4 b j8 f- C - 8 y4 g q" ~9 K0 ]: t, n
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
2 E3 r) B& l9 z - + r! @. D3 g$ B0 k4 G3 p
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
8 ?6 Y3 g1 x% [1 {8 w0 C5 z- mount /dev/sdb5 /mnt/ljp1
2 Z8 o0 p3 R5 H6 p8 N6 [
6 b. u i+ i, Y% H0 M- mount /dev/sdb6 /mnt/ljp2
复制代码
" [, e( }" R1 |3 U6 u+ U, O! w- T
^8 s. k. g; C: e6 P }1 t1 e+ ~' l- W" Q3 w
|
|