|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)" ^* ?( k# h L. R: W% n
or: fdisk /dev/sdc (for the third SCSI disk)
( C" d; l4 x$ {3 t or: fdisk /dev/eda (for the first PS/2 ESDI drive)
1 n( s) z% o1 K) F, w or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)! c& \! J8 s2 p! u6 v
.../ _4 E3 ?/ N, Y" N5 Q( @5 `
- df -k) C" Z2 z9 U. ~' i* Q e
- df -lh
. m: H# \! _: c5 y" W - 查看有几块硬盘:fdisk -l3 d4 n( H% q' I3 p
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
3 t7 {+ \; P2 ?0 [# ?. h( } /dev/sda3 3723848 705968 2828716 20% /
% V& q* j. ` R& W, N, q5 r; g$ s9 o' O5 s /dev/sda1 101089 9274 86596 10% /boot
; M3 [/ Z8 l4 |8 n* C' \' P$ ~" p none 14520 0 14520 0% /dev/shm
5 A8 H9 o2 h7 G3 I( H' d7 T; z 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用& j8 ^8 i# }$ F8 A5 L' A* A# L
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
5 G& o: u8 U, F5 o Building a new DOS disklabel. Changes will remain in memory only,
1 J5 Y: q5 @% x* s. J) g until you decide to write them. After that, of course, the previous, M0 N, Q& n5 g" K, F ?! B& i
content won't be recoverable.
+ Y3 k; L5 n& F- X# { The number of cylinders for this disk is set to 8322.# d3 c8 X: T% A" \5 J! j( Q s# y
There is nothing wrong with that, but this is larger than 1024,* ?! l) \; M/ T- }
and could in certain setups cause problems with:) G/ Y4 c2 _+ o+ u1 }2 s" c
1) software that runs at boot time (e.g., old versions of LILO)% M0 w" j' F# ]- m2 e
2) booting and partitioning software from other OSs' A0 r6 Z$ y9 j) S' `1 j, y
(e.g., DOS FDISK, OS/2 FDISK)
0 ]$ Z2 G, s( ? Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
w% c8 a' r" u4 j! p Command (m for help): p
2 M4 T8 Y! v$ Q% j% M9 D4 ^ Disk /dev/hda: 4294 MB, 4294967296 bytes
% e: Y3 y2 \5 A7 w. G& l 16 heads, 63 sectors/track, 8322 cylinders4 n3 M9 V% C G! a2 ?% P
Units = cylinders of 1008 * 512 = 516096 bytes
3 E7 U% E, t* x Device Boot Start End Blocks Id System
, N. x6 T+ T& F7 n& l Command (m for help): m
3 a$ M4 t# |* J, \) Z6 F3 E/ _" v Command action
! G+ W7 E, H+ n1 K: r( ~* ? a toggle a bootable flag
9 W' E2 R, t4 x b edit bsd disklabel3 N9 ^8 q+ e3 G* v4 M A: _
c toggle the dos compatibility flag
7 C4 R1 S6 B# ?3 v- t d delete a partition5 k( }% W/ S* ?5 V1 `5 e
l list known partition types
D* U3 L+ b; R& m$ U* a1 ] m print this menu& l% C( B5 Z4 |) D. f J# ?- ~
n add a new partition
0 S' R6 J1 g5 B& e5 X# n) E: K2 v o create a new empty DOS partition table
Z- f# m& e3 G4 N S0 U p print the partition table
- n9 H( v1 ]# b$ h6 q+ U& l q quit without saving changes) n G; Q5 }' Y3 @
s create a new empty Sun disklabel
6 O" N9 l& G4 t+ |, w* e( L t change a partition's system id
/ M2 `5 ~5 Q7 _8 R3 R6 e+ t3 o u change display/entry units3 U/ Z1 t* ^* [* W9 U9 _9 _
v verify the partition table
' y' O2 C7 x. r3 S w write table to disk and exit7 } X; `4 j4 w9 h' Q
x extra functionality (experts only)
. p3 W2 b/ b3 p/ ]1 o Command (m for help): n
. Q7 L1 `- r: j" P Command action
. D5 g9 _, g2 Q; I e extended
7 ]- h1 @% t, i! g. \2 S$ f- w4 w p primary partition (1-4)
% Z7 {( X' w1 E p( d; \3 U9 Q8 I* L
Partition number (1-4): 1
6 J7 V, W3 w1 y1 ] First cylinder (1-8322, default 1): / f, \7 D& U5 g1 [
Using default value 19 w% E8 C/ ^- v5 k
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G) P" F5 x4 x1 r2 Z6 k% o
Command (m for help): p
+ N0 O9 b9 Y& C4 j/ [% t Disk /dev/hda: 4294 MB, 4294967296 bytes
" K( D& {( F# f1 h5 U% J 16 heads, 63 sectors/track, 8322 cylinders# r1 H0 x" W# i0 t& q% P
Units = cylinders of 1008 * 512 = 516096 bytes, f5 a& ^) s& g' h* m9 j: v/ P
Device Boot Start End Blocks Id System
* d/ E6 a( C5 \$ d /dev/hda1 1 1000 503968+ 83 Linux3 K0 a- L( n/ H9 A
Command (m for help): w" T3 G' }1 H' [9 p8 V1 i% u, E
The partition table has been altered!
& }) J% r+ M" F3 g Calling ioctl() to re-read partition table.2 ]4 W. ^+ z& l8 [5 B
Syncing disks.
" U& t& r6 m* `# P4 \" E //格式化新分区
: Z% H) {. u Z, Vmke2fs 1.32 (09-Nov-2002)6 w. r9 P% f( H( Q
Filesystem label=
; a- w) Q- ~0 x OS type: Linux
0 q( w5 }; @& U8 b- _% e) p( Z Block size=1024 (log=0)$ a3 w6 v: L) T0 ?" X* v( {
Fragment size=1024 (log=0)
1 r* e9 N. n( {( m0 {& D 126480 inodes, 503968 blocks' \9 `% R$ x$ ]
25198 blocks (5.00%) reserved for the super user: t2 n, X& E# i2 v7 Z: ^" ~
First data block=1
. H4 G* }$ U. t6 q V* J6 M! z& q 62 block groups# g! b+ x( `- R h8 g9 E
8192 blocks per group, 8192 fragments per group
: ?% a! c- ~' M" r 2040 inodes per group
* |, k# U7 N2 e Superblock backups stored on blocks: 2 ]3 ?7 N3 r8 |, m# \
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
' W+ g. ?% Z; E- s& z' A Writing inode tables: done % }( m( q! V9 t6 E3 O4 h: g
Creating journal (8192 blocks): done" f5 F+ }5 n+ W" F
Writing superblocks and filesystem accounting information: done0 t F/ `; x/ d2 _4 L: X/ G
This filesystem will be automatically checked every 30 mounts or( {# M+ V2 z& ]6 }; c2 ]$ I
180 days, whichever comes first. Use tune2fs -c or -i to override.9 |, T, H! ?- P% D
文件系统 1K-块 已用 可用 已用% 挂载点# E8 L% Z8 ?) J5 W; B3 |
/dev/sda3 3723848 705992 2828692 20% /% C5 C. k, @% \- m- a1 Z
/dev/sda1 101089 9274 86596 10% /boot( N+ I' V* f* ~+ [
none 14520 0 14520 0% /dev/shm$ R( V. Z, v& E" ~4 e
//挂上新分区
. O! L5 F+ x1 J7 J0 a- t! r- mount /dev/hda1 /home
* p( X2 k& D, s - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点' ?3 ~3 A* f8 }2 S- D
/dev/sda3 3723848 705992 2828692 20% /& v! C9 j2 i( V' ]& F: p$ R
/dev/sda1 101089 9274 86596 10% /boot- C0 X3 {0 i# a3 w, a9 \) ~
none 14520 0 14520 0% /dev/shm
( v/ {7 q, c! G" B! J' t$ c( V /dev/hda1 488006 8239 454569 2% /home/ |# p: C! O0 C+ |- Y3 v4 s1 K
2 Y6 \8 T" E& ?- R6 @' P
自动挂载:- M& U4 M3 w5 g
- vi /etc/fstab, @. Z! D" m6 z, b- V# w
2 s$ A$ q+ |. b# q% i- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
6 e6 X6 A5 ^1 A* F; t7 J- a - : N! r. R* S& e2 T9 X( T+ W. }
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:# g+ r, R% C! l$ t7 ]1 h
- mount /dev/sdb5 /mnt/ljp1
" j1 b4 ], k2 w6 t+ ~8 w - 8 G) W' C7 i' I. P9 ^
- mount /dev/sdb6 /mnt/ljp2
复制代码
* g. J: \% Q7 E0 r! V `- l& G' ?2 X: G' m6 K- S
/ X; q4 q& B0 r% k1 s, Y
|
|