|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
) b) T$ a: J" ^6 S1 ]+ Z or: fdisk /dev/sdc (for the third SCSI disk)5 b0 I8 f/ I" {+ x7 b
or: fdisk /dev/eda (for the first PS/2 ESDI drive)0 R* s+ k' w! ]" j( D, M# x+ b" [( `
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)0 K p9 V9 s" A b: S6 Q
...
1 M7 \8 x+ w( w% Y) P5 g* B- df -k
- p; b. q( u. e- d+ | - df -lh
5 y% R$ J% @- ^9 z. @: _: O - 查看有几块硬盘:fdisk -l& p) n4 A* E, t% V
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
1 w' g6 Z5 \6 \4 c1 `1 P /dev/sda3 3723848 705968 2828716 20% /' J( c7 z# n- `6 }
/dev/sda1 101089 9274 86596 10% /boot
: |) Y! k9 n/ E* b6 W none 14520 0 14520 0% /dev/shm
% `7 c( @4 R3 p/ X# E" \ T5 Z: y 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用' L6 ^6 G0 Q$ V+ t9 A/ k
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel) U p/ q" G( }1 e I$ N" J
Building a new DOS disklabel. Changes will remain in memory only,
; c+ O3 W3 ]( s3 N6 g' ] until you decide to write them. After that, of course, the previous
5 n0 k; h7 o$ ?5 M content won't be recoverable.9 `& w5 ~' \& Q" D# ^
The number of cylinders for this disk is set to 8322.1 b5 y6 M b9 {/ n
There is nothing wrong with that, but this is larger than 1024,9 J# m" I, l# Y Q$ ~
and could in certain setups cause problems with:( l8 Z' L+ c4 c2 o: I
1) software that runs at boot time (e.g., old versions of LILO)
5 d2 _% p {: h6 i1 y9 k 2) booting and partitioning software from other OSs
& u- ~" b. M+ B: n9 u- `6 Z7 X. [) D, T (e.g., DOS FDISK, OS/2 FDISK), u( ]1 C8 ^) |6 a
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
1 q: n5 \& L6 e* f9 E Command (m for help): p
) V4 R# | `) N |! V; W1 o+ [ B Disk /dev/hda: 4294 MB, 4294967296 bytes
6 h/ D; Y9 [3 V0 K5 g 16 heads, 63 sectors/track, 8322 cylinders' y1 c9 @1 k. Y7 e t6 K3 h% Q
Units = cylinders of 1008 * 512 = 516096 bytes. K E7 A4 p! i8 V- S
Device Boot Start End Blocks Id System
5 W" W4 t. `6 _. L4 C Command (m for help): m# t1 k2 w7 g& G* n/ I
Command action& u, v$ `% V; ` K! K
a toggle a bootable flag3 } u: ~; M+ _) j4 C
b edit bsd disklabel
& H. F4 @; r3 P; j$ i7 Y$ Q c toggle the dos compatibility flag
/ q. `4 x/ D' x) B5 {. @1 V' O d delete a partition( F9 u3 I6 {& l+ O- C: @% J4 C7 ]$ s
l list known partition types- z' D. O, K! D/ F7 X2 {
m print this menu$ f( p u6 E, p& Z7 h+ i/ g v
n add a new partition
& F2 c$ k% G8 n' E a, I; J o create a new empty DOS partition table# G7 c! r& j2 C$ C' u ?: q
p print the partition table
6 w3 j2 ~' H, G: V5 t q quit without saving changes! u3 N& n- ~" ?. N+ B
s create a new empty Sun disklabel3 h* i, G2 l# n6 m4 y
t change a partition's system id) L6 H/ N$ q+ O* s$ Z+ S4 Y
u change display/entry units
9 J/ C% ?+ p, Y2 \ _3 O v verify the partition table0 H1 `* v5 {$ h' v9 x
w write table to disk and exit
# Y% {6 _' t2 V2 D x extra functionality (experts only)( [# P4 D4 ]7 Q; K& Q% f1 @. ]9 C
Command (m for help): n
( A7 e& J7 I D! T5 H Command action
6 }, \. r. u5 f8 j0 w e extended0 p1 O" U4 |- a: f) U
p primary partition (1-4)
- f, l/ d7 k' D( q3 p8 K p) g/ V) x; E: e3 {& @6 p/ v2 q
Partition number (1-4): 1. @6 i- U: f, [& m7 N- {
First cylinder (1-8322, default 1):
' w, O8 q( T- Y A0 \7 ?7 J Using default value 1
) X6 R1 p1 \2 F7 t Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G$ M6 Y1 c! W+ y& S G
Command (m for help): p
8 g" O6 y4 F2 b Disk /dev/hda: 4294 MB, 4294967296 bytes
8 Y. m! E W8 }7 y2 v, I 16 heads, 63 sectors/track, 8322 cylinders
6 Q4 ^/ @; z/ y: v Units = cylinders of 1008 * 512 = 516096 bytes
- }; G+ o: B- V Device Boot Start End Blocks Id System+ |# s0 J- j* H( m E& J4 {
/dev/hda1 1 1000 503968+ 83 Linux
# `$ @. T& S" _. S$ E( _% V Command (m for help): w
8 L8 b; A- |( U* [ The partition table has been altered!2 }" c! S8 J2 S9 n* C& A! L
Calling ioctl() to re-read partition table.
+ x7 q6 H5 o1 U6 D- ]! {3 w. ]( h Syncing disks.
% j M* B' K/ k //格式化新分区
8 z, m( B* K$ Z9 jmke2fs 1.32 (09-Nov-2002)% L: X) ]) e0 N8 v
Filesystem label=
3 i8 `9 w4 e0 x& k+ C OS type: Linux
- v/ ^. V3 Q% ?7 a4 P ~- ~ Block size=1024 (log=0); k, F+ J6 Q S
Fragment size=1024 (log=0)
7 @; B9 b7 f& V/ S( ?( x& _' [; H' j 126480 inodes, 503968 blocks
: L$ E o8 W; N/ y' H 25198 blocks (5.00%) reserved for the super user/ ^7 [* o. q4 B' ]
First data block=1
9 F+ G4 A% y) m( @+ t 62 block groups
* `$ M2 p6 U( S0 ` 8192 blocks per group, 8192 fragments per group
" \/ D& v/ G( o7 k/ D1 L3 m 2040 inodes per group# W; S$ {- q( p, b% a& s8 {
Superblock backups stored on blocks: $ x9 z6 f- U7 m! V J# j+ W
8193, 24577, 40961, 57345, 73729, 204801, 221185, 4014094 [" D$ l7 }$ |& J+ A9 y
Writing inode tables: done
5 ~+ @1 R. N; A0 E Creating journal (8192 blocks): done2 h) E4 {2 i! W; [. m- [
Writing superblocks and filesystem accounting information: done! ]4 |! d1 O6 d; C2 C
This filesystem will be automatically checked every 30 mounts or! O' s0 F1 I: K# F5 Y
180 days, whichever comes first. Use tune2fs -c or -i to override.5 v7 l- `( y( T% \5 v9 j) f
文件系统 1K-块 已用 可用 已用% 挂载点! X! O! ]( r% }4 M% J% P
/dev/sda3 3723848 705992 2828692 20% /
/ Z- H s& j2 l! q( U/ C /dev/sda1 101089 9274 86596 10% /boot
# N6 L# p9 d6 |7 A q none 14520 0 14520 0% /dev/shm, g# [0 X3 Q0 U3 H
//挂上新分区
" r/ ?$ l- ?* d$ Z7 w- mount /dev/hda1 /home& b" h7 C8 q. [ v- E
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点3 d# Y; S# V. ^1 I0 S* M
/dev/sda3 3723848 705992 2828692 20% /
$ d4 Q) G; F: z0 ?2 W) J /dev/sda1 101089 9274 86596 10% /boot4 c* r2 G; W! i ^! Z' {
none 14520 0 14520 0% /dev/shm
+ `- a9 F' s4 E9 @; g /dev/hda1 488006 8239 454569 2% /home
: ~; U: n6 \& v- P4 P& i& K! g2 N: j7 b5 L
自动挂载:) U0 j7 r( A+ [. j C, M7 {3 a+ ~
- vi /etc/fstab
' ]7 e2 m. c! ~# k8 v0 }( v - 0 _, k6 q) ^# Z# n
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 06 u% {# ~4 f" m9 R% `) ~0 p
- : D6 q2 o- s% ]: P. `
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
; h3 A9 d+ B0 t$ Z" u- mount /dev/sdb5 /mnt/ljp1+ ?9 p1 t2 c/ i4 ]3 ~0 @; H! p7 F
- ! E! l9 L4 G% E
- mount /dev/sdb6 /mnt/ljp2
复制代码 " C9 i I: |& x- B. ]* f* s5 N
+ G D+ m J, G9 J
4 h1 _* e" W* C. n) \ |
|