|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
) m( k( W/ N) N* b$ W or: fdisk /dev/sdc (for the third SCSI disk)% j9 ] K/ R& H9 U8 Y9 C
or: fdisk /dev/eda (for the first PS/2 ESDI drive) ~* q7 J g- A3 q1 i5 |3 b4 X" y
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)# G( l/ Q% X/ R, p. O) I
...
* V& M# o5 E+ ~$ _- df -k
3 w% s6 v( N7 z- @4 r - df -lh7 M8 o& [' v0 G; A9 L% @
- 查看有几块硬盘:fdisk -l* Z5 F: o z4 H! }
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
4 v- N8 r9 x5 x0 _ /dev/sda3 3723848 705968 2828716 20% /# r9 [2 c' j4 O& V
/dev/sda1 101089 9274 86596 10% /boot
/ Z G4 V* Q$ ]# V9 F; _ none 14520 0 14520 0% /dev/shm
2 }. H7 z8 t7 I" \; @6 T( W 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
. E* d' i. v) ?) |. xDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel6 |: G2 ?, o' j% U+ m* }1 W! n& d6 T$ E
Building a new DOS disklabel. Changes will remain in memory only,
4 B+ }' h* Z, X( h5 C& o/ X* s2 W) I until you decide to write them. After that, of course, the previous
* o2 l' Z& A6 \1 K) U8 G content won't be recoverable.
& B# M" h4 }$ ?/ L1 |) O The number of cylinders for this disk is set to 8322.
/ a: b# e. V& l3 f# c7 z# v There is nothing wrong with that, but this is larger than 1024,7 M% t# U. E7 z5 D) d6 Y& F
and could in certain setups cause problems with:9 ]# Q: T q5 w) F; h0 j/ D1 o- B
1) software that runs at boot time (e.g., old versions of LILO)
5 } [6 Z5 S) p 2) booting and partitioning software from other OSs; _/ r6 S% z# j2 f2 A D) k0 P; g
(e.g., DOS FDISK, OS/2 FDISK)
) l7 m! m6 z+ @/ g+ k# J Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)# l# h; S3 z4 O+ @1 t$ u6 |& e: J
Command (m for help): p
7 {' o9 E3 a* U Disk /dev/hda: 4294 MB, 4294967296 bytes
1 Q* h1 r) _* K5 r3 e, k7 \ 16 heads, 63 sectors/track, 8322 cylinders
8 e/ ^: I4 `/ u9 _5 \$ S7 x Units = cylinders of 1008 * 512 = 516096 bytes: j% s* q5 x# t5 K3 i
Device Boot Start End Blocks Id System
# E( z" T& g' i3 E) N6 d5 l( g/ S0 s Command (m for help): m) I/ N( L. g# w1 ?
Command action# ~- U! f4 [5 y8 s
a toggle a bootable flag
4 I: o6 r1 r, a& p; h" j b edit bsd disklabel
/ N! f5 x i. C/ V1 N) W% I M c toggle the dos compatibility flag
' E* L7 C. D0 n# R) H# v d delete a partition: n0 x& K$ \) v) R8 e" Z- _% G
l list known partition types- k: x6 c( B5 h. l
m print this menu1 ]& `4 H6 T$ w
n add a new partition
6 Q( K& n& S; O" y4 e o create a new empty DOS partition table
8 m& k# s2 N# x$ ~" N H( N1 d p print the partition table
3 T: g% g/ }9 ^7 y- B; J% M# w q quit without saving changes+ j- @( E3 {7 p L, t: Z+ M
s create a new empty Sun disklabel
* G4 B, {% \* W" Z t change a partition's system id
. R% G: J( ^% j! C( e u change display/entry units" J$ S/ p. Q2 ^, O+ i! R. A
v verify the partition table
" g4 b6 Q9 l$ U" f( f* t w write table to disk and exit- Q% B# o( u' W# [ M q9 v/ L
x extra functionality (experts only)
$ j; c" P* E' Y, ~1 K6 h Command (m for help): n
4 \+ A% r# l9 n& K: h" c& I Command action- D7 t/ }+ ~- Q! S
e extended
0 z' A2 U. f) x/ b2 ^% x1 }" j p primary partition (1-4)& F5 b5 K4 Z* v) _
p# Y* x2 z8 |7 R6 j
Partition number (1-4): 1
; ?. B( M I Y3 A- ] First cylinder (1-8322, default 1):
2 s g/ U( D4 ~# n% y! J. @4 H Using default value 1
) \, k7 z' F) d Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G& s" `2 H+ a: X: N! I
Command (m for help): p8 K! S+ i7 ^2 a; m4 e
Disk /dev/hda: 4294 MB, 4294967296 bytes
/ ?$ M1 r8 E+ P4 w3 _ 16 heads, 63 sectors/track, 8322 cylinders+ I7 Q3 [$ ]7 k; ], U
Units = cylinders of 1008 * 512 = 516096 bytes
1 B; Y; t! j. K2 |0 {( v; x9 P Device Boot Start End Blocks Id System4 |, |( {' c' o- j9 f
/dev/hda1 1 1000 503968+ 83 Linux
8 `5 c' O! i) V2 d m$ f Command (m for help): w
; y, L) H. e: ^: @/ k The partition table has been altered!
( w- i$ {5 R/ `4 K. f Calling ioctl() to re-read partition table.
3 | t( K0 ]8 |/ v- A( u Syncing disks.
1 K4 V3 L1 O( k; L6 a4 N //格式化新分区" s2 k0 w3 h1 J1 J
mke2fs 1.32 (09-Nov-2002)8 b% y- I4 ]& e! j
Filesystem label=4 S$ W, P# Y p
OS type: Linux$ X2 N7 ^" a; B% L1 D
Block size=1024 (log=0)
7 n* [& H0 D- | R3 U5 j Fragment size=1024 (log=0)
3 U3 x J1 ]4 C: O 126480 inodes, 503968 blocks7 L! [& I T0 ]+ C
25198 blocks (5.00%) reserved for the super user9 C$ y6 x( H# T. ~
First data block=1
( {( j$ @. X) x 62 block groups, O8 z. R0 i/ Z' g6 a+ s1 f. |7 ]
8192 blocks per group, 8192 fragments per group- c7 [2 s l) }
2040 inodes per group
2 ~& j4 B5 g+ {8 R Superblock backups stored on blocks: # o$ J6 _0 u' f) W
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409% g& g: Z, |# s8 K/ D
Writing inode tables: done
/ l/ T( U6 t F/ m1 l3 [5 M3 C+ I3 U0 C Creating journal (8192 blocks): done
: j+ Q' x, e% C5 U" k& Q8 s Writing superblocks and filesystem accounting information: done0 B: [; K7 N' L7 L/ x( g" A& B6 T
This filesystem will be automatically checked every 30 mounts or
: Z+ I; {: E7 W5 w7 B 180 days, whichever comes first. Use tune2fs -c or -i to override.
3 |' i+ `7 b, C6 [3 w文件系统 1K-块 已用 可用 已用% 挂载点
1 n% Y6 E& A, K5 i /dev/sda3 3723848 705992 2828692 20% /
" J% m6 u* X4 Z. M* n: O /dev/sda1 101089 9274 86596 10% /boot% G3 c" U# t& ^3 e3 e
none 14520 0 14520 0% /dev/shm
+ K1 X9 x7 @ q# ]& a5 ^4 ? //挂上新分区
& k! P* C) y) k# R& h- mount /dev/hda1 /home" ]% g1 ]5 E7 W/ J! P) O- q* [: Y
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
0 }. w0 X, _+ V* `. z6 I7 E" X) G /dev/sda3 3723848 705992 2828692 20% /( e) u9 K" r2 d; ~4 d
/dev/sda1 101089 9274 86596 10% /boot
) I* k; A3 z6 H8 O p. _5 t none 14520 0 14520 0% /dev/shm8 R% F0 p5 @% t6 S# K( z
/dev/hda1 488006 8239 454569 2% /home
# v& ?1 Y& O4 v) W6 O$ L& X- ]7 \! U$ g& Q1 \
自动挂载:( ?$ f- C+ ~$ R
- vi /etc/fstab7 v5 M* e' y! G) v8 m5 c5 Y
- ; K: }+ M* [- Q( H- H5 w H
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
" ]4 ^+ }" I1 f) H
( J/ B; R1 {; b; A! N% l- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
/ X! Q7 m G& [" k! ]2 m- mount /dev/sdb5 /mnt/ljp1
8 J$ M. Z' L* s2 V - 9 @% ~% U; Q+ s2 Y
- mount /dev/sdb6 /mnt/ljp2
复制代码 7 Q; ^ X* x: z' u$ R3 P" ~4 \( Y
+ b% X" V; P, S. d6 f2 H
3 b/ s, D* [" e1 S4 Q* L) @ |
|